Skip to content

Commit

Permalink
Fix to correct server jar location in ReobfServer
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuuta0217 committed May 24, 2024
1 parent f66cab5 commit ff6e57e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/net/unknown/launchwrapper/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
package net.unknown.launchwrapper;

import net.minecraft.launchwrapper.Launch;
import org.spongepowered.asm.util.asm.ASM;

import java.io.File;
import java.io.FileNotFoundException;
Expand All @@ -50,6 +51,7 @@ public class Main {
public static boolean FORCE_ALLOW_TRADE_REBALANCE_FEATURES = System.getProperty("UnknownNetworkMagic") != null && System.getProperty("UnknownNetworkMagic").contains("trade-rebalance");
public static boolean FORCE_ALLOW_UPDATE_1_21 = System.getProperty("UnknownNetworkMagic") != null && System.getProperty("UnknownNetworkMagic").contains("update_1_21");
private static final String FILE_SEPARATOR = System.getProperty("file.separator");
public static Path SERVER_JAR = System.getProperties().contains("unknown.bootstrap.server_jar_path") ? Path.of(System.getProperty("unknown.bootstrap.server_jar_path")) : null;

public static void main(String[] args) throws IOException, InterruptedException {
if (FORCE_ALLOW_BUNDLE_FEATURES || FORCE_ALLOW_TRADE_REBALANCE_FEATURES || FORCE_ALLOW_UPDATE_1_21) {
Expand Down Expand Up @@ -102,6 +104,12 @@ public static void main(String[] args) throws IOException, InterruptedException
}
}

try {
SERVER_JAR = Path.of(Class.forName("io.papermc.paper.pluginremap.ReobfServer").getProtectionDomain().getCodeSource().getLocation().toURI());
} catch (URISyntaxException | ClassNotFoundException e) {
throw new RuntimeException(e);
}

Launch.main(args);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2023 Unknown Network Developers and contributors.
*
* All rights reserved.
*
* NOTICE: This license is subject to change without prior notice.
*
* Redistribution and use in source and binary forms, *without modification*,
* are permitted provided that the following conditions are met:
*
* I. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* II. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* III. Neither the name of Unknown Network nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
* IV. This source code and binaries is provided by the copyright holders and contributors "AS-IS" and
* any express or implied warranties, including, but not limited to, the implied warranties of
* merchantability and fitness for a particular purpose are disclaimed.
* In not event shall the copyright owner or contributors be liable for
* any direct, indirect, incidental, special, exemplary, or consequential damages
* (including but not limited to procurement of substitute goods or services;
* loss of use data or profits; or business interruption) however caused and on any theory of liability,
* whether in contract, strict liability, or tort (including negligence or otherwise)
* arising in any way out of the use of this source code, event if advised of the possibility of such damage.
*/

package net.unknown.launchwrapper.mixins;

import net.unknown.launchwrapper.Main;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

import java.nio.file.Path;

@Mixin(targets = "io.papermc.paper.pluginremap.ReobfServer")
public class MixinReobfServer {
@Overwrite
private static Path serverJar() {
return Main.SERVER_JAR;
}
}
1 change: 1 addition & 0 deletions src/main/resources/unknownnetwork.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"MixinNearestAttackableTargetGoal",
"MixinObserverBlock",
"MixinPiglinAi",
"MixinReobfServer",
"MixinServerLevel",
"MixinSignBlockEntity",
"MixinSimpleContainer",
Expand Down

0 comments on commit ff6e57e

Please sign in to comment.