diff --git a/SubServers.Bungee/src/bungee.yml b/SubServers.Bungee/src/bungee.yml index b4131876..201fe425 100644 --- a/SubServers.Bungee/src/bungee.yml +++ b/SubServers.Bungee/src/bungee.yml @@ -1,4 +1,4 @@ name: SubServers-Bungee main: net.ME1312.SubServers.Bungee.Library.Compatibility.Plugin -version: x.x.xx +version: 2.XX.Xx author: ME1312 \ No newline at end of file diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubCreator.java b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubCreator.java index 0833fb0d..9e912342 100644 --- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubCreator.java +++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubCreator.java @@ -1,5 +1,6 @@ package net.ME1312.SubServers.Bungee.Host.Internal; +import com.google.gson.Gson; import net.ME1312.SubServers.Bungee.Event.SubCreateEvent; import net.ME1312.SubServers.Bungee.Host.*; import net.ME1312.SubServers.Bungee.Library.*; @@ -82,16 +83,14 @@ public class InternalSubCreator extends SubCreator { Util.copyDirectory(template.getDirectory(), dir); if (template.getType() == ServerType.FORGE || template.getType() == ServerType.SPONGE) { System.out.println(name + File.separator + "Creator > Searching Versions..."); - Document spongexml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(Util.readAll(new BufferedReader(new InputStreamReader(new URL("https://repo.spongepowered.org/maven/org/spongepowered/sponge" + ((template.getType() == ServerType.FORGE)?"forge":"vanilla") + "/maven-metadata.xml").openStream(), Charset.forName("UTF-8"))))))); + YAMLSection spversionmanifest = new YAMLSection(new Gson().fromJson("{\"versions\":" + Util.readAll(new BufferedReader(new InputStreamReader(new URL("https://dl-api.spongepowered.org/v1/org.spongepowered/sponge" + ((template.getType() == ServerType.FORGE)?"forge":"vanilla") + "/downloads?type=stable&minecraft=" + version).openStream(), Charset.forName("UTF-8")))) + '}', Map.class)); - NodeList spnodeList = spongexml.getElementsByTagName("version"); + YAMLSection spprofile = null; Version spversion = null; - for (int i = 0; i < spnodeList.getLength(); i++) { - Node node = spnodeList.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE) { - if (node.getTextContent().startsWith(version.toString() + '-') && (spversion == null || new Version(node.getTextContent()).compareTo(spversion) >= 0)) { - spversion = new Version(node.getTextContent()); - } + for (YAMLSection profile : spversionmanifest.getSectionList("versions")) { + if (profile.getSection("dependencies").getRawString("minecraft").equalsIgnoreCase(version.toString()) && (spversion == null || new Version(profile.getRawString("version")).compareTo(spversion) >= 0)) { + spprofile = profile; + spversion = new Version(profile.getRawString("version")); } } if (spversion == null) @@ -99,20 +98,7 @@ public class InternalSubCreator extends SubCreator { System.out.println(name + File.separator + "Creator > Found \"sponge" + ((template.getType() == ServerType.FORGE)?"forge":"vanilla") + "-" + spversion.toString() + '"'); if (template.getType() == ServerType.FORGE) { - Document forgexml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(Util.readAll(new BufferedReader(new InputStreamReader(new URL("http://files.minecraftforge.net/maven/net/minecraftforge/forge/maven-metadata.xml").openStream(), Charset.forName("UTF-8"))))))); - - NodeList mcfnodeList = forgexml.getElementsByTagName("version"); - Version mcfversion = null; - for (int i = 0; i < mcfnodeList.getLength(); i++) { - Node node = mcfnodeList.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE) { - if (node.getTextContent().contains(spversion.toString().split("\\-")[1]) && (mcfversion == null || new Version(node.getTextContent()).compareTo(mcfversion) >= 0)) { - mcfversion = new Version(node.getTextContent()); - } - } - } - if (mcfversion == null) - throw new InvalidServerException("Cannot find Forge version for Sponge " + spversion.toString()); + Version mcfversion = new Version(spprofile.getSection("dependencies").getRawString("minecraft") + '-' + spprofile.getSection("dependencies").getRawString("forge")); System.out.println(name + File.separator + "Creator > Found \"forge-" + mcfversion.toString() + '"'); version = new Version(mcfversion.toString() + " " + spversion.toString()); diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Library/Files/Templates/Spigot/template.yml b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Library/Files/Templates/Spigot/template.yml index 0eb55b00..10bf3660 100644 --- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Library/Files/Templates/Spigot/template.yml +++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Library/Files/Templates/Spigot/template.yml @@ -7,4 +7,4 @@ Template: Shell-Location: 'build.sh' Permission: '+x' Settings: - Executable: 'java -Xmx1024M -Dorg.bukkit.craftbukkit.libs.jline.terminal=unix -Djansi.passthrough=true -jar Spigot.jar' \ No newline at end of file + Executable: 'java -Xmx1024M -Dorg.bukkit.craftbukkit.libs.jline.terminal=unix -Djansi.passthrough=true -jar Spigot.jar' \ No newline at end of file diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/SubPlugin.java b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/SubPlugin.java index f39da889..a06ec3a2 100644 --- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/SubPlugin.java +++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/SubPlugin.java @@ -57,7 +57,7 @@ public final class SubPlugin extends BungeeCord implements Listener { public final SubAPI api = new SubAPI(this); public SubDataServer subdata = null; public SubServer sudo = null; - public static final Version version = Version.fromString("2.13.1b"); + public static final Version version = Version.fromString("2.13.2a"); public Proxy redis = null; public boolean canSudo = false; diff --git a/SubServers.Client/Bukkit/src/plugin.yml b/SubServers.Client/Bukkit/src/plugin.yml index 23a5a172..8c021715 100644 --- a/SubServers.Client/Bukkit/src/plugin.yml +++ b/SubServers.Client/Bukkit/src/plugin.yml @@ -1,6 +1,6 @@ name: 'SubServers-Client-Bukkit' main: 'net.ME1312.SubServers.Client.Bukkit.SubPlugin' -version: '2.13.1b' +version: '2.13.2a' authors: [ME1312] softdepend: [Vault, TitleManager] website: 'https://github.com/ME1312/SubServers-2' diff --git a/SubServers.Client/Sponge/src/net/ME1312/SubServers/Client/Sponge/SubPlugin.java b/SubServers.Client/Sponge/src/net/ME1312/SubServers/Client/Sponge/SubPlugin.java index dd78173a..48e65c5a 100644 --- a/SubServers.Client/Sponge/src/net/ME1312/SubServers/Client/Sponge/SubPlugin.java +++ b/SubServers.Client/Sponge/src/net/ME1312/SubServers/Client/Sponge/SubPlugin.java @@ -46,7 +46,7 @@ import java.util.concurrent.TimeUnit; /** * SubServers Client Plugin Class */ -@Plugin(id = "subservers-client-sponge", name = "SubServers-Client-Sponge", authors = "ME1312", version = "2.13.1b", url = "https://github.com/ME1312/SubServers-2", description = "Access your SubServers from Anywhere") +@Plugin(id = "subservers-client-sponge", name = "SubServers-Client-Sponge", authors = "ME1312", version = "2.13.2a", url = "https://github.com/ME1312/SubServers-2", description = "Access your SubServers from Anywhere") public final class SubPlugin { protected NamedContainer>> lang = null; public YAMLConfig config; diff --git a/SubServers.Host/src/net/ME1312/SubServers/Host/Executable/SubCreator.java b/SubServers.Host/src/net/ME1312/SubServers/Host/Executable/SubCreator.java index 996e8a80..8aa4636d 100644 --- a/SubServers.Host/src/net/ME1312/SubServers/Host/Executable/SubCreator.java +++ b/SubServers.Host/src/net/ME1312/SubServers/Host/Executable/SubCreator.java @@ -231,16 +231,14 @@ public class SubCreator { if (template.getType() == ServerType.FORGE || template.getType() == ServerType.SPONGE) { log.logger.info.println("Searching Versions..."); host.subdata.sendPacket(new PacketOutExLogMessage(address, "Searching Versions...")); - Document spongexml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(Util.readAll(new BufferedReader(new InputStreamReader(new URL("https://repo.spongepowered.org/maven/org/spongepowered/sponge" + ((template.getType() == ServerType.FORGE)?"forge":"vanilla") + "/maven-metadata.xml").openStream(), Charset.forName("UTF-8"))))))); + YAMLSection spversionmanifest = new YAMLSection(new JSONObject("{\"versions\":" + Util.readAll(new BufferedReader(new InputStreamReader(new URL("https://dl-api.spongepowered.org/v1/org.spongepowered/sponge" + ((template.getType() == ServerType.FORGE)?"forge":"vanilla") + "/downloads?type=stable&minecraft=" + version).openStream(), Charset.forName("UTF-8")))) + '}')); - NodeList spnodeList = spongexml.getElementsByTagName("version"); + YAMLSection spprofile = null; Version spversion = null; - for (int i = 0; i < spnodeList.getLength(); i++) { - Node node = spnodeList.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE) { - if (node.getTextContent().startsWith(version.toString() + '-') && (spversion == null || new Version(node.getTextContent()).compareTo(spversion) >= 0)) { - spversion = new Version(node.getTextContent()); - } + for (YAMLSection profile : spversionmanifest.getSectionList("versions")) { + if (profile.getSection("dependencies").getRawString("minecraft").equalsIgnoreCase(version.toString()) && (spversion == null || new Version(profile.getRawString("version")).compareTo(spversion) >= 0)) { + spprofile = profile; + spversion = new Version(profile.getRawString("version")); } } if (spversion == null) @@ -249,20 +247,7 @@ public class SubCreator { host.subdata.sendPacket(new PacketOutExLogMessage(address, "Found \"sponge" + ((template.getType() == ServerType.FORGE)?"forge":"vanilla") + "-" + spversion.toString() + '"')); if (template.getType() == ServerType.FORGE) { - Document forgexml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(Util.readAll(new BufferedReader(new InputStreamReader(new URL("http://files.minecraftforge.net/maven/net/minecraftforge/forge/maven-metadata.xml").openStream(), Charset.forName("UTF-8"))))))); - - NodeList mcfnodeList = forgexml.getElementsByTagName("version"); - Version mcfversion = null; - for (int i = 0; i < mcfnodeList.getLength(); i++) { - Node node = mcfnodeList.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE) { - if (node.getTextContent().contains(spversion.toString().split("\\-")[1]) && (mcfversion == null || new Version(node.getTextContent()).compareTo(mcfversion) >= 0)) { - mcfversion = new Version(node.getTextContent()); - } - } - } - if (mcfversion == null) - throw new InvalidServerException("Cannot find Forge version for Sponge " + spversion.toString()); + Version mcfversion = new Version(spprofile.getSection("dependencies").getRawString("minecraft") + '-' + spprofile.getSection("dependencies").getRawString("forge")); log.logger.info.println("Found \"forge-" + mcfversion.toString() + '"'); host.subdata.sendPacket(new PacketOutExLogMessage(address, "Found \"forge-" + mcfversion.toString() + '"'));