mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 02:08:27 +01:00
Add placeholders/warnings for when minecraft versions cannot be detected
This commit is contained in:
parent
0e87345a8b
commit
1ff9a5cf41
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -675,7 +675,14 @@ public final class SubAPI {
|
||||
return new Version(System.getProperty("subservers.minecraft.version"));
|
||||
} else {
|
||||
String raw = plugin.getGameVersion();
|
||||
if (raw.contains(",")) {
|
||||
if (raw == null) {
|
||||
if (System.getProperty("subservers.minecraft.version.unknown", "false").equalsIgnoreCase("false")) {
|
||||
System.setProperty("subservers.minecraft.version.unknown", "true");
|
||||
System.out.println("Could not determine compatible Minecraft version(s); Now using 1.x.x as a placeholder.");
|
||||
System.out.println("Use this launch argument to specify a compatible Minecraft version: -Dsubservers.minecraft.version=1.x.x");
|
||||
}
|
||||
return new Version("1.x.x");
|
||||
} else if (raw.contains(",")) {
|
||||
String[] split = raw.split(",\\s*");
|
||||
return new Version(split[split.length - 1]);
|
||||
} else if (raw.contains("-")) {
|
||||
|
Binary file not shown.
@ -141,7 +141,12 @@ public final class SubAPI {
|
||||
try {
|
||||
return new Version(Bukkit.getBukkitVersion().split("-")[0]);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
return new Version(plugin.version.toString().substring(0, plugin.version.toString().length() - 1));
|
||||
if (System.getProperty("subservers.minecraft.version.unknown", "false").equalsIgnoreCase("false")) {
|
||||
System.setProperty("subservers.minecraft.version.unknown", "true");
|
||||
System.out.println("Could not determine this server's game version; Now using 1.x.x as a placeholder.");
|
||||
System.out.println("Use this launch argument to specify what version this server serves: -Dsubservers.minecraft.version=1.x.x");
|
||||
}
|
||||
return new Version("1.x.x");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -507,6 +507,8 @@ public final class ExHost {
|
||||
}
|
||||
if (subdata != null) Util.isException(() -> subdata.destroy(0));
|
||||
|
||||
if (new File(dir, "Templates").exists()) Util.deleteDirectory(new File(dir, "Templates"));
|
||||
|
||||
Util.isException(FileLogger::end);
|
||||
System.exit(exit);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public final class FileLogger extends OutputStream {
|
||||
this.origin = origin;
|
||||
if (file == null) {
|
||||
new File(dir, "Logs").mkdirs();
|
||||
file = new FileWriter(new File(dir, "Logs" + File.separator + "SubServers #" + (new File(dir, "Logs").list().length + 1) + " (" + new SimpleDateFormat("MM-dd-yyyy").format(Calendar.getInstance().getTime()) + ").log"));
|
||||
file = new FileWriter(new File(dir, "Logs" + File.separator + "SubServers.Host #" + (new File(dir, "Logs").list().length + 1) + " (" + new SimpleDateFormat("MM-dd-yyyy").format(Calendar.getInstance().getTime()) + ").log"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public final class SubAPI {
|
||||
*/
|
||||
public void addCommand(Command command, String... handles) {
|
||||
for (String handle : handles) {
|
||||
commands.put(handle, command);
|
||||
commands.put(handle.toLowerCase(), command);
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@ -150,7 +150,14 @@ public final class SubAPI {
|
||||
return new Version(System.getProperty("subservers.minecraft.version"));
|
||||
} else {
|
||||
String raw = plugin.getGameVersion();
|
||||
if (raw.contains(",")) {
|
||||
if (raw == null) {
|
||||
if (System.getProperty("subservers.minecraft.version.unknown", "false").equalsIgnoreCase("false")) {
|
||||
System.setProperty("subservers.minecraft.version.unknown", "true");
|
||||
System.out.println("Could not determine compatible Minecraft version(s); Now using 1.x.x as a placeholder.");
|
||||
System.out.println("Use this launch argument to specify a compatible Minecraft version: -Dsubservers.minecraft.version=1.x.x");
|
||||
}
|
||||
return new Version("1.x.x");
|
||||
} else if (raw.contains(",")) {
|
||||
String[] split = raw.split(",\\s*");
|
||||
return new Version(split[split.length - 1]);
|
||||
} else if (raw.contains("-")) {
|
||||
|
Loading…
Reference in New Issue
Block a user