Sets the Handler
+
Sets the Handler
Warning: This method should only be called by ClientHandler methods
setHidden(boolean) - Method in class net.ME1312.SubServers.Bungee.Host.Server
diff --git a/Javadoc/SubServers.Bungee/net/ME1312/SubServers/Bungee/Network/Client.html b/Javadoc/SubServers.Bungee/net/ME1312/SubServers/Bungee/Network/Client.html
index ce850950..db9e15db 100644
--- a/Javadoc/SubServers.Bungee/net/ME1312/SubServers/Bungee/Network/Client.html
+++ b/Javadoc/SubServers.Bungee/net/ME1312/SubServers/Bungee/Network/Client.html
@@ -191,7 +191,7 @@ extends java.lang.Object
void |
setHandler(ClientHandler obj)
-Sets the Handler
+ Sets the Handler
Warning: This method should only be called by ClientHandler methods
|
@@ -331,7 +331,7 @@ extends java.lang.Object
setHandler
public void setHandler(ClientHandler obj)
-Sets the Handler
+
Sets the Handler
Warning: This method should only be called by ClientHandler methods
- Parameters:
diff --git a/Javadoc/SubServers.Bungee/net/ME1312/SubServers/Bungee/Network/SubDataServer.html b/Javadoc/SubServers.Bungee/net/ME1312/SubServers/Bungee/Network/SubDataServer.html
index 4b61264b..425d5c17 100644
--- a/Javadoc/SubServers.Bungee/net/ME1312/SubServers/Bungee/Network/SubDataServer.html
+++ b/Javadoc/SubServers.Bungee/net/ME1312/SubServers/Bungee/Network/SubDataServer.html
@@ -169,7 +169,7 @@ extends java.lang.Object
void |
broadcastPacket(PacketOut packet)
-Broadcast a Packet to everything on the Network
+ Broadcast a Packet to everything on the Network
Warning: There are usually different types of applications on the network at once, they may not recognise the same packet handles
|
@@ -198,9 +198,9 @@ extends java.lang.Object
-static PacketIn |
+static java.util.List<? extends PacketIn> |
getPacket(java.lang.String handle)
-Grab PacketIn Instance via handle
+Grab PacketIn Instances via handle
|
@@ -423,8 +423,8 @@ extends java.lang.Object
-
getPacket
-public static PacketIn getPacket(java.lang.String handle)
-Grab PacketIn Instance via handle
+public static java.util.List<? extends PacketIn> getPacket(java.lang.String handle)
+Grab PacketIn Instances via handle
- Parameters:
handle
- Handle
@@ -440,7 +440,7 @@ extends java.lang.Object
-
broadcastPacket
public void broadcastPacket(PacketOut packet)
-Broadcast a Packet to everything on the Network
+
Broadcast a Packet to everything on the Network
Warning: There are usually different types of applications on the network at once, they may not recognise the same packet handles
- Parameters:
diff --git a/Javadoc/SubServers.Bungee/stylesheet.css b/Javadoc/SubServers.Bungee/stylesheet.css
index cebb4fd8..98055b22 100644
--- a/Javadoc/SubServers.Bungee/stylesheet.css
+++ b/Javadoc/SubServers.Bungee/stylesheet.css
@@ -463,7 +463,6 @@ Table styles
.useSummary td, .constantsSummary td, .deprecatedSummary td {
text-align:left;
padding:0px 0px 12px 10px;
- width:100%;
}
th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
@@ -488,6 +487,7 @@ td.colOne, th.colOne {
font-size:13px;
}
.overviewSummary td.colFirst, .overviewSummary th.colFirst,
+.useSummary td.colFirst, .useSummary th.colFirst,
.overviewSummary td.colOne, .overviewSummary th.colOne,
.memberSummary td.colFirst, .memberSummary th.colFirst,
.memberSummary td.colOne, .memberSummary th.colOne,
diff --git a/Javadoc/SubServers.Client.Bukkit/index-all.html b/Javadoc/SubServers.Client.Bukkit/index-all.html
index 71bba826..fb87306b 100644
--- a/Javadoc/SubServers.Client.Bukkit/index-all.html
+++ b/Javadoc/SubServers.Client.Bukkit/index-all.html
@@ -434,7 +434,7 @@
-
- getPacket(String) - Static method in class net.ME1312.SubServers.Client.Bukkit.Network.SubDataClient
-
-
Grab PacketIn Instance via handle
+Grab PacketIn Instances via handle
- getPlayer() - Method in class net.ME1312.SubServers.Client.Bukkit.Event.SubAddServerEvent
-
diff --git a/Javadoc/SubServers.Client.Bukkit/net/ME1312/SubServers/Client/Bukkit/Network/SubDataClient.html b/Javadoc/SubServers.Client.Bukkit/net/ME1312/SubServers/Client/Bukkit/Network/SubDataClient.html
index 8ddf92d8..bd277f32 100644
--- a/Javadoc/SubServers.Client.Bukkit/net/ME1312/SubServers/Client/Bukkit/Network/SubDataClient.html
+++ b/Javadoc/SubServers.Client.Bukkit/net/ME1312/SubServers/Client/Bukkit/Network/SubDataClient.html
@@ -168,9 +168,9 @@ extends java.lang.Object
-static PacketIn |
+static java.util.List<? extends PacketIn> |
getPacket(java.lang.String handle)
-Grab PacketIn Instance via handle
+Grab PacketIn Instances via handle
|
@@ -311,8 +311,8 @@ extends java.lang.Object
-
getPacket
-public static PacketIn getPacket(java.lang.String handle)
-Grab PacketIn Instance via handle
+public static java.util.List<? extends PacketIn> getPacket(java.lang.String handle)
+Grab PacketIn Instances via handle
- Parameters:
handle
- Handle
diff --git a/Javadoc/SubServers.Client.Bukkit/stylesheet.css b/Javadoc/SubServers.Client.Bukkit/stylesheet.css
index cebb4fd8..98055b22 100644
--- a/Javadoc/SubServers.Client.Bukkit/stylesheet.css
+++ b/Javadoc/SubServers.Client.Bukkit/stylesheet.css
@@ -463,7 +463,6 @@ Table styles
.useSummary td, .constantsSummary td, .deprecatedSummary td {
text-align:left;
padding:0px 0px 12px 10px;
- width:100%;
}
th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
@@ -488,6 +487,7 @@ td.colOne, th.colOne {
font-size:13px;
}
.overviewSummary td.colFirst, .overviewSummary th.colFirst,
+.useSummary td.colFirst, .useSummary th.colFirst,
.overviewSummary td.colOne, .overviewSummary th.colOne,
.memberSummary td.colFirst, .memberSummary th.colFirst,
.memberSummary td.colOne, .memberSummary th.colOne,
diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalHost.java b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalHost.java
index df27bfda..06812ee9 100644
--- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalHost.java
+++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalHost.java
@@ -17,14 +17,13 @@ import java.util.TreeMap;
import java.util.UUID;
public class InternalHost extends Host {
- HashMap servers = new HashMap();
-
+ private HashMap servers = new HashMap();
private String name;
private boolean enabled;
private InetAddress address;
private InternalSubCreator creator;
private String directory;
- SubPlugin plugin;
+ protected SubPlugin plugin;
public InternalHost(SubPlugin plugin, String name, Boolean enabled, InetAddress address, String directory, String gitBash) {
super(plugin, name, enabled, address, directory, gitBash);
diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubServer.java b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubServer.java
index e89e5f8c..787e06c0 100644
--- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubServer.java
+++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Host/Internal/InternalSubServer.java
@@ -48,53 +48,52 @@ public class InternalSubServer extends SubServer {
}
private void run() {
- (thread = new Thread(() -> {
- allowrestart = true;
+
+ allowrestart = true;
+ try {
+ process = Runtime.getRuntime().exec(executable.toString(), null, directory);
+ System.out.println("SubServers > Now starting " + getName());
+ final InternalSubLogger read = new InternalSubLogger(process, getName(), log, null);
+ read.start();
+ command = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
+
+ process.waitFor();
+ } catch (IOException | InterruptedException e) {
+ e.printStackTrace();
+ allowrestart = false;
+ }
+
+ SubStoppedEvent event = new SubStoppedEvent(this);
+ host.plugin.getPluginManager().callEvent(event);
+ System.out.println("SubServers > " + getName() + " has stopped");
+ process = null;
+ command = null;
+
+ if (isTemporary()) {
try {
- process = Runtime.getRuntime().exec(executable.toString(), null, directory);
- System.out.println("SubServers > Now starting " + getName());
- final InternalSubLogger read = new InternalSubLogger(process, getName(), log, null);
- read.start();
- command = new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
-
- process.waitFor();
- } catch (IOException | InterruptedException e) {
+ host.removeSubServer(getName());
+ } catch (InterruptedException e) {
e.printStackTrace();
- allowrestart = false;
}
-
- SubStoppedEvent event = new SubStoppedEvent(this);
- host.plugin.getPluginManager().callEvent(event);
- System.out.println("SubServers > " + getName() + " has stopped");
- process = null;
- command = null;
-
- if (temporary) {
+ } else {
+ if (willAutoRestart() && allowrestart) {
try {
- host.removeSubServer(getName());
+ Thread.sleep(2500);
+ start();
} catch (InterruptedException e) {
e.printStackTrace();
}
- } else {
- if (restart && allowrestart) {
- try {
- Thread.sleep(2500);
- start();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
}
- })).start();
+ }
}
@Override
public boolean start(UUID player) {
- if (enabled && !isRunning()) {
+ if (isEnabled() && !isRunning()) {
SubStartEvent event = new SubStartEvent(player, this);
host.plugin.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- run();
+ (thread = new Thread(() -> run())).start();
return true;
} else return false;
} else return false;
diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Network/Client.java b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Network/Client.java
index a8afe6e3..68c25745 100644
--- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Network/Client.java
+++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Network/Client.java
@@ -68,12 +68,13 @@ public final class Client {
while ((input = in.readLine()) != null) {
try {
JSONObject json = new JSONObject(input);
- PacketIn packet = SubDataServer.decodePacket(json);
- if (authorized == null || packet instanceof PacketAuthorization) {
- try {
- packet.execute(instance, (json.keySet().contains("c")) ? json.getJSONObject("c") : null);
- } catch (Exception e) {
- new InvocationTargetException(e, "Exception while executing PacketIn").printStackTrace();
+ for (PacketIn packet : SubDataServer.decodePacket(json)) {
+ if (authorized == null || packet instanceof PacketAuthorization) {
+ try {
+ packet.execute(instance, (json.keySet().contains("c")) ? json.getJSONObject("c") : null);
+ } catch (Exception e) {
+ new InvocationTargetException(e, "Exception while executing PacketIn").printStackTrace();
+ }
}
}
} catch (IllegalPacketException e) {
@@ -159,7 +160,7 @@ public final class Client {
}
/**
- * Sets the Handler
+ * Sets the Handler
* Warning: This method should only be called by ClientHandler methods
*
* @see ClientHandler
diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Network/SubDataServer.java b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Network/SubDataServer.java
index 6748ce6b..51beae53 100644
--- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Network/SubDataServer.java
+++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/Network/SubDataServer.java
@@ -20,7 +20,7 @@ import java.util.List;
*/
public final class SubDataServer {
private static HashMap, String> pOut = new HashMap, String>();
- private static HashMap pIn = new HashMap();
+ private static HashMap> pIn = new HashMap>();
private static List allowedAddresses = new ArrayList();
private static boolean defaults = false;
private HashMap clients = new HashMap();
@@ -174,11 +174,9 @@ public final class SubDataServer {
* @param handle Handle to Bind
*/
public static void registerPacket(PacketIn packet, String handle) {
- if (!pIn.keySet().contains(handle)) {
- pIn.put(handle, packet);
- } else {
- throw new IllegalStateException("PacketIn Handle \"" + handle + "\" is already in use!");
- }
+ List list = (pIn.keySet().contains(handle))?pIn.get(handle):new ArrayList();
+ if (!list.contains(packet)) list.add(packet);
+ pIn.put(handle, list);
}
/**
@@ -188,25 +186,21 @@ public final class SubDataServer {
* @param handle Handle to bind
*/
public static void registerPacket(Class extends PacketOut> packet, String handle) {
- if (!pOut.values().contains(handle)) {
- pOut.put(packet, handle);
- } else {
- throw new IllegalStateException("PacketOut Handle \"" + handle + "\" is already in use!");
- }
+ pOut.put(packet, handle);
}
/**
- * Grab PacketIn Instance via handle
+ * Grab PacketIn Instances via handle
*
* @param handle Handle
* @return PacketIn
*/
- public static PacketIn getPacket(String handle) {
+ public static List extends PacketIn> getPacket(String handle) {
return pIn.get(handle);
}
/**
- * Broadcast a Packet to everything on the Network
+ * Broadcast a Packet to everything on the Network
* Warning: There are usually different types of applications on the network at once, they may not recognise the same packet handles
*
* @param packet Packet to send
@@ -263,13 +257,20 @@ public final class SubDataServer {
* @throws IllegalPacketException
* @throws InvocationTargetException
*/
- protected static PacketIn decodePacket(JSONObject json) throws IllegalPacketException, InvocationTargetException {
+ protected static List decodePacket(JSONObject json) throws IllegalPacketException, InvocationTargetException {
if (!json.keySet().contains("h") || !json.keySet().contains("v")) throw new IllegalPacketException("Unknown Packet Format: " + json.toString());
if (!pIn.keySet().contains(json.getString("h"))) throw new IllegalPacketException("Unknown PacketIn Channel: " + json.getString("h"));
- PacketIn packet = pIn.get(json.getString("h"));
- if (!new Version(json.getString("v")).equals(packet.getVersion())) throw new IllegalPacketException("Packet Version Mismatch in " + json.getString("h") + ": " + json.getString("v") + "->" + packet.getVersion().toString());
- return packet;
+ List list = new ArrayList();
+ for (PacketIn packet : pIn.get(json.getString("h"))) {
+ if (new Version(json.getString("v")).equals(packet.getVersion())) {
+ list.add(packet);
+ } else {
+ new IllegalPacketException("Packet Version Mismatch in " + json.getString("h") + ": " + json.getString("v") + " -> " + packet.getVersion().toString()).printStackTrace();
+ }
+ }
+
+ return list;
}
/**
diff --git a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/SubPlugin.java b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/SubPlugin.java
index 6e646c6f..365d7835 100644
--- a/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/SubPlugin.java
+++ b/SubServers.Bungee/src/net/ME1312/SubServers/Bungee/SubPlugin.java
@@ -38,8 +38,8 @@ public final class SubPlugin extends BungeeCord {
public YAMLConfig lang;
public HashMap exLang = new HashMap();
public SubDataServer subdata = null;
- public final Version version = new Version("2.11.2d");
- protected Version bversion = null;
+ public final Version version = new Version("2.11.2e");
+ protected Version bversion = new Version(1);
protected boolean running = false;
public final SubAPI api = new SubAPI(this);
diff --git a/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/Network/SubDataClient.java b/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/Network/SubDataClient.java
index 21df8a3b..29a23bb9 100644
--- a/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/Network/SubDataClient.java
+++ b/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/Network/SubDataClient.java
@@ -16,11 +16,13 @@ import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketException;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
public final class SubDataClient {
private static HashMap, String> pOut = new HashMap, String>();
- private static HashMap pIn = new HashMap();
+ private static HashMap> pIn = new HashMap>();
private static boolean defaults = false;
private PrintWriter writer;
private Socket socket;
@@ -89,11 +91,12 @@ public final class SubDataClient {
while ((input = in.readLine()) != null) {
try {
JSONObject json = new JSONObject(input);
- PacketIn packet = decodePacket(json);
- try {
- packet.execute((json.keySet().contains("c")) ? json.getJSONObject("c") : null);
- } catch (Exception e) {
- new InvocationTargetException(e, "Exception while executing PacketIn").printStackTrace();
+ for (PacketIn packet : decodePacket(json)) {
+ try {
+ packet.execute((json.keySet().contains("c")) ? json.getJSONObject("c") : null);
+ } catch (Exception e) {
+ new InvocationTargetException(e, "Exception while executing PacketIn").printStackTrace();
+ }
}
} catch (IllegalPacketException e) {
e.printStackTrace();
@@ -142,7 +145,9 @@ public final class SubDataClient {
* @param handle Handle to Bind
*/
public static void registerPacket(PacketIn packet, String handle) {
- pIn.put(handle, packet);
+ List list = (pIn.keySet().contains(handle))?pIn.get(handle):new ArrayList();
+ if (!list.contains(packet)) list.add(packet);
+ pIn.put(handle, list);
}
/**
@@ -156,12 +161,12 @@ public final class SubDataClient {
}
/**
- * Grab PacketIn Instance via handle
+ * Grab PacketIn Instances via handle
*
* @param handle Handle
* @return PacketIn
*/
- public static PacketIn getPacket(String handle) {
+ public static List extends PacketIn> getPacket(String handle) {
return pIn.get(handle);
}
@@ -185,7 +190,7 @@ public final class SubDataClient {
* @return JSON Formatted Packet
* @throws IllegalPacketException
*/
- protected static JSONObject encodePacket(PacketOut packet) throws IllegalPacketException {
+ private static JSONObject encodePacket(PacketOut packet) throws IllegalPacketException {
JSONObject json = new JSONObject();
if (!pOut.keySet().contains(packet.getClass())) throw new IllegalPacketException("Unknown PacketOut Channel: " + packet.getClass().getCanonicalName());
@@ -206,13 +211,20 @@ public final class SubDataClient {
* @throws IllegalPacketException
* @throws InvocationTargetException
*/
- protected static PacketIn decodePacket(JSONObject json) throws IllegalPacketException, InvocationTargetException {
+ private static List decodePacket(JSONObject json) throws IllegalPacketException, InvocationTargetException {
if (!json.keySet().contains("h") || !json.keySet().contains("v")) throw new IllegalPacketException("Unknown Packet Format: " + json.toString());
if (!pIn.keySet().contains(json.getString("h"))) throw new IllegalPacketException("Unknown PacketIn Channel: " + json.getString("h"));
- PacketIn packet = pIn.get(json.getString("h"));
- if (!new Version(json.getString("v")).equals(packet.getVersion())) throw new IllegalPacketException("Packet Version Mismatch in " + json.getString("h") + ": " + json.getString("v") + "->" + packet.getVersion().toString());
- return packet;
+ List list = new ArrayList();
+ for (PacketIn packet : pIn.get(json.getString("h"))) {
+ if (new Version(json.getString("v")).equals(packet.getVersion())) {
+ list.add(packet);
+ } else {
+ new IllegalPacketException("Packet Version Mismatch in " + json.getString("h") + ": " + json.getString("v") + " -> " + packet.getVersion().toString()).printStackTrace();
+ }
+ }
+
+ return list;
}
/**
diff --git a/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/SubPlugin.java b/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/SubPlugin.java
index 4d7bf9a0..0741c160 100644
--- a/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/SubPlugin.java
+++ b/SubServers.Client/Bukkit/src/net/ME1312/SubServers/Client/Bukkit/SubPlugin.java
@@ -22,7 +22,7 @@ public final class SubPlugin extends JavaPlugin {
public UIListener gui = null;
public Version version;
- protected Version bversion = null;
+ protected Version bversion = new Version(1);
//public final SubAPI api = new SubAPI(this);