mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-22 02:08:27 +01:00
Add more ways to detect minecraft version
This commit is contained in:
parent
30b776da86
commit
5f69459e62
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1062,7 +1062,7 @@
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Bungee/SubAPI.html#getGameVersion--">getGameVersion()</a></span> - Method in class net.ME1312.SubServers.Bungee.<a href="net/ME1312/SubServers/Bungee/SubAPI.html" title="class in net.ME1312.SubServers.Bungee">SubAPI</a></dt>
|
||||
<dd>
|
||||
<div class="block">Gets the Recommended Minecraft Version</div>
|
||||
<div class="block">Get an array of compatible Minecraft Versions</div>
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Bungee/Host/Server.html#getGlobalPlayers--">getGlobalPlayers()</a></span> - Method in interface net.ME1312.SubServers.Bungee.Host.<a href="net/ME1312/SubServers/Bungee/Host/Server.html" title="interface in net.ME1312.SubServers.Bungee.Host">Server</a></dt>
|
||||
<dd>
|
||||
|
@ -259,9 +259,9 @@ extends java.lang.Object</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i15" class="rowColor">
|
||||
<td class="colFirst"><code><a href="../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html" title="class in net.ME1312.SubServers.Bungee.Library.Version">Version</a></code></td>
|
||||
<td class="colFirst"><code><a href="../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html" title="class in net.ME1312.SubServers.Bungee.Library.Version">Version</a>[]</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Bungee/SubAPI.html#getGameVersion--">getGameVersion</a></span>()</code>
|
||||
<div class="block">Gets the Recommended Minecraft Version</div>
|
||||
<div class="block">Get an array of compatible Minecraft Versions</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i16" class="altColor">
|
||||
@ -1309,11 +1309,11 @@ public <a href="../../../../net/ME1312/SubServers/Bungee/SubPlugin.html" ti
|
||||
<ul class="blockListLast">
|
||||
<li class="blockList">
|
||||
<h4>getGameVersion</h4>
|
||||
<pre>public <a href="../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html" title="class in net.ME1312.SubServers.Bungee.Library.Version">Version</a> getGameVersion()</pre>
|
||||
<div class="block">Gets the Recommended Minecraft Version</div>
|
||||
<pre>public <a href="../../../../net/ME1312/SubServers/Bungee/Library/Version/Version.html" title="class in net.ME1312.SubServers.Bungee.Library.Version">Version</a>[] getGameVersion()</pre>
|
||||
<div class="block">Get an array of compatible Minecraft Versions</div>
|
||||
<dl>
|
||||
<dt><span class="returnLabel">Returns:</span></dt>
|
||||
<dd>Minecraft Version</dd>
|
||||
<dd>Minecraft Versions</dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -605,7 +605,7 @@
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Sync/SubAPI.html#getGameVersion--">getGameVersion()</a></span> - Method in class net.ME1312.SubServers.Sync.<a href="net/ME1312/SubServers/Sync/SubAPI.html" title="class in net.ME1312.SubServers.Sync">SubAPI</a></dt>
|
||||
<dd>
|
||||
<div class="block">Gets the Latest Supported Minecraft Version</div>
|
||||
<div class="block">Get an array of compatible Minecraft Versions</div>
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Sync/Event/SubAddHostEvent.html#getHost--">getHost()</a></span> - Method in class net.ME1312.SubServers.Sync.Event.<a href="net/ME1312/SubServers/Sync/Event/SubAddHostEvent.html" title="class in net.ME1312.SubServers.Sync.Event">SubAddHostEvent</a></dt>
|
||||
<dd>
|
||||
|
@ -136,9 +136,9 @@ extends java.lang.Object</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i1" class="rowColor">
|
||||
<td class="colFirst"><code><a href="../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html" title="class in net.ME1312.SubServers.Sync.Library.Version">Version</a></code></td>
|
||||
<td class="colFirst"><code><a href="../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html" title="class in net.ME1312.SubServers.Sync.Library.Version">Version</a>[]</code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/ME1312/SubServers/Sync/SubAPI.html#getGameVersion--">getGameVersion</a></span>()</code>
|
||||
<div class="block">Gets the Latest Supported Minecraft Version</div>
|
||||
<div class="block">Get an array of compatible Minecraft Versions</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="i2" class="altColor">
|
||||
@ -418,11 +418,11 @@ public <a href="../../../../net/ME1312/SubServers/Sync/SubPlugin.html" titl
|
||||
<ul class="blockListLast">
|
||||
<li class="blockList">
|
||||
<h4>getGameVersion</h4>
|
||||
<pre>public <a href="../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html" title="class in net.ME1312.SubServers.Sync.Library.Version">Version</a> getGameVersion()</pre>
|
||||
<div class="block">Gets the Latest Supported Minecraft Version</div>
|
||||
<pre>public <a href="../../../../net/ME1312/SubServers/Sync/Library/Version/Version.html" title="class in net.ME1312.SubServers.Sync.Library.Version">Version</a>[] getGameVersion()</pre>
|
||||
<div class="block">Get an array of compatible Minecraft Versions</div>
|
||||
<dl>
|
||||
<dt><span class="returnLabel">Returns:</span></dt>
|
||||
<dd>Minecraft Version</dd>
|
||||
<dd>Minecraft Versions</dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -28,7 +28,7 @@
|
||||
<dependency>
|
||||
<groupId>net.md_5</groupId>
|
||||
<artifactId>bungeecord-internal</artifactId>
|
||||
<version>1.8-SNAPSHOT</version>
|
||||
<version>1.9-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
Binary file not shown.
@ -89,17 +89,21 @@ public final class Launch {
|
||||
|
||||
if (!options.has("noconsole")) {
|
||||
String line;
|
||||
while (plugin.isRunning && (line = plugin.getConsoleReader().readLine(">")) != null) {
|
||||
if (plugin.sudo == null) {
|
||||
if (!plugin.getPluginManager().dispatchCommand(net.md_5.bungee.command.ConsoleCommandSender.class.cast(net.md_5.bungee.command.ConsoleCommandSender.class.getMethod("getInstance").invoke(null)), line)) {
|
||||
plugin.getConsole().sendMessage(net.md_5.bungee.api.ChatColor.RED + "Command not found");
|
||||
try {
|
||||
while (plugin.isRunning && (line = plugin.getConsoleReader().readLine(">")) != null) {
|
||||
if (plugin.sudo == null) {
|
||||
if (!plugin.getPluginManager().dispatchCommand(net.md_5.bungee.command.ConsoleCommandSender.class.cast(net.md_5.bungee.command.ConsoleCommandSender.class.getMethod("getInstance").invoke(null)), line)) {
|
||||
plugin.getConsole().sendMessage(net.md_5.bungee.api.ChatColor.RED + "Command not found");
|
||||
}
|
||||
} else if (line.equalsIgnoreCase("exit")) {
|
||||
plugin.sudo = null;
|
||||
System.out.println("SubServers > Reverting to the BungeeCord Console");
|
||||
} else {
|
||||
plugin.sudo.command(line);
|
||||
}
|
||||
} else if (line.equalsIgnoreCase("exit")) {
|
||||
plugin.sudo = null;
|
||||
System.out.println("SubServers > Reverting to the BungeeCord Console");
|
||||
} else {
|
||||
plugin.sudo.command(line);
|
||||
}
|
||||
} catch (NoSuchMethodError | NoSuchMethodException e) {
|
||||
plugin.getLogger().warning("Standard BungeeCord console not found; Console commands now disabled.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import net.ME1312.SubServers.Bungee.Network.PacketIn;
|
||||
import net.ME1312.SubServers.Bungee.Network.PacketOut;
|
||||
import net.ME1312.SubServers.Bungee.SubPlugin;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Download Proxy Info Packet
|
||||
*/
|
||||
@ -49,7 +51,7 @@ public class PacketDownloadProxyInfo implements PacketIn, PacketOut {
|
||||
bungee.set("servers", plugin.api.getServers().size());
|
||||
data.set("bungee", bungee);
|
||||
YAMLSection minecraft = new YAMLSection();
|
||||
minecraft.set("version", plugin.api.getGameVersion());
|
||||
minecraft.set("version", Arrays.asList(plugin.api.getGameVersion()));
|
||||
minecraft.set("players", plugin.api.getGlobalPlayers().size());
|
||||
data.set("minecraft", minecraft);
|
||||
YAMLSection system = new YAMLSection();
|
||||
|
@ -5,6 +5,7 @@ import net.ME1312.SubServers.Bungee.Event.SubAddServerEvent;
|
||||
import net.ME1312.SubServers.Bungee.Event.SubRemoveHostEvent;
|
||||
import net.ME1312.SubServers.Bungee.Event.SubRemoveServerEvent;
|
||||
import net.ME1312.SubServers.Bungee.Host.*;
|
||||
import net.ME1312.SubServers.Bungee.Library.Container;
|
||||
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidHostException;
|
||||
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
|
||||
import net.ME1312.SubServers.Bungee.Library.UniversalFile;
|
||||
@ -12,6 +13,7 @@ import net.ME1312.SubServers.Bungee.Library.Util;
|
||||
import net.ME1312.SubServers.Bungee.Library.Version.Version;
|
||||
import net.ME1312.SubServers.Bungee.Network.SubDataServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.InetAddress;
|
||||
@ -666,31 +668,36 @@ public final class SubAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Recommended Minecraft Version
|
||||
* Get an array of compatible Minecraft Versions
|
||||
*
|
||||
* @return Minecraft Version
|
||||
* @return Minecraft Versions
|
||||
*/
|
||||
public Version getGameVersion() {
|
||||
if (System.getProperty("subservers.minecraft.version", "").length() > 0) {
|
||||
return new Version(System.getProperty("subservers.minecraft.version"));
|
||||
} else {
|
||||
String raw = plugin.getGameVersion();
|
||||
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");
|
||||
public Version[] getGameVersion() {
|
||||
if (GAME_VERSION == null) {
|
||||
Container<Boolean> valid = new Container<Boolean>(false);
|
||||
if (System.getProperty("subservers.minecraft.version", "").length() > 0) {
|
||||
return new Version[]{new Version(System.getProperty("subservers.minecraft.version"))};
|
||||
} else if (!Util.isException(() -> valid.set(ProtocolConstants.SUPPORTED_VERSIONS != null)) && valid.get()) {
|
||||
List<Version> versions = new LinkedList<Version>();
|
||||
for (String version : ProtocolConstants.SUPPORTED_VERSIONS) versions.add(new Version(version));
|
||||
Collections.sort(versions);
|
||||
return versions.toArray(new Version[versions.size()]);
|
||||
} else if (!Util.isException(() -> valid.set(plugin.getGameVersion() != null)) && valid.get()) {
|
||||
String raw = plugin.getGameVersion();
|
||||
if (raw.contains("-") || raw.contains(",")) {
|
||||
List<Version> versions = new LinkedList<Version>();
|
||||
for (String version : raw.split("(?:\\s*-|,)\\s*")) versions.add(new Version(version));
|
||||
Collections.sort(versions);
|
||||
return versions.toArray(new Version[versions.size()]);
|
||||
} else {
|
||||
return new Version[]{new Version(plugin.getGameVersion())};
|
||||
}
|
||||
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("-")) {
|
||||
String[] split = raw.split("\\s*-\\s*");
|
||||
return new Version(split[split.length - 1]);
|
||||
} else {
|
||||
return new Version(plugin.getGameVersion());
|
||||
plugin.getLogger().warning("Could not determine compatible Minecraft version(s); Now using 1.x.x as a placeholder.");
|
||||
plugin.getLogger().warning("Use this launch argument to specify a compatible Minecraft version: -Dsubservers.minecraft.version=1.x.x");
|
||||
return new Version[]{new Version("1.x.x")};
|
||||
}
|
||||
}
|
||||
} else return GAME_VERSION;
|
||||
}
|
||||
private Version[] GAME_VERSION = getGameVersion();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public final class SubCommand extends CommandX {
|
||||
protected static NamedContainer<SubCommand, CommandX> newInstance(SubPlugin plugin, String command) {
|
||||
NamedContainer<SubCommand, CommandX> cmd = new NamedContainer<>(new SubCommand(plugin, command), null);
|
||||
CommandX now = cmd.name();
|
||||
if (plugin.api.getGameVersion().compareTo(new Version("1.13")) >= 0) {
|
||||
if (plugin.api.getGameVersion()[plugin.api.getGameVersion().length - 1].compareTo(new Version("1.13")) >= 0) {
|
||||
now = new net.ME1312.SubServers.Bungee.Library.Compatibility.v1_13.CommandX(cmd.name());
|
||||
}
|
||||
cmd.set(now);
|
||||
@ -533,7 +533,7 @@ public final class SubCommand extends CommandX {
|
||||
protected static NamedContainer<BungeeServer, CommandX> newInstance(SubPlugin plugin, String command) {
|
||||
NamedContainer<BungeeServer, CommandX> cmd = new NamedContainer<>(new BungeeServer(plugin, command), null);
|
||||
CommandX now = cmd.name();
|
||||
if (plugin.api.getGameVersion().compareTo(new Version("1.13")) >= 0) {
|
||||
if (plugin.api.getGameVersion()[plugin.api.getGameVersion().length - 1].compareTo(new Version("1.13")) >= 0) {
|
||||
now = new net.ME1312.SubServers.Bungee.Library.Compatibility.v1_13.CommandX(cmd.name());
|
||||
}
|
||||
cmd.set(now);
|
||||
|
@ -60,7 +60,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
public SubServer sudo = null;
|
||||
//public static final Version version = new Version("2.13a");
|
||||
//public static final Version version = new Version(new Version("2.13a"), VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
public static final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 2); // TODO Beta Version Setting
|
||||
public static final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 3); // TODO Beta Version Setting
|
||||
|
||||
public boolean redis = false;
|
||||
public long resetDate = 0;
|
||||
@ -70,7 +70,7 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected SubPlugin(PrintStream out) throws IOException {
|
||||
System.out.println("SubServers > Loading SubServers.Bungee v" + version.toString() + " Libraries (for Minecraft " + api.getGameVersion() + ")");
|
||||
System.out.println("SubServers > Loading SubServers.Bungee v" + version.toString() + " Libraries (for Minecraft " + api.getGameVersion()[api.getGameVersion().length - 1] + ")");
|
||||
|
||||
this.out = out;
|
||||
if (!(new UniversalFile(dir, "config.yml").exists())) {
|
||||
|
Binary file not shown.
@ -135,19 +135,19 @@ public final class SubAPI {
|
||||
* @return Minecraft Version
|
||||
*/
|
||||
public Version getGameVersion() {
|
||||
if (System.getProperty("subservers.minecraft.version", "").length() > 0) {
|
||||
return new Version(System.getProperty("subservers.minecraft.version"));
|
||||
} else {
|
||||
try {
|
||||
return new Version(Bukkit.getBukkitVersion().split("-")[0]);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
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");
|
||||
if (GAME_VERSION == null) {
|
||||
if (System.getProperty("subservers.minecraft.version", "").length() > 0) {
|
||||
return new Version(System.getProperty("subservers.minecraft.version"));
|
||||
} else {
|
||||
try {
|
||||
return new Version(Bukkit.getBukkitVersion().split("-")[0]);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
plugin.getLogger().warning("Could not determine this server's game version; Now using 1.x.x as a placeholder.");
|
||||
plugin.getLogger().warning("Use this launch argument to specify what version this server serves: -Dsubservers.minecraft.version=1.x.x");
|
||||
return new Version("1.x.x");
|
||||
}
|
||||
return new Version("1.x.x");
|
||||
}
|
||||
}
|
||||
} else return GAME_VERSION;
|
||||
}
|
||||
private Version GAME_VERSION = getGameVersion();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public final class SubPlugin extends JavaPlugin {
|
||||
super();
|
||||
//version = new Version(getDescription().getVersion());
|
||||
//version = new Version(new Version(getDescription().getVersion()), VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
version = new Version(new Version(new Version(getDescription().getVersion()), VersionType.PRE_RELEASE, 3), VersionType.BETA, 2); // TODO Beta Version Setting
|
||||
version = new Version(new Version(new Version(getDescription().getVersion()), VersionType.PRE_RELEASE, 3), VersionType.BETA, 3); // TODO Beta Version Setting
|
||||
}
|
||||
|
||||
/**
|
||||
|
Binary file not shown.
@ -53,7 +53,7 @@ public final class ExHost {
|
||||
|
||||
//public final Version version = new Version("2.13a");
|
||||
//public final Version version = new Version(new Version("2.13a"), VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
public final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 2); // TODO Beta Version Setting
|
||||
public final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 3); // TODO Beta Version Setting
|
||||
public final SubAPI api = new SubAPI(this);
|
||||
|
||||
private ConsoleReader jline;
|
||||
|
@ -28,7 +28,7 @@
|
||||
<dependency>
|
||||
<groupId>net.md_5</groupId>
|
||||
<artifactId>bungeecord-internal</artifactId>
|
||||
<version>1.8-SNAPSHOT</version>
|
||||
<version>1.9-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
Binary file not shown.
@ -88,11 +88,15 @@ public final class Launch {
|
||||
plugin.start();
|
||||
|
||||
if (!options.has("noconsole")) {
|
||||
String line;
|
||||
while (plugin.isRunning && (line = plugin.getConsoleReader().readLine(">")) != null) {
|
||||
if (!plugin.getPluginManager().dispatchCommand(net.md_5.bungee.command.ConsoleCommandSender.class.cast(net.md_5.bungee.command.ConsoleCommandSender.class.getMethod("getInstance").invoke(null)), line)) {
|
||||
plugin.getConsole().sendMessage(net.md_5.bungee.api.ChatColor.RED + "Command not found");
|
||||
try {
|
||||
String line;
|
||||
while (plugin.isRunning && (line = plugin.getConsoleReader().readLine(">")) != null) {
|
||||
if (!plugin.getPluginManager().dispatchCommand(net.md_5.bungee.command.ConsoleCommandSender.class.cast(net.md_5.bungee.command.ConsoleCommandSender.class.getMethod("getInstance").invoke(null)), line)) {
|
||||
plugin.getConsole().sendMessage(net.md_5.bungee.api.ChatColor.RED + "Command not found");
|
||||
}
|
||||
}
|
||||
} catch (NoSuchMethodError | NoSuchMethodException e) {
|
||||
plugin.getLogger().warning("Standard BungeeCord console not found; Console commands now disabled.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
package net.ME1312.SubServers.Sync;
|
||||
|
||||
import net.ME1312.SubServers.Sync.Library.Container;
|
||||
import net.ME1312.SubServers.Sync.Library.NamedContainer;
|
||||
import net.ME1312.SubServers.Sync.Library.UniversalFile;
|
||||
import net.ME1312.SubServers.Sync.Library.Util;
|
||||
import net.ME1312.SubServers.Sync.Library.Version.Version;
|
||||
import net.ME1312.SubServers.Sync.Network.SubDataClient;
|
||||
import net.ME1312.SubServers.Sync.Server.Server;
|
||||
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -141,31 +143,36 @@ public final class SubAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Latest Supported Minecraft Version
|
||||
* Get an array of compatible Minecraft Versions
|
||||
*
|
||||
* @return Minecraft Version
|
||||
* @return Minecraft Versions
|
||||
*/
|
||||
public Version getGameVersion() {
|
||||
if (System.getProperty("subservers.minecraft.version", "").length() > 0) {
|
||||
return new Version(System.getProperty("subservers.minecraft.version"));
|
||||
} else {
|
||||
String raw = plugin.getGameVersion();
|
||||
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");
|
||||
public Version[] getGameVersion() {
|
||||
if (GAME_VERSION == null) {
|
||||
Container<Boolean> valid = new Container<Boolean>(false);
|
||||
if (System.getProperty("subservers.minecraft.version", "").length() > 0) {
|
||||
return new Version[]{new Version(System.getProperty("subservers.minecraft.version"))};
|
||||
} else if (!Util.isException(() -> valid.set(ProtocolConstants.SUPPORTED_VERSIONS != null)) && valid.get()) {
|
||||
List<Version> versions = new LinkedList<Version>();
|
||||
for (String version : ProtocolConstants.SUPPORTED_VERSIONS) versions.add(new Version(version));
|
||||
Collections.sort(versions);
|
||||
return versions.toArray(new Version[versions.size()]);
|
||||
} else if (!Util.isException(() -> valid.set(plugin.getGameVersion() != null)) && valid.get()) {
|
||||
String raw = plugin.getGameVersion();
|
||||
if (raw.contains("-") || raw.contains(",")) {
|
||||
List<Version> versions = new LinkedList<Version>();
|
||||
for (String version : raw.split("(?:\\s*-|,)\\s*")) versions.add(new Version(version));
|
||||
Collections.sort(versions);
|
||||
return versions.toArray(new Version[versions.size()]);
|
||||
} else {
|
||||
return new Version[]{new Version(plugin.getGameVersion())};
|
||||
}
|
||||
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("-")) {
|
||||
String[] split = raw.split("\\s*-\\s*");
|
||||
return new Version(split[split.length - 1]);
|
||||
} else {
|
||||
return new Version(plugin.getGameVersion());
|
||||
plugin.getLogger().warning("Could not determine compatible Minecraft version(s); Now using 1.x.x as a placeholder.");
|
||||
plugin.getLogger().warning("Use this launch argument to specify a compatible Minecraft version: -Dsubservers.minecraft.version=1.x.x");
|
||||
return new Version[]{new Version("1.x.x")};
|
||||
}
|
||||
}
|
||||
} else return GAME_VERSION;
|
||||
}
|
||||
private Version[] GAME_VERSION = getGameVersion();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public final class SubCommand extends CommandX {
|
||||
protected static NamedContainer<SubCommand, CommandX> newInstance(SubPlugin plugin, String command) {
|
||||
NamedContainer<SubCommand, CommandX> cmd = new NamedContainer<>(new SubCommand(plugin, command), null);
|
||||
CommandX now = cmd.name();
|
||||
if (plugin.api.getGameVersion().compareTo(new Version("1.13")) >= 0) {
|
||||
if (plugin.api.getGameVersion()[plugin.api.getGameVersion().length - 1].compareTo(new Version("1.13")) >= 0) {
|
||||
now = new net.ME1312.SubServers.Sync.Library.Compatibility.v1_13.CommandX(cmd.name());
|
||||
}
|
||||
cmd.set(now);
|
||||
@ -530,7 +530,7 @@ public final class SubCommand extends CommandX {
|
||||
protected static NamedContainer<BungeeServer, CommandX> newInstance(SubPlugin plugin, String command) {
|
||||
NamedContainer<BungeeServer, CommandX> cmd = new NamedContainer<>(new BungeeServer(plugin, command), null);
|
||||
CommandX now = cmd.name();
|
||||
if (plugin.api.getGameVersion().compareTo(new Version("1.13")) >= 0) {
|
||||
if (plugin.api.getGameVersion()[plugin.api.getGameVersion().length - 1].compareTo(new Version("1.13")) >= 0) {
|
||||
now = new net.ME1312.SubServers.Sync.Library.Compatibility.v1_13.CommandX(cmd.name());
|
||||
}
|
||||
cmd.set(now);
|
||||
|
@ -50,14 +50,14 @@ public final class SubPlugin extends BungeeCord implements Listener {
|
||||
public SubDataClient subdata = null;
|
||||
//public static final Version version = new Version("2.13a");
|
||||
//public static final Version version = new Version(new Version("2.13a"), VersionType.BETA, 1); // TODO Beta Version Setting
|
||||
public static final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 2); // TODO Beta Version Setting
|
||||
public static final Version version = new Version(new Version(new Version("2.13a"), VersionType.PRE_RELEASE, 3), VersionType.BETA, 3); // TODO Beta Version Setting
|
||||
|
||||
|
||||
public long lastReload = -1;
|
||||
private boolean posted = false;
|
||||
|
||||
protected SubPlugin(PrintStream out) throws IOException {
|
||||
System.out.println("SubServers > Loading SubServers.Sync v" + version.toString() + " Libraries (for Minecraft " + api.getGameVersion() + ")");
|
||||
System.out.println("SubServers > Loading SubServers.Sync v" + version.toString() + " Libraries (for Minecraft " + api.getGameVersion()[api.getGameVersion().length - 1] + ")");
|
||||
|
||||
this.out = out;
|
||||
if (!(new UniversalFile(dir, "config.yml").exists())) {
|
||||
|
Loading…
Reference in New Issue
Block a user