SubServers, Host, & Client v2.12b/2.12c/2.12b

This commit is contained in:
ME1312 2017-07-23 14:21:05 -04:00
parent 829e81fd9d
commit df9797496a
13 changed files with 15 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,4 +2,4 @@ Manifest-Version: 1.0
Class-Path: BungeeCord.jar
Main-Class: net.ME1312.SubServers.Bungee.Launch
Implementation-Version: 2.12b
Specification-Version: 3
Specification-Version: 0

Binary file not shown.

Binary file not shown.

View File

@ -81,7 +81,11 @@ public class InternalSubCreator extends SubCreator {
try {
System.out.println(name + "/Creator > Loading Template: " + template.getDisplayName());
Util.copyDirectory(template.getDirectory(), dir);
if (template.getType() == ServerType.SPONGE) {
if (template.getType() == ServerType.VANILLA) {
String patch = "Patch";
if (version.compareTo(new Version("1.12")) >= 0) patch += "-v2";
version = new Version(version.toString() + " " + patch);
} else if (template.getType() == ServerType.SPONGE) {
System.out.println(name + "/Creator > Searching Versions...");
Document spongexml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(Util.readAll(new BufferedReader(new InputStreamReader(new URL("http://files.minecraftforge.net/maven/org/spongepowered/spongeforge/maven-metadata.xml").openStream(), Charset.forName("UTF-8")))))));
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")))))));

View File

@ -92,7 +92,7 @@ public final class SubPlugin extends BungeeCord {
if (!(new UniversalFile(dir, "Templates:Vanilla:template.yml").exists())) {
Util.unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/vanilla.zip"), new UniversalFile(dir, "Templates"));
System.out.println("SubServers > Created ~/SubServers/Templates/Vanilla");
} else if ((new Version((new YAMLConfig(new UniversalFile(dir, "Templates:Vanilla:template.yml"))).get().getString("Version", "0")).compareTo(new Version("2.11.2m+"))) != 0) {
} else if ((new Version((new YAMLConfig(new UniversalFile(dir, "Templates:Vanilla:template.yml"))).get().getString("Version", "0")).compareTo(new Version("2.12b+"))) != 0) {
Files.move(new UniversalFile(dir, "Templates:Vanilla").toPath(), new UniversalFile(dir, "Templates:Vanilla.old" + Math.round(Math.random() * 100000)).toPath());
Util.unzip(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Templates/vanilla.zip"), new UniversalFile(dir, "Templates"));
System.out.println("SubServers > Updated ~/SubServers/Templates/Vanilla");

View File

@ -27,7 +27,7 @@ public final class SubPlugin extends JavaPlugin {
public UIHandler gui = null;
public final Version version;
public final Version bversion = new Version(3);
public final Version bversion = null;
public final SubAPI api = new SubAPI(this);
public SubPlugin() {

View File

@ -48,7 +48,7 @@ public final class ExHost {
public SubDataClient subdata = null;
public final Version version = new Version("2.12c");
public final Version bversion = new Version(3);
public final Version bversion = null;
public final SubAPI api = new SubAPI(this);
private boolean running;

View File

@ -208,7 +208,11 @@ public class SubCreator {
thread.name().logger.info.println("Loading Template: " + template.getDisplayName());
host.subdata.sendPacket(new PacketOutExLogMessage(address, "Loading Template: " + template.getDisplayName()));
Util.copyDirectory(template.getDirectory(), dir);
if (template.getType() == ServerType.SPONGE) {
if (template.getType() == ServerType.VANILLA) {
String patch = "Patch";
if (version.compareTo(new Version("1.12")) >= 0) patch += "-v2";
version = new Version(version.toString() + " " + patch);
} else if (template.getType() == ServerType.SPONGE) {
thread.name().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("http://files.minecraftforge.net/maven/org/spongepowered/spongeforge/maven-metadata.xml").openStream(), Charset.forName("UTF-8")))))));

View File

@ -46,10 +46,10 @@ public class PacketExConfigureHost implements PacketIn, PacketOut {
public void execute(JSONObject data) {
host.host = new YAMLSection(data.getJSONObject("host"));
UniversalFile templates = new UniversalFile(host.runtime, "net:ME1312:SubServers:Host:Library:Files:Templates");
templates.mkdirs();
for (String name : data.getJSONObject("templates").keySet()) {
try {
UniversalFile dir = new UniversalFile(templates, name);
dir.mkdirs();
Util.unzip(new ByteArrayInputStream(Base64.getDecoder().decode(data.getJSONObject("templates").getJSONObject(name).getString("files"))), dir);
SubCreator.ServerTemplate template = new SubCreator.ServerTemplate(name, data.getJSONObject("templates").getJSONObject(name).getBoolean("enabled"), data.getJSONObject("templates").getJSONObject(name).getString("icon"), dir,
new YAMLSection(data.getJSONObject("templates").getJSONObject(name).getJSONObject("build")), new YAMLSection(data.getJSONObject("templates").getJSONObject(name).getJSONObject("settings")));