Update SubServers.Client Auto-Updater

SubServers.Bungee & SubServers.Host now use the more standardised build signature system when deciding on if it should update SubServers.Client. This means it can also differentiate two snapshot builds of the same version from eachother.
This commit is contained in:
ME1312 2018-07-17 03:10:17 -04:00
parent 0ade35f544
commit 6eb82f27bc
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
38 changed files with 129 additions and 87 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -265,10 +265,6 @@
</dd>
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Client/Bukkit/Graphic/InternalUIHandler.html#click-org.bukkit.event.inventory.InventoryClickEvent-">click(InventoryClickEvent)</a></span> - Method in class net.ME1312.SubServers.Client.Bukkit.Graphic.<a href="net/ME1312/SubServers/Client/Bukkit/Graphic/InternalUIHandler.html" title="class in net.ME1312.SubServers.Client.Bukkit.Graphic">InternalUIHandler</a></dt>
<dd>&nbsp;</dd>
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Client/Bukkit/Graphic/UIHandler.html#click-org.bukkit.event.inventory.InventoryClickEvent-">click(InventoryClickEvent)</a></span> - Method in interface net.ME1312.SubServers.Client.Bukkit.Graphic.<a href="net/ME1312/SubServers/Client/Bukkit/Graphic/UIHandler.html" title="interface in net.ME1312.SubServers.Client.Bukkit.Graphic">UIHandler</a></dt>
<dd>
<div class="block">Click Listener</div>
</dd>
<dt><span class="memberNameLink"><a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLSection.html#clone--">clone()</a></span> - Method in class net.ME1312.SubServers.Client.Bukkit.Library.Config.<a href="net/ME1312/SubServers/Client/Bukkit/Library/Config/YAMLSection.html" title="class in net.ME1312.SubServers.Client.Bukkit.Library.Config">YAMLSection</a></dt>
<dd>
<div class="block">Clone this YAML Section</div>

View File

@ -160,9 +160,7 @@ implements <a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphi
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphic/InternalUIHandler.html#click-org.bukkit.event.inventory.InventoryClickEvent-">click</a></span>(org.bukkit.event.inventory.InventoryClickEvent&nbsp;event)</code>
<div class="block">Click Listener</div>
</td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphic/InternalUIHandler.html#click-org.bukkit.event.inventory.InventoryClickEvent-">click</a></span>(org.bukkit.event.inventory.InventoryClickEvent&nbsp;event)</code>&nbsp;</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
@ -279,14 +277,6 @@ implements <a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphi
<li class="blockList">
<h4>click</h4>
<pre>public&nbsp;void&nbsp;click(org.bukkit.event.inventory.InventoryClickEvent&nbsp;event)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphic/UIHandler.html#click-org.bukkit.event.inventory.InventoryClickEvent-">UIHandler</a></code></span></div>
<div class="block">Click Listener</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphic/UIHandler.html#click-org.bukkit.event.inventory.InventoryClickEvent-">click</a></code>&nbsp;in interface&nbsp;<code><a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphic/UIHandler.html" title="interface in net.ME1312.SubServers.Client.Bukkit.Graphic">UIHandler</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>event</code> - Event</dd>
</dl>
</li>
</ul>
<a name="input-org.bukkit.event.player.PlayerChatEvent-">

View File

@ -165,7 +165,7 @@ var activeTableTab = "activeTableTab";
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>player</code> - Player Opening</dd>
<dd><code>object</code> - JSON Representation of an Object</dd>
<dd><code>object</code> - Raw Representation of an Object</dd>
</dl>
</li>
</ul>
@ -193,7 +193,7 @@ var activeTableTab = "activeTableTab";
<div class="block">Check if this Renderer is enabled for this Object</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>object</code> - JSON Representation of an Object</dd>
<dd><code>object</code> - Raw Representation of an Object</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Enabled Status</dd>
</dl>

View File

@ -17,7 +17,7 @@
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6};
var methods = {"i0":6,"i1":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
@ -125,17 +125,11 @@ var activeTableTab = "activeTableTab";
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphic/UIHandler.html#click-org.bukkit.event.inventory.InventoryClickEvent-">click</a></span>(org.bukkit.event.inventory.InventoryClickEvent&nbsp;event)</code>
<div class="block">Click Listener</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphic/UIHandler.html#disable--">disable</a></span>()</code>
<div class="block">Disable Listener</div>
</td>
</tr>
<tr id="i2" class="altColor">
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphic/UIRenderer.html" title="class in net.ME1312.SubServers.Client.Bukkit.Graphic">UIRenderer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../net/ME1312/SubServers/Client/Bukkit/Graphic/UIHandler.html#getRenderer-org.bukkit.entity.Player-">getRenderer</a></span>(org.bukkit.entity.Player&nbsp;player)</code>
<div class="block">Grabs the current Renderer for the player</div>
@ -175,27 +169,13 @@ var activeTableTab = "activeTableTab";
<a name="disable--">
<!-- -->
</a>
<ul class="blockList">
<ul class="blockListLast">
<li class="blockList">
<h4>disable</h4>
<pre>void&nbsp;disable()</pre>
<div class="block">Disable Listener</div>
</li>
</ul>
<a name="click-org.bukkit.event.inventory.InventoryClickEvent-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>click</h4>
<pre>void&nbsp;click(org.bukkit.event.inventory.InventoryClickEvent&nbsp;event)</pre>
<div class="block">Click Listener</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>event</code> - Event</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,4 +2,4 @@ Manifest-Version: 1.0
Class-Path: BungeeCord.jar Waterfall.jar
Main-Class: net.ME1312.SubServers.Bungee.Launch
Implementation-Title: SubServers.Bungee
Specification-Title: 18w29s
Specification-Title: 18w29bf

View File

@ -371,11 +371,11 @@ public class InternalSubCreator extends SubCreator {
if (new UniversalFile(dir, "subservers.client").exists()) {
if (type == ServerType.SPIGOT) {
if (!new UniversalFile(dir, "plugins").exists()) new UniversalFile(dir, "plugins").mkdirs();
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/Client/spigot.jar", new UniversalFile(dir, "plugins:SubServers.Client.jar").getPath());
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/client.jar", new UniversalFile(dir, "plugins:SubServers.Client.jar").getPath());
} else if (type == ServerType.SPONGE) {
// TODO
// if (!new UniversalFile(dir, "mods").exists()) new UniversalFile(dir, "mods").mkdirs();
// Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/Client/sponge.jar", new UniversalFile(dir, "mods:SubServers.Client.jar").getPath());
// Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/client.jar", new UniversalFile(dir, "mods:SubServers.Client.jar").getPath());
}
YAMLSection config = new YAMLSection();
FileWriter writer = new FileWriter(new UniversalFile(dir, "subservers.client"), false);

View File

@ -20,6 +20,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
/**
* Internal SubServer Class
@ -79,16 +80,19 @@ public class InternalSubServer extends SubServerContainer {
if (new UniversalFile(this.directory, "plugins:SubServers.Client.jar").exists()) {
try {
JarFile jar = new JarFile(new UniversalFile(this.directory, "plugins:SubServers.Client.jar"));
YAMLSection plugin = new YAMLSection(Util.readAll(new InputStreamReader(jar.getInputStream(jar.getJarEntry("plugin.yml")))));
YAMLSection bplugin = new YAMLSection(Util.readAll(new InputStreamReader(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/Client/spigot.yml"))));
if (new Version(plugin.getString("version")).compareTo(new Version(bplugin.getString("version"))) < 0) {
new UniversalFile(this.directory, "plugins:SubServers.Client.jar").delete();
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/Client/spigot.jar", new UniversalFile(this.directory, "plugins:SubServers.Client.jar").getPath());
JarInputStream updated = new JarInputStream(SubPlugin.class.getResourceAsStream("/net/ME1312/SubServers/Bungee/Library/Files/client.jar"));
JarFile existing = new JarFile(new UniversalFile(this.directory, "plugins:SubServers.Client.jar"));
if (existing.getManifest().getMainAttributes().getValue("Implementation-Title") != null && existing.getManifest().getMainAttributes().getValue("Implementation-Title").startsWith("SubServers.Client") && existing.getManifest().getMainAttributes().getValue("Specification-Title") != null) {
if (new Version(existing.getManifest().getMainAttributes().getValue("Specification-Title")).compareTo(new Version(updated.getManifest().getMainAttributes().getValue("Specification-Title"))) < 0) {
new UniversalFile(this.directory, "plugins:SubServers.Client.jar").delete();
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/client.jar", new UniversalFile(this.directory, "plugins:SubServers.Client.jar").getPath());
}
}
jar.close();
existing.close();
updated.close();
} catch (Throwable e) {
System.out.println("Couldn't auto-update SubServers.Client.jar");
System.out.println("Couldn't auto-update SubServers.Client.jar for " + name);
e.printStackTrace();
}
}

View File

@ -2,7 +2,10 @@ package net.ME1312.SubServers.Bungee;
import net.ME1312.SubServers.Bungee.Library.Container;
import net.ME1312.SubServers.Bungee.Library.Util;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Library.Version.VersionType;
import java.lang.reflect.Field;
import java.security.Security;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@ -46,11 +49,19 @@ public final class Launch {
parser.accepts("noconsole");
joptsimple.OptionSet options = parser.parse(args);
if(options.has("version") || options.has("v")) {
boolean build = false;
try {
Field f = Version.class.getDeclaredField("type");
f.setAccessible(true);
build = f.get(SubPlugin.version) != VersionType.SNAPSHOT && SubPlugin.class.getPackage().getSpecificationTitle() != null;
f.setAccessible(false);
} catch (Exception e) {}
System.out.println("");
System.out.println(System.getProperty("os.name") + " " + System.getProperty("os.version") + ',');
System.out.println("Java " + System.getProperty("java.version") + ",");
System.out.println("BungeeCord" + ((patched)?" [Patched] ":" ") + net.md_5.bungee.Bootstrap.class.getPackage().getImplementationVersion() + ',');
System.out.println("SubServers.Bungee v" + SubPlugin.version.toExtendedString());
System.out.println("SubServers.Bungee v" + SubPlugin.version.toExtendedString() + ((build)?" [" + SubPlugin.class.getPackage().getSpecificationTitle() + ']':""));
System.out.println("");
} else {
System.out.println("");

View File

@ -8,6 +8,7 @@ import net.ME1312.SubServers.Bungee.Library.Compatibility.CommandX;
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
import net.ME1312.SubServers.Bungee.Library.Util;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Library.Version.VersionType;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent;
@ -26,6 +27,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.lang.reflect.Field;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.*;
@ -66,11 +68,19 @@ public final class SubCommand extends CommandX {
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("?")) {
sender.sendMessages(printHelp());
} else if (args[0].equalsIgnoreCase("version") || args[0].equalsIgnoreCase("ver")) {
boolean build = false;
try {
Field f = Version.class.getDeclaredField("type");
f.setAccessible(true);
build = f.get(plugin.version) != VersionType.SNAPSHOT && SubPlugin.class.getPackage().getSpecificationTitle() != null;
f.setAccessible(false);
} catch (Exception e) {}
sender.sendMessage("SubServers > These are the platforms and versions that are running SubServers.Bungee:");
sender.sendMessage(" " + System.getProperty("os.name") + ' ' + System.getProperty("os.version") + ',');
sender.sendMessage(" Java " + System.getProperty("java.version") + ',');
sender.sendMessage(" " + plugin.getBungeeName() + ((plugin.isPatched)?" [Patched] ":" ") + net.md_5.bungee.Bootstrap.class.getPackage().getImplementationVersion() + ',');
sender.sendMessage(" SubServers.Bungee v" + SubPlugin.version.toExtendedString());
sender.sendMessage(" SubServers.Bungee v" + SubPlugin.version.toExtendedString() + ((build)?" [" + SubPlugin.class.getPackage().getSpecificationTitle() + ']':""));
sender.sendMessage("");
new Thread(() -> {
try {

View File

@ -58,8 +58,8 @@ 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.13a/pr4");
public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"?":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
//public static final Version version = Version.fromString("2.13a/pr5");
public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"undefined":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
public boolean redis = false;
public boolean canSudo = true;

Binary file not shown.

View File

@ -1,3 +1,3 @@
Manifest-Version: 1.0
Implementation-Title: SubServers.Client.Bukkit
Specification-Title: 18w29s
Specification-Title: 18w29bf

View File

@ -13,7 +13,7 @@ public interface Renderer {
* Open the GUI
*
* @param player Player Opening
* @param object JSON Representation of an Object
* @param object Raw Representation of an Object
*/
void open(Player player, YAMLSection object);
@ -27,7 +27,7 @@ public interface Renderer {
/**
* Check if this Renderer is enabled for this Object
*
* @param object JSON Representation of an Object
* @param object Raw Representation of an Object
* @return Enabled Status
*/
boolean isEnabled(YAMLSection object);

View File

@ -20,11 +20,4 @@ public interface UIHandler {
*/
void disable();
/**
* Click Listener
*
* @param event Event
*/
void click(InventoryClickEvent event);
}

View File

@ -4,6 +4,7 @@ import net.ME1312.SubServers.Client.Bukkit.Graphic.UIRenderer;
import net.ME1312.SubServers.Client.Bukkit.Library.Container;
import net.ME1312.SubServers.Client.Bukkit.Library.Util;
import net.ME1312.SubServers.Client.Bukkit.Library.Version.Version;
import net.ME1312.SubServers.Client.Bukkit.Library.Version.VersionType;
import net.ME1312.SubServers.Client.Bukkit.Network.Packet.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -20,6 +21,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.nio.charset.Charset;
@ -48,11 +50,19 @@ public final class SubCommand implements CommandExecutor {
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("?")) {
sender.sendMessage(printHelp(label));
} else if (args[0].equalsIgnoreCase("version") || args[0].equalsIgnoreCase("ver")) {
boolean build = false;
try {
Field f = Version.class.getDeclaredField("type");
f.setAccessible(true);
build = f.get(plugin.version) != VersionType.SNAPSHOT && SubPlugin.class.getPackage().getSpecificationTitle() != null;
f.setAccessible(false);
} catch (Exception e) {}
sender.sendMessage(plugin.api.getLang("SubServers", "Command.Version").replace("$str$", "SubServers.Client.Bukkit"));
sender.sendMessage(ChatColor.WHITE + " " + System.getProperty("os.name") + ' ' + System.getProperty("os.version") + ChatColor.RESET + ',');
sender.sendMessage(ChatColor.WHITE + " Java " + System.getProperty("java.version") + ChatColor.RESET + ',');
sender.sendMessage(ChatColor.WHITE + " " + Bukkit.getName() + ' ' + Bukkit.getVersion() + ChatColor.RESET + ',');
sender.sendMessage(ChatColor.WHITE + " SubServers.Client.Bukkit v" + plugin.version.toExtendedString());
sender.sendMessage(ChatColor.WHITE + " SubServers.Client.Bukkit v" + plugin.version.toExtendedString() + ((build)?" [" + SubPlugin.class.getPackage().getSpecificationTitle() + ']':""));
sender.sendMessage("");
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
try {

View File

@ -47,7 +47,7 @@ public final class SubPlugin extends JavaPlugin {
public SubPlugin() {
super();
//version = Version.fromString(getDescription().getVersion());
version = new Version(Version.fromString(getDescription().getVersion()), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"?":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
version = new Version(Version.fromString(getDescription().getVersion()), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"undefined":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
}
/**

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Implementation-Title: SubServers.Client
Specification-Title: 18w29bf

Binary file not shown.

View File

@ -1,4 +1,4 @@
Manifest-Version: 1.0
Main-Class: net.ME1312.SubServers.Host.ExHost
Implementation-Title: SubServers.Host
Specification-Title: 18w29s
Specification-Title: 18w29bf

View File

@ -25,6 +25,7 @@ import org.xml.sax.InputSource;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
import java.net.URL;
@ -54,8 +55,8 @@ public final class ExHost {
public SubDataClient subdata = null;
public final SubAPI api = new SubAPI(this);
//public static final Version version = Version.fromString("2.13a/pr4");
public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (ExHost.class.getPackage().getSpecificationTitle() == null)?"?":ExHost.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
//public static final Version version = Version.fromString("2.13a/pr5");
public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (ExHost.class.getPackage().getSpecificationTitle() == null)?"undefined":ExHost.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
private ConsoleReader jline;
private boolean running = false;
@ -76,10 +77,18 @@ public final class ExHost {
parser.accepts("noconsole");
joptsimple.OptionSet options = parser.parse(args);
if(options.has("version") || options.has("v")) {
boolean build = false;
try {
Field f = Version.class.getDeclaredField("type");
f.setAccessible(true);
build = f.get(version) != VersionType.SNAPSHOT && ExHost.class.getPackage().getSpecificationTitle() != null;
f.setAccessible(false);
} catch (Exception e) {}
System.out.println("");
System.out.println(System.getProperty("os.name") + " " + System.getProperty("os.version") + ',');
System.out.println("Java " + System.getProperty("java.version") + ",");
System.out.println("SubServers.Host v" + version.toExtendedString());
System.out.println("SubServers.Host v" + version.toExtendedString() + ((build)?" [" + ExHost.class.getPackage().getSpecificationTitle() + ']':""));
System.out.println("");
} else {
new ExHost(options);

View File

@ -393,11 +393,11 @@ public class SubCreator {
if (new UniversalFile(dir, "subservers.client").exists()) {
if (type == ServerType.SPIGOT) {
if (!new UniversalFile(dir, "plugins").exists()) new UniversalFile(dir, "plugins").mkdirs();
Util.copyFromJar(ExHost.class.getClassLoader(), "net/ME1312/SubServers/Host/Library/Files/Client/spigot.jar", new UniversalFile(dir, "plugins:SubServers.Client.jar").getPath());
Util.copyFromJar(ExHost.class.getClassLoader(), "net/ME1312/SubServers/Host/Library/Files/client.jar", new UniversalFile(dir, "plugins:SubServers.Client.jar").getPath());
} else if (type == ServerType.SPONGE) {
// TODO
// if (!new UniversalFile(dir, "mods").exists()) new UniversalFile(dir, "mods").mkdirs();
// Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Host/Library/Files/Client/sponge.jar", new UniversalFile(dir, "mods:SubServers.Client.jar").getPath());
// Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Host/Library/Files/client.jar", new UniversalFile(dir, "mods:SubServers.Client.jar").getPath());
}
JSONObject config = new JSONObject();
FileWriter writer = new FileWriter(new UniversalFile(dir, "subservers.client"), false);

View File

@ -13,6 +13,8 @@ import java.io.*;
import java.util.LinkedList;
import java.util.UUID;
import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
/**
* Internal SubServer Class
@ -63,16 +65,19 @@ public class SubServer {
if (new UniversalFile(this.directory, "plugins:SubServers.Client.jar").exists()) {
try {
JarFile jar = new JarFile(new UniversalFile(this.directory, "plugins:SubServers.Client.jar"));
YAMLSection plugin = new YAMLSection(Util.readAll(new InputStreamReader(jar.getInputStream(jar.getJarEntry("plugin.yml")))));
YAMLSection bplugin = new YAMLSection(Util.readAll(new InputStreamReader(ExHost.class.getResourceAsStream("/net/ME1312/SubServers/Host/Library/Files/Client/spigot.yml"))));
if (new Version(plugin.getString("version")).compareTo(new Version(bplugin.getString("version"))) < 0) {
new UniversalFile(this.directory, "plugins:SubServers.Client.jar").delete();
Util.copyFromJar(ExHost.class.getClassLoader(), "net/ME1312/SubServers/Host/Library/Files/Client/spigot.jar", new UniversalFile(this.directory, "plugins:SubServers.Client.jar").getPath());
JarInputStream updated = new JarInputStream(ExHost.class.getResourceAsStream("/net/ME1312/SubServers/Host/Library/Files/client.jar"));
JarFile existing = new JarFile(new UniversalFile(this.directory, "plugins:SubServers.Client.jar"));
if (existing.getManifest().getMainAttributes().getValue("Implementation-Title") != null && existing.getManifest().getMainAttributes().getValue("Implementation-Title").startsWith("SubServers.Client") && existing.getManifest().getMainAttributes().getValue("Specification-Title") != null) {
if (new Version(existing.getManifest().getMainAttributes().getValue("Specification-Title")).compareTo(new Version(updated.getManifest().getMainAttributes().getValue("Specification-Title"))) < 0) {
new UniversalFile(this.directory, "plugins:SubServers.Client.jar").delete();
Util.copyFromJar(ExHost.class.getClassLoader(), "net/ME1312/SubServers/Host/Library/Files/client.jar", new UniversalFile(this.directory, "plugins:SubServers.Client.jar").getPath());
}
}
jar.close();
existing.close();
updated.close();
} catch (Throwable e) {
host.log.info.println("Couldn't auto-update SubServers.Client.jar");
host.log.info.println("Couldn't auto-update SubServers.Client.jar for " + name);
host.log.error.println(e);
}
}

View File

@ -5,6 +5,7 @@ import net.ME1312.SubServers.Host.API.SubPluginInfo;
import net.ME1312.SubServers.Host.Library.TextColor;
import net.ME1312.SubServers.Host.Library.Util;
import net.ME1312.SubServers.Host.Library.Version.Version;
import net.ME1312.SubServers.Host.Library.Version.VersionType;
import net.ME1312.SubServers.Host.Network.Packet.*;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@ -15,6 +16,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.lang.reflect.Field;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.*;
@ -29,11 +31,19 @@ public class SubCommand {
@Override
public void command(String handle, String[] args) {
if (args.length == 0 || host.api.plugins.get(args[0].toLowerCase()) != null) {
boolean build = false;
try {
Field f = Version.class.getDeclaredField("type");
f.setAccessible(true);
build = f.get(host.version) != VersionType.SNAPSHOT && ExHost.class.getPackage().getSpecificationTitle() != null;
f.setAccessible(false);
} catch (Exception e) {}
host.log.message.println(
"These are the platforms and versions that are running " + ((args.length == 0)?"SubServers.Host":host.api.plugins.get(args[0].toLowerCase()).getName()) +":",
" " + System.getProperty("os.name") + ' ' + System.getProperty("os.version") + ',',
" Java " + System.getProperty("java.version") + ',',
" SubServers.Host v" + host.version.toExtendedString() + ((args.length == 0)?"":","));
" SubServers.Host v" + host.version.toExtendedString() + ((build)?" [" + ExHost.class.getPackage().getSpecificationTitle() + ']':"") + ((args.length == 0)?"":","));
if (args.length == 0) {
host.log.message.println("");
new Thread(() -> {

Binary file not shown.

View File

@ -2,4 +2,4 @@ Manifest-Version: 1.0
Class-Path: BungeeCord.jar Waterfall.jar
Main-Class: net.ME1312.SubServers.Sync.Launch
Implementation-Title: SubServers.Sync
Specification-Title: 18w29s
Specification-Title: 18w29bf

View File

@ -2,7 +2,10 @@ package net.ME1312.SubServers.Sync;
import net.ME1312.SubServers.Sync.Library.Container;
import net.ME1312.SubServers.Sync.Library.Util;
import net.ME1312.SubServers.Sync.Library.Version.Version;
import net.ME1312.SubServers.Sync.Library.Version.VersionType;
import java.lang.reflect.Field;
import java.security.Security;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@ -46,11 +49,19 @@ public final class Launch {
parser.accepts("noconsole");
joptsimple.OptionSet options = parser.parse(args);
if(options.has("version") || options.has("v")) {
boolean build = false;
try {
Field f = Version.class.getDeclaredField("type");
f.setAccessible(true);
build = f.get(SubPlugin.version) != VersionType.SNAPSHOT && SubPlugin.class.getPackage().getSpecificationTitle() != null;
f.setAccessible(false);
} catch (Exception e) {}
System.out.println("");
System.out.println(System.getProperty("os.name") + " " + System.getProperty("os.version") + ',');
System.out.println("Java " + System.getProperty("java.version") + ",");
System.out.println("BungeeCord" + ((patched)?" [Patched] ":" ") + net.md_5.bungee.Bootstrap.class.getPackage().getImplementationVersion() + ',');
System.out.println("SubServers.Sync v" + SubPlugin.version.toExtendedString());
System.out.println("SubServers.Sync v" + SubPlugin.version.toExtendedString() + ((build)?" [" + SubPlugin.class.getPackage().getSpecificationTitle() + ']':""));
System.out.println("");
} else {
System.out.println("");

View File

@ -4,6 +4,7 @@ import net.ME1312.SubServers.Sync.Library.Compatibility.CommandX;
import net.ME1312.SubServers.Sync.Library.NamedContainer;
import net.ME1312.SubServers.Sync.Library.Util;
import net.ME1312.SubServers.Sync.Library.Version.Version;
import net.ME1312.SubServers.Sync.Library.Version.VersionType;
import net.ME1312.SubServers.Sync.Network.Packet.*;
import net.ME1312.SubServers.Sync.Server.Server;
import net.ME1312.SubServers.Sync.Server.SubServer;
@ -26,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.nio.charset.Charset;
@ -66,11 +68,19 @@ public final class SubCommand extends CommandX {
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("?")) {
sender.sendMessages(printHelp());
} else if (args[0].equalsIgnoreCase("version") || args[0].equalsIgnoreCase("ver")) {
boolean build = false;
try {
Field f = Version.class.getDeclaredField("type");
f.setAccessible(true);
build = f.get(plugin.version) != VersionType.SNAPSHOT && SubPlugin.class.getPackage().getSpecificationTitle() != null;
f.setAccessible(false);
} catch (Exception e) {}
sender.sendMessage("SubServers > These are the platforms and versions that are running SubServers.Sync:");
sender.sendMessage(" " + System.getProperty("os.name") + ' ' + System.getProperty("os.version") + ',');
sender.sendMessage(" Java " + System.getProperty("java.version") + ',');
sender.sendMessage(" " + plugin.getBungeeName() + ((plugin.isPatched)?" [Patched] ":" ") + net.md_5.bungee.Bootstrap.class.getPackage().getImplementationVersion() + ',');
sender.sendMessage(" SubServers.Sync v" + SubPlugin.version.toExtendedString());
sender.sendMessage(" SubServers.Sync v" + SubPlugin.version.toExtendedString() + ((build)?" [" + SubPlugin.class.getPackage().getSpecificationTitle() + ']':""));
sender.sendMessage("");
new Thread(() -> {
try {

View File

@ -48,8 +48,8 @@ public final class SubPlugin extends BungeeCord implements Listener {
public boolean redis = false;
public final SubAPI api = new SubAPI(this);
public SubDataClient subdata = null;
//public static final Version version = Version.fromString("2.13a/pr4");
public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"?":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
//public static final Version version = Version.fromString("2.13a/pr5");
public static final Version version = new Version(Version.fromString("2.13a/pr5"), VersionType.SNAPSHOT, (SubPlugin.class.getPackage().getSpecificationTitle() == null)?"undefined":SubPlugin.class.getPackage().getSpecificationTitle()); // TODO Snapshot Version
public final boolean isPatched;
public long lastReload = -1;