correct server main class
This commit is contained in:
parent
56ceb7c2cf
commit
6fd6c3ab34
|
@ -1,15 +1,14 @@
|
||||||
package org.ecorous.esnesnon.nonsense.loader.api.env;
|
package org.ecorous.esnesnon.nonsense.loader.api.env;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
public enum Env {
|
public enum Env {
|
||||||
CLIENT("CLIENT"),
|
CLIENT("CLIENT", "client"),
|
||||||
SERVER("SERVER"),
|
SERVER("SERVER", "server"),
|
||||||
;
|
;
|
||||||
|
|
||||||
final String mixinName;
|
final String mixinName, identifier;
|
||||||
Env(String mixinName){
|
|
||||||
this.mixinName = mixinName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class LoaderImpl implements Loader {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
LOGGER.error("Failed to instantiate plugin: ", e);
|
LOGGER.error("Error during plugin initialisation: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class Minecraft implements NonsensePlugin {
|
||||||
private static final String[] MINECRAFT_CLASSES = new String[]{
|
private static final String[] MINECRAFT_CLASSES = new String[]{
|
||||||
"net/minecraft/client/main/Main.class",
|
"net/minecraft/client/main/Main.class",
|
||||||
"net/minecraft/client/MinecraftApplet.class",
|
"net/minecraft/client/MinecraftApplet.class",
|
||||||
"net/minecraft/server/main/Main.class"
|
"net/minecraft/server/Main.class"
|
||||||
};
|
};
|
||||||
|
|
||||||
private final List<ModProperties> modProperties = new ArrayList<>();
|
private final List<ModProperties> modProperties = new ArrayList<>();
|
||||||
|
@ -122,7 +122,7 @@ public class Minecraft implements NonsensePlugin {
|
||||||
}
|
}
|
||||||
try (FileSystem fs = FileSystems.newFileSystem(jar)) {
|
try (FileSystem fs = FileSystems.newFileSystem(jar)) {
|
||||||
for (String n : MINECRAFT_CLASSES) {
|
for (String n : MINECRAFT_CLASSES) {
|
||||||
if (Files.exists(fs.getPath(n))){
|
if (Files.exists(fs.getPath(n)) && n.contains(LoaderImpl.getInstance().getEnv().getIdentifier())){
|
||||||
LOGGER.info("Found game: {}", jar);
|
LOGGER.info("Found game: {}", jar);
|
||||||
foundMainClass = n.substring(0, n.length()-6).replace("/", ".");
|
foundMainClass = n.substring(0, n.length()-6).replace("/", ".");
|
||||||
version = LoaderImpl.getInstance().getGson().fromJson(Files.readString(fs.getPath("version.json")), JsonObject.class).get("id").getAsString();
|
version = LoaderImpl.getInstance().getGson().fromJson(Files.readString(fs.getPath("version.json")), JsonObject.class).get("id").getAsString();
|
||||||
|
|
Loading…
Reference in a new issue