SubServers 2 Beta 4

This commit is contained in:
ME1312 2016-12-23 23:55:17 -05:00
parent 84927aecdf
commit b50452b93a
79 changed files with 1166 additions and 380 deletions

Binary file not shown.

View File

@ -1,4 +1,4 @@
Manifest-Version: 1.0
Class-Path: BungeeCord.jar
Main-Class: net.ME1312.SubServers.Proxy.Launch
Main-Class: net.ME1312.SubServers.Bungee.Launch

View File

@ -1,8 +1,8 @@
package net.ME1312.SubServers.Proxy.Event;
package net.ME1312.SubServers.Bungee.Event;
import net.ME1312.SubServers.Proxy.Host.Host;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Library.SubEvent;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Library.SubEvent;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;

View File

@ -1,9 +1,9 @@
package net.ME1312.SubServers.Proxy.Event;
package net.ME1312.SubServers.Bungee.Event;
import net.ME1312.SubServers.Proxy.Host.Host;
import net.ME1312.SubServers.Proxy.Host.SubCreator;
import net.ME1312.SubServers.Proxy.Library.SubEvent;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.SubCreator;
import net.ME1312.SubServers.Bungee.Library.SubEvent;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;

View File

@ -1,7 +1,7 @@
package net.ME1312.SubServers.Proxy.Event;
package net.ME1312.SubServers.Bungee.Event;
import net.ME1312.SubServers.Proxy.Library.SubEvent;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Library.SubEvent;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.md_5.bungee.api.plugin.Event;
import org.json.JSONObject;

View File

@ -1,9 +1,9 @@
package net.ME1312.SubServers.Proxy.Event;
package net.ME1312.SubServers.Bungee.Event;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.NamedContainer;
import net.ME1312.SubServers.Proxy.Library.SubEvent;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
import net.ME1312.SubServers.Bungee.Library.SubEvent;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;

View File

@ -1,8 +1,8 @@
package net.ME1312.SubServers.Proxy.Event;
package net.ME1312.SubServers.Bungee.Event;
import net.ME1312.SubServers.Proxy.Host.Host;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Library.SubEvent;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Library.SubEvent;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;

View File

@ -1,7 +1,7 @@
package net.ME1312.SubServers.Proxy.Event;
package net.ME1312.SubServers.Bungee.Event;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.SubEvent;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.SubEvent;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;

View File

@ -1,7 +1,7 @@
package net.ME1312.SubServers.Proxy.Event;
package net.ME1312.SubServers.Bungee.Event;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.SubEvent;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.SubEvent;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;

View File

@ -1,7 +1,7 @@
package net.ME1312.SubServers.Proxy.Event;
package net.ME1312.SubServers.Bungee.Event;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.SubEvent;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.SubEvent;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;

View File

@ -1,7 +1,7 @@
package net.ME1312.SubServers.Proxy.Event;
package net.ME1312.SubServers.Bungee.Event;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.SubEvent;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.SubEvent;
import net.md_5.bungee.api.plugin.Event;
public class SubStoppedEvent extends Event implements SubEvent {

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Host;
package net.ME1312.SubServers.Bungee.Host;
import java.io.File;
import java.io.Serializable;

View File

@ -1,9 +1,9 @@
package net.ME1312.SubServers.Proxy.Host;
package net.ME1312.SubServers.Bungee.Host;
import net.ME1312.SubServers.Proxy.Library.Exception.InvalidHostException;
import net.ME1312.SubServers.Proxy.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Proxy.Library.NamedContainer;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidHostException;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
import net.ME1312.SubServers.Bungee.SubPlugin;
import java.net.InetAddress;
import java.util.Map;

View File

@ -1,14 +1,14 @@
package net.ME1312.SubServers.Proxy.Host.Internal;
package net.ME1312.SubServers.Bungee.Host.Internal;
import net.ME1312.SubServers.Proxy.Event.SubAddServerEvent;
import net.ME1312.SubServers.Proxy.Event.SubRemoveServerEvent;
import net.ME1312.SubServers.Proxy.Host.Executable;
import net.ME1312.SubServers.Proxy.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Proxy.Host.Host;
import net.ME1312.SubServers.Proxy.Host.SubCreator;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.NamedContainer;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Event.SubAddServerEvent;
import net.ME1312.SubServers.Bungee.Event.SubRemoveServerEvent;
import net.ME1312.SubServers.Bungee.Host.Executable;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.SubCreator;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
import net.ME1312.SubServers.Bungee.SubPlugin;
import java.net.InetAddress;
import java.util.HashMap;

View File

@ -1,14 +1,14 @@
package net.ME1312.SubServers.Proxy.Host.Internal;
package net.ME1312.SubServers.Bungee.Host.Internal;
import net.ME1312.SubServers.Proxy.Event.SubCreateEvent;
import net.ME1312.SubServers.Proxy.Host.Executable;
import net.ME1312.SubServers.Proxy.Host.Host;
import net.ME1312.SubServers.Proxy.Host.SubCreator;
import net.ME1312.SubServers.Proxy.Library.Config.YAMLSection;
import net.ME1312.SubServers.Proxy.Library.Container;
import net.ME1312.SubServers.Proxy.Library.UniversalFile;
import net.ME1312.SubServers.Proxy.Library.Util;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Event.SubCreateEvent;
import net.ME1312.SubServers.Bungee.Host.Executable;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.SubCreator;
import net.ME1312.SubServers.Bungee.Library.Config.YAMLSection;
import net.ME1312.SubServers.Bungee.Library.Container;
import net.ME1312.SubServers.Bungee.Library.UniversalFile;
import net.ME1312.SubServers.Bungee.Library.Util;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@ -20,11 +20,8 @@ import javax.xml.parsers.ParserConfigurationException;
import java.io.*;
import java.net.URL;
import java.nio.charset.Charset;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import java.util.UUID;
public class InternalSubCreator extends SubCreator {

View File

@ -1,6 +1,6 @@
package net.ME1312.SubServers.Proxy.Host.Internal;
package net.ME1312.SubServers.Bungee.Host.Internal;
import net.ME1312.SubServers.Proxy.Library.Container;
import net.ME1312.SubServers.Bungee.Library.Container;
import net.md_5.bungee.api.ProxyServer;
import java.io.*;

View File

@ -1,13 +1,12 @@
package net.ME1312.SubServers.Proxy.Host.Internal;
package net.ME1312.SubServers.Bungee.Host.Internal;
import net.ME1312.SubServers.Proxy.Event.*;
import net.ME1312.SubServers.Proxy.Host.Executable;
import net.ME1312.SubServers.Proxy.Library.Container;
import net.ME1312.SubServers.Proxy.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Proxy.Host.Host;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.NamedContainer;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Event.*;
import net.ME1312.SubServers.Bungee.Host.Executable;
import net.ME1312.SubServers.Bungee.Library.Container;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
import java.io.BufferedWriter;
import java.io.File;

View File

@ -1,8 +1,8 @@
package net.ME1312.SubServers.Proxy.Host;
package net.ME1312.SubServers.Bungee.Host;
import net.ME1312.SubServers.Proxy.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.ClientHandler;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.ClientHandler;
import net.md_5.bungee.BungeeServerInfo;
import net.md_5.bungee.api.ChatColor;

View File

@ -1,8 +1,7 @@
package net.ME1312.SubServers.Proxy.Host;
package net.ME1312.SubServers.Bungee.Host;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import java.io.File;
import java.util.UUID;
/**

View File

@ -1,7 +1,7 @@
package net.ME1312.SubServers.Proxy.Host;
package net.ME1312.SubServers.Bungee.Host;
import net.ME1312.SubServers.Proxy.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Proxy.Library.NamedContainer;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
import java.net.InetSocketAddress;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy;
package net.ME1312.SubServers.Bungee;
import java.security.Security;
import java.text.SimpleDateFormat;

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library.Config;
package net.ME1312.SubServers.Bungee.Library.Config;
import org.json.JSONObject;
import org.yaml.snakeyaml.DumperOptions;

View File

@ -1,6 +1,6 @@
package net.ME1312.SubServers.Proxy.Library.Config;
package net.ME1312.SubServers.Bungee.Library.Config;
import net.ME1312.SubServers.Proxy.Library.Util;
import net.ME1312.SubServers.Bungee.Library.Util;
import net.md_5.bungee.api.ChatColor;
import org.json.JSONObject;
import org.yaml.snakeyaml.Yaml;
@ -87,6 +87,8 @@ public class YAMLSection {
map.put(label, ((YAMLSection) value).map);
} else if (value instanceof YAMLValue) {
map.put(label, ((YAMLValue) value).asObject());
} else if (value instanceof UUID) {
map.put(label, ((UUID) value).toString());
} else {
map.put(label, value);
}
@ -409,6 +411,34 @@ public class YAMLSection {
}
}
public UUID getUUID(String label) {
return (map.get(label) != null)?UUID.fromString((String) map.get(label)):null;
}
public UUID getUUID(String label, UUID def) {
return UUID.fromString((String) ((map.get(label) != null) ? map.get(label) : def));
}
public List<UUID> getUUIDList(String label) {
if (map.get(label) != null) {
List<UUID> values = new ArrayList<UUID>();
for (String value : (List<String>) map.get(label)) {
values.add(UUID.fromString(value));
}
return values;
} else {
return null;
}
}
public List<UUID> getUUIDList(String label, List<UUID> def) {
if (map.get(label) != null) {
return getUUIDList(label);
} else {
return def;
}
}
public boolean isBoolean(String label) {
return (map.get(label) instanceof Boolean);
}

View File

@ -1,12 +1,13 @@
package net.ME1312.SubServers.Proxy.Library.Config;
package net.ME1312.SubServers.Bungee.Library.Config;
import net.ME1312.SubServers.Proxy.Library.Util;
import net.ME1312.SubServers.Bungee.Library.Util;
import net.md_5.bungee.api.ChatColor;
import org.yaml.snakeyaml.Yaml;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@SuppressWarnings({"unchecked", "unused"})
public class YAMLValue {
@ -118,6 +119,18 @@ public class YAMLValue {
return values;
}
public UUID asUUID() {
return UUID.fromString((String) obj);
}
public List<UUID> asUUIDList() {
List<UUID> values = new ArrayList<UUID>();
for (String value : (List<String>) obj) {
values.add(UUID.fromString(value));
}
return values;
}
public boolean isBoolean() {
return (obj instanceof Boolean);
}

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library;
package net.ME1312.SubServers.Bungee.Library;
/**
* Container Class

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library.Exception;
package net.ME1312.SubServers.Bungee.Library.Exception;
public class IllegalPacketException extends IllegalStateException {
public IllegalPacketException() {}

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library.Exception;
package net.ME1312.SubServers.Bungee.Library.Exception;
public class InvalidDriverException extends IllegalStateException {
public InvalidDriverException() {}

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library.Exception;
package net.ME1312.SubServers.Bungee.Library.Exception;
public class InvalidHostException extends IllegalStateException {
public InvalidHostException() {}

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library.Exception;
package net.ME1312.SubServers.Bungee.Library.Exception;
public class InvalidServerException extends IllegalStateException {
public InvalidServerException() {}

View File

@ -1,4 +1,4 @@
# Version: 2.11.0a+
# Version: 2.11.2a+
#
# SubCreator Build Script
# Usage: "bash build.sh <version> <software> [jre]"

View File

@ -0,0 +1,40 @@
ip_forward: true
network_compression_threshold: 256
stats: undefined
permissions:
default:
- bungeecord.command.server
- bungeecord.command.list
admin:
- bungeecord.command.find
- bungeecord.command.alert
- bungeecord.command.send
- bungeecord.command.end
- bungeecord.command.ip
- bungeecord.command.reload
groups: {}
servers:
Lobby:
motd: '&1Just another BungeeCord - Forced Host'
address: 127.0.0.1:25566
restricted: false
timeout: 30000
listeners:
- query_port: 25564
motd: '&1Another Bungee server'
priorities:
- Lobby
bind_local_address: true
tab_list: GLOBAL_PING
query_enabled: false
host: 0.0.0.0:25565
forced_hosts: {}
max_players: 1
tab_size: 60
ping_passthrough: false
force_default_server: false
player_limit: -1
online_mode: true
log_commands: false
disabled_commands: []
connection_throttle: 4000

View File

@ -1,5 +1,5 @@
Settings:
Version: '2.11.0a+'
Version: '2.11.2a+'
Log-Creator: true
SubData:
Address: '127.0.0.1:4391'
@ -26,4 +26,5 @@ Servers:
Stop-Command: 'stop'
Run-On-Launch: false
Auto-Restart: false
Restricted: false
Restricted: false
Hidden: false

View File

@ -1,5 +1,64 @@
Version: '2.11.0a+'
Version: '2.11.2a+'
Lang:
'Bungee.Server.Current': '&6You are currently connected to $str$'
'Bungee.Server.Available': '&6You may connect to the following servers at this time:'
'Bungee.Server.List': '&6$str$'
'Bungee.Server.Hover': '$int$ player(s)\n&oClick to connect to the server'
'Bungee.Server.Divider': '&6, '
'Bungee.Server.Invalid': '&cThe specified server does not exist.'
'Bungee.List.Format': '&a[$str$] &e($int$): '
'Bungee.List.List': '&f$str$'
'Bungee.List.Divider': '&f, '
'Bungee.List.Total': 'Total players online: $int$'
'Command.Generic.Player-Only': '&4SubServers \u00BB Console cannot run this command'
'Command.Generic.Console-Only': '&4SubServers \u00BB This command is for console use only'
'Command.Generic.Usage': '&7SubServers \u00BB Usage: &f$str$'
'Command.Generic.Invalid-Subcommand': '&4SubServers \u00BB Unknown sub-command: $str$'
'Command.Generic.Invalid-Permission': '&4SubServers \u00BB You need &n$str$&4 to use this command'
'Command.Help.Header': '&7SubServers \u00BB Command Help:'
'Command.Help.Help': ' &7Help:&f $str$'
'Command.Help.List': ' &7List:&f $str$'
'Command.Help.Version': ' &7Version:&f $str$'
'Command.Help.Terminate': ' &7Teleport to Server:&f $str$'
'Command.Help.Host.Create': ' &7Create Server:&f $str$'
'Command.Help.Server.Teleport': ' &7Teleport to Server:&f $str$'
'Command.Help.SubServer.Start': ' &7Start Server:&f $str$'
'Command.Help.SubServer.Stop': ' &7Stop Server:&f $str$'
'Command.Help.SubServer.Terminate': ' &7Terminate Server:&f $str$'
'Command.Help.SubServer.Command': ' &7Command Server:&f $str$'
'Command.Version': '&7SubServers \u00BB SubServers is running version &f$str$'
'Command.List.Host-Header': '&7SubServers \u00BB Host List:'
'Command.List.Server-Header': '&7SubServers \u00BB Server List:'
'Command.List.Divider': '&7, '
'Command.Start': '&aSubServers \u00BB Starting SubServer'
'Command.Start.Unknown': '&cSubServers \u00BB There is no server with that name'
'Command.Start.Invalid': '&cSubServers \u00BB That Server is not a SubServer'
'Command.Start.Host-Disabled': '&cSubServers \u00BB That SubServer\u0027s Host is not enabled'
'Command.Start.Server-Disabled': '&cSubServers \u00BB That SubServer is not enabled'
'Command.Start.Running': '&cSubServers \u00BB That SubServer is already running'
'Command.Stop': '&aSubServers \u00BB Stopping SubServer'
'Command.Stop.Unknown': '&cSubServers \u00BB There is no server with that name'
'Command.Stop.Invalid': '&cSubServers \u00BB That Server is not a SubServer'
'Command.Stop.Not-Running': '&cSubServers \u00BB That SubServer is not running'
'Command.Terminate': '&aSubServers \u00BB Stopping SubServer'
'Command.Terminate.Unknown': '&cSubServers \u00BB There is no server with that name'
'Command.Terminate.Invalid': '&cSubServers \u00BB That Server is not a SubServer'
'Command.Terminate.Not-Running': '&cSubServers \u00BB That SubServer is not running'
'Command.Command': '&aSubServers \u00BB Sending command to SubServer'
'Command.Command.Unknown': '&cSubServers \u00BB There is no server with that name'
'Command.Command.Invalid': '&cSubServers \u00BB That Server is not a SubServer'
'Command.Command.Not-Running': '&cSubServers \u00BB That SubServer is not running'
'Command.Teleport': '&aSubServers \u00BB Teleporting...'
'Command.Teleport.Offline': '&cSubServers \u00BB There is no player online with that name'
'Command.Teleport.Invalid': '&cSubServers \u00BB There is no server with that name'
'Command.Creator': '&aSubServers \u00BB Creating SubServer'
'Command.Creator.Exists': '&cSubServers \u00BB There is already a SubServer with that name'
'Command.Creator.Unknown-Host': '&cSubServers \u00BB There is no host with that name'
'Command.Creator.Running': '&cSubServers \u00BB The SubCreator instance on that host is already running'
'Command.Creator.Invalid-Type': '&cSubServers \u00BB There is no server type with that name'
'Command.Creator.Invalid-Version': '&cSubServers \u00BB SubCreator cannot create servers before Minecraft 1.8'
'Command.Creator.Invalid-Port': '&cSubServers \u00BB Invalid Port Number'
'Command.Creator.Invalid-Memory': '&cSubServers \u00BB Invalid RAM Amount'
'Interface.Generic.Back': '&cBack'
'Interface.Generic.Back-Arrow': '&e&l<--'
'Interface.Generic.Next-Arrow': '&e&l-->'
@ -55,6 +114,7 @@ Lang:
'Interface.Host-SubServer.Title': 'Host/$str$/SubServers'
'Interface.SubServer-Menu.Title': 'SubServer Menu'
'Interface.SubServer-Menu.SubServer-Player-Count': '&2$int$ Player(s) Online'
'Interface.SubServer-Menu.SubServer-External': '&7External Server'
'Interface.SubServer-Menu.SubServer-Temporary': '&9Temporary'
'Interface.SubServer-Menu.SubServer-Offline': '&6Offline'
'Interface.SubServer-Menu.SubServer-Disabled': '&4Disabled'
@ -72,4 +132,5 @@ Lang:
'Interface.SubServer-Admin.Command.Message': '&eSubServers \u00BB Enter a Command to send via Chat'
'Interface.SubServer-Admin.Teleport': '&bTeleport to Server'
'Interface.SubServer-Admin.Editor': '&eEdit SubServer'
'Interface.SubServer-Admin.Editor-Unavailable': '&4This SubServer cannot be edited'
'Interface.SubServer-Admin.Editor-Unavailable': '&4This SubServer cannot be edited'
'Interface.SubServer-Editor.Title': 'SubServer/$str$/Edit'

View File

@ -0,0 +1,6 @@
version: 2
modules:
- jenkins://cmd_alert
- jenkins://cmd_find
- jenkins://cmd_send
- jenkins://reconnect_yaml

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library;
package net.ME1312.SubServers.Bungee.Library;
import org.json.JSONObject;

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library;
package net.ME1312.SubServers.Bungee.Library;
public class NamedContainer<T, V> extends Container<V> {
private T name;

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library;
package net.ME1312.SubServers.Bungee.Library;
public interface SubEvent {
/*

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library;
package net.ME1312.SubServers.Bungee.Library;
import java.io.File;

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library;
package net.ME1312.SubServers.Bungee.Library;
import java.io.*;

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library.Version;
package net.ME1312.SubServers.Bungee.Library.Version;
import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Library.Version;
package net.ME1312.SubServers.Bungee.Library.Version;
public final class VersionTokenizer {
private final String _versionString;

View File

@ -1,8 +1,8 @@
package net.ME1312.SubServers.Proxy.Network;
package net.ME1312.SubServers.Bungee.Network;
import net.ME1312.SubServers.Proxy.Library.Exception.IllegalPacketException;
import net.ME1312.SubServers.Proxy.Network.Packet.PacketAuthorization;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Library.Exception.IllegalPacketException;
import net.ME1312.SubServers.Bungee.Network.Packet.PacketAuthorization;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONException;
import org.json.JSONObject;
@ -13,7 +13,7 @@ import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.util.Timer;
import java.util.TimerTask;
@ -88,7 +88,7 @@ public final class Client {
e1.printStackTrace();
}
} catch (Exception e) {
if (e.getMessage() == null || !e.getMessage().equals("Socket closed")) e.printStackTrace();
if (!(e instanceof SocketException)) e.printStackTrace();
try {
plugin.subdata.removeClient(instance);
} catch (IOException e1) {

View File

@ -1,4 +1,4 @@
package net.ME1312.SubServers.Proxy.Network;
package net.ME1312.SubServers.Bungee.Network;
/**
* Client Handler Layout Class

View File

@ -1,10 +1,10 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
public class PacketAuthorization implements PacketIn, PacketOut {

View File

@ -1,12 +1,12 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
import java.util.Map;

View File

@ -1,12 +1,12 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Host.SubCreator;
import net.ME1312.SubServers.Proxy.Library.Util;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Host.SubCreator;
import net.ME1312.SubServers.Bungee.Library.Util;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
import java.util.UUID;

View File

@ -1,11 +1,11 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Library.UniversalFile;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Library.UniversalFile;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
import java.io.BufferedReader;

View File

@ -1,13 +1,13 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Host.Host;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.SubPlugin;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import org.json.JSONObject;

View File

@ -1,10 +1,10 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
public class PacketDownloadLang implements PacketIn, PacketOut {

View File

@ -1,10 +1,10 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import org.json.JSONObject;

View File

@ -1,14 +1,13 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import org.json.JSONArray;
import org.json.JSONObject;
public class PacketDownloadServerInfo implements PacketIn, PacketOut {

View File

@ -1,21 +1,16 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Host.Host;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
public class PacketDownloadServerList implements PacketIn, PacketOut {
private SubPlugin plugin;
private String host;

View File

@ -1,12 +1,12 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Event.SubDataRecieveGenericInfoEvent;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.ClientHandler;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Event.SubDataRecieveGenericInfoEvent;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.ClientHandler;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
import java.net.InetSocketAddress;

View File

@ -1,12 +1,12 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
import java.util.Map;

View File

@ -1,11 +1,11 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Event.*;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Library.SubEvent;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Event.*;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Library.SubEvent;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import net.md_5.bungee.event.EventPriority;

View File

@ -1,7 +1,7 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import org.json.JSONObject;
public class PacketOutShutdown implements PacketOut {

View File

@ -1,12 +1,12 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
import java.util.Map;

View File

@ -1,12 +1,12 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
import java.util.Map;

View File

@ -1,11 +1,11 @@
package net.ME1312.SubServers.Proxy.Network.Packet;
package net.ME1312.SubServers.Bungee.Network.Packet;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Client;
import net.ME1312.SubServers.Proxy.Network.PacketIn;
import net.ME1312.SubServers.Proxy.Network.PacketOut;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Client;
import net.ME1312.SubServers.Bungee.Network.PacketIn;
import net.ME1312.SubServers.Bungee.Network.PacketOut;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
import java.util.Map;

View File

@ -1,6 +1,6 @@
package net.ME1312.SubServers.Proxy.Network;
package net.ME1312.SubServers.Bungee.Network;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import org.json.JSONObject;
/**

View File

@ -1,6 +1,6 @@
package net.ME1312.SubServers.Proxy.Network;
package net.ME1312.SubServers.Bungee.Network;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import org.json.JSONObject;
/**

View File

@ -1,9 +1,9 @@
package net.ME1312.SubServers.Proxy.Network;
package net.ME1312.SubServers.Bungee.Network;
import net.ME1312.SubServers.Proxy.Library.Exception.IllegalPacketException;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.Packet.*;
import net.ME1312.SubServers.Proxy.SubPlugin;
import net.ME1312.SubServers.Bungee.Library.Exception.IllegalPacketException;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.Packet.*;
import net.ME1312.SubServers.Bungee.SubPlugin;
import org.json.JSONObject;
import java.io.IOException;

View File

@ -1,13 +1,12 @@
package net.ME1312.SubServers.Proxy;
package net.ME1312.SubServers.Bungee;
import net.ME1312.SubServers.Proxy.Event.SubAddServerEvent;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Host.Host;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.Config.YAMLSection;
import net.ME1312.SubServers.Proxy.Library.UniversalFile;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.SubDataServer;
import net.ME1312.SubServers.Bungee.Event.SubAddServerEvent;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.UniversalFile;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Network.SubDataServer;
import java.net.InetAddress;
import java.net.InetSocketAddress;

View File

@ -1,17 +1,24 @@
package net.ME1312.SubServers.Proxy;
package net.ME1312.SubServers.Bungee;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Host.SubCreator;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.Util;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Host.SubCreator;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.Util;
import net.ME1312.SubServers.Bungee.Library.Version.Version;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.command.ConsoleCommandSender;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
@ -21,10 +28,12 @@ import java.util.Map;
*/
public final class SubCommand extends Command {
private SubPlugin plugin;
private String label;
public SubCommand(SubPlugin plugin) {
super("subserver", null, "sub", "subservers");
protected SubCommand(SubPlugin plugin, String command) {
super(command);
this.plugin = plugin;
this.label = "/" + command;
}
/**
@ -43,9 +52,15 @@ public final class SubCommand extends Command {
} else if (args[0].equalsIgnoreCase("version") || args[0].equalsIgnoreCase("ver")) {
sender.sendMessage("SubServers > SubServers.Bungee is running version " + plugin.version.toString() + ((plugin.bversion != null)?" BETA "+plugin.bversion.toString():""));
} else if (args[0].equalsIgnoreCase("list")) {
List<String> hosts = new ArrayList<String>();
for (Host host : plugin.hosts.values()) {
hosts.add(host.getName());
}
List<String> servers = new ArrayList<String>();
servers.addAll(plugin.getServers().keySet());
sender.sendMessages(
"SubServers > Host List:", plugin.hosts.keySet().toString(),
"SubServers > Server List:", plugin.api.getServers().keySet().toString());
"SubServers > Host List:", hosts.toString().substring(1, hosts.toString().length() - 1),
"SubServers > Server List:", servers.toString().substring(1, servers.toString().length() - 1));
} else if (args[0].equalsIgnoreCase("start")) {
if (args.length > 1) {
Map<String, Server> servers = plugin.api.getServers();
@ -63,7 +78,7 @@ public final class SubCommand extends Command {
((SubServer) servers.get(args[1].toLowerCase())).start();
}
} else {
sender.sendMessage("SubServers > Usage: /sub start <SubServer>");
sender.sendMessage("SubServers > Usage: " + label + " " + args[0].toLowerCase() + " <SubServer>");
}
} else if (args[0].equalsIgnoreCase("stop")) {
if (args.length > 1) {
@ -78,7 +93,7 @@ public final class SubCommand extends Command {
((SubServer) servers.get(args[1].toLowerCase())).stop();
}
} else {
sender.sendMessage("SubServers > Usage: /sub stop <SubServer>");
sender.sendMessage("SubServers > Usage: " + label + " " + args[0].toLowerCase() + " <SubServer>");
}
} else if (args[0].equalsIgnoreCase("kill") || args[0].equalsIgnoreCase("terminate")) {
if (args.length > 1) {
@ -93,7 +108,7 @@ public final class SubCommand extends Command {
((SubServer) servers.get(args[1].toLowerCase())).terminate();
}
} else {
sender.sendMessage("SubServers > Usage: /sub kill <SubServer>");
sender.sendMessage("SubServers > Usage: " + label + " " + args[0].toLowerCase() + " <SubServer>");
}
} else if (args[0].equalsIgnoreCase("cmd") || args[0].equalsIgnoreCase("command")) {
if (args.length > 2) {
@ -116,7 +131,7 @@ public final class SubCommand extends Command {
((SubServer) servers.get(args[1].toLowerCase())).command(str);
}
} else {
sender.sendMessage("SubServers > Usage: /sub cmd <SubServer> <Command> [Args...]");
sender.sendMessage("SubServers > Usage: " + label + " " + args[0].toLowerCase() + " <SubServer> <Command> [Args...]");
}
} else if (args[0].equalsIgnoreCase("create")) {
if (args.length > 5) {
@ -138,8 +153,10 @@ public final class SubCommand extends Command {
plugin.hosts.get(args[2].toLowerCase()).getCreator().create(args[1], SubCreator.ServerType.valueOf(args[3].toUpperCase()), new Version(args[4]), (args.length > 6)?Integer.parseInt(args[6]):1024, Integer.parseInt(args[5]));
}
} else {
sender.sendMessage("SubServers > Usage: /sub create <Name> <Host> <Type> <Version> <Port> [RAM]");
sender.sendMessage("SubServers > Usage: " + label + " " + args[0].toLowerCase() + " <Name> <Host> <Type> <Version> <Port> [RAM]");
}
} else {
sender.sendMessage("SubServers > Unknown sub-command: " + args[0]);
}
} else {
sender.sendMessages(printHelp());
@ -151,11 +168,11 @@ public final class SubCommand extends Command {
i++;
str = str + " " + args[i];
}
((ProxiedPlayer) sender).chat("/subservers" + str);
((ProxiedPlayer) sender).chat(label + str);
}
}
public String[] printHelp() {
private String[] printHelp() {
return new String[]{
"SubServers > Console Command Help:",
" Help: /sub help",
@ -171,4 +188,79 @@ public final class SubCommand extends Command {
" https://www.spigotmc.org/wiki/bungeecord-commands/"
};
}
public static class BungeeServer extends Command {
private SubPlugin plugin;
protected BungeeServer(SubPlugin plugin, String command) {
super(command, "bungeecord.command.server");
this.plugin = plugin;
}
@SuppressWarnings("deprecation")
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof ProxiedPlayer) {
if (args.length > 0) {
Map<String, Server> servers = plugin.api.getServers();
if (servers.keySet().contains(args[0].toLowerCase())) {
((ProxiedPlayer) sender).connect(servers.get(args[0].toLowerCase()));
} else {
sender.sendMessage(plugin.lang.get().getSection("Lang").getColoredString("Bungee.Server.Invalid", '&'));
}
} else {
int i = 0;
TextComponent serverm = new TextComponent(ChatColor.RESET.toString());
TextComponent div = new TextComponent(plugin.lang.get().getSection("Lang").getColoredString("Bungee.Server.Divider", '&'));
for (Server server : plugin.api.getServers().values()) {
if (!server.isHidden() && (!(server instanceof SubServer) || ((SubServer) server).isRunning())) {
if (i != 0) serverm.addExtra(div);
TextComponent message = new TextComponent(plugin.lang.get().getSection("Lang").getColoredString("Bungee.Server.List", '&').replace("$str$", server.getName()));
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponent[]{new TextComponent(plugin.lang.get().getSection("Lang").getColoredString("Bungee.Server.Hover", '&').replace("$int$", Integer.toString(server.getPlayers().size())))}));
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/server " + server.getName()));
serverm.addExtra(message);
i++;
}
}
sender.sendMessages(
plugin.lang.get().getSection("Lang").getColoredString("Bungee.Server.Current", '&').replace("$str$", ((ProxiedPlayer) sender).getServer().getInfo().getName()),
plugin.lang.get().getSection("Lang").getColoredString("Bungee.Server.Available", '&'));
sender.sendMessage(serverm);
}
} else {
sender.sendMessage(plugin.lang.get().getSection("Lang").getColoredString("Command.Generic.Player-Only", '&'));
}
}
}
public static class BungeeList extends Command {
private SubPlugin plugin;
protected BungeeList(SubPlugin plugin, String command) {
super(command, "bungeecord.command.list");
this.plugin = plugin;
}
@SuppressWarnings("deprecation")
@Override
public void execute(CommandSender sender, String[] args) {
List<String> messages = new LinkedList<String>();
int players = 0;
for (Server server : plugin.api.getServers().values()) {
players += server.getPlayers().size();
if (!server.isHidden() && (!(server instanceof SubServer) || ((SubServer) server).isRunning())) {
int i = 0;
String message = plugin.lang.get().getSection("Lang").getColoredString("Bungee.List.Format", '&').replace("$str$", server.getName()).replace("$int$", Integer.toString(server.getPlayers().size()));
for (ProxiedPlayer player : server.getPlayers()) {
if (i != 0) message += plugin.lang.get().getSection("Lang").getColoredString("Bungee.List.Divider", '&');
message += plugin.lang.get().getSection("Lang").getColoredString("Bungee.List.List", '&').replace("$str$", player.getName());
i++;
}
messages.add(message);
}
}
sender.sendMessages(messages.toArray(new String[messages.size()]));
sender.sendMessage(plugin.lang.get().getSection("Lang").getColoredString("Bungee.List.Total", '&').replace("$int$", Integer.toString(players)));
}
}
}

View File

@ -1,22 +1,23 @@
package net.ME1312.SubServers.Proxy;
package net.ME1312.SubServers.Bungee;
import net.ME1312.SubServers.Proxy.Host.Executable;
import net.ME1312.SubServers.Proxy.Host.Server;
import net.ME1312.SubServers.Proxy.Library.Config.YAMLConfig;
import net.ME1312.SubServers.Proxy.Library.Exception.InvalidHostException;
import net.ME1312.SubServers.Proxy.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Proxy.Host.Host;
import net.ME1312.SubServers.Proxy.Host.SubServer;
import net.ME1312.SubServers.Proxy.Library.UniversalFile;
import net.ME1312.SubServers.Proxy.Library.Util;
import net.ME1312.SubServers.Proxy.Library.Version.Version;
import net.ME1312.SubServers.Proxy.Network.SubDataServer;
import net.ME1312.SubServers.Bungee.Host.Executable;
import net.ME1312.SubServers.Bungee.Host.Server;
import net.ME1312.SubServers.Bungee.Library.Config.YAMLConfig;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidHostException;
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Bungee.Host.Host;
import net.ME1312.SubServers.Bungee.Host.SubServer;
import net.ME1312.SubServers.Bungee.Library.UniversalFile;
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.BungeeCord;
import net.md_5.bungee.api.config.ServerInfo;
import java.io.*;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketException;
import java.nio.file.Files;
import java.util.*;
@ -35,8 +36,8 @@ public final class SubPlugin extends BungeeCord {
public YAMLConfig lang;
public HashMap<String, String> exLang = new HashMap<String, String>();
public SubDataServer subdata = null;
public final Version version = new Version("2.11.0a");
protected Version bversion = new Version(3);
public final Version version = new Version("2.11.2a");
protected Version bversion = new Version(4);
protected boolean running = false;
public final SubAPI api = new SubAPI(this);
@ -54,29 +55,40 @@ public final class SubPlugin extends BungeeCord {
if (running) throw new IllegalStateException("SubServers has already been loaded");
System.out.println("SubServers > Loading SubServers v" + version.toString() + " Libraries... ");
running = true;
if (!(new UniversalFile(dir, "config.yml").exists())) {
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/bungee.yml", new UniversalFile(dir, "config.yml").getPath());
YAMLConfig tmp = new YAMLConfig(new UniversalFile("config.yml"));
tmp.get().set("stats", UUID.randomUUID().toString());
tmp.save();
System.out.println("SubServers > Created ~/config.yml");
}
if (!(new UniversalFile(dir, "modules.yml").exists())) {
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/modules.yml", new UniversalFile(dir, "modules.yml").getPath());
System.out.println("SubServers > Created ~/modules.yml");
}
UniversalFile dir = new UniversalFile(this.dir, "SubServers");
dir.mkdir();
if (!(new UniversalFile(dir, "config.yml").exists())) {
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Proxy/Library/Files/config.yml", new UniversalFile(dir, "config.yml").getPath());
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/config.yml", new UniversalFile(dir, "config.yml").getPath());
System.out.println("SubServers > Created ~/SubServers/config.yml");
} else if ((new Version((new YAMLConfig(new UniversalFile(dir, "config.yml"))).get().getSection("Settings").getString("Version", "0")).compareTo(new Version("2.11.0a+"))) != 0) {
} else if ((new Version((new YAMLConfig(new UniversalFile(dir, "config.yml"))).get().getSection("Settings").getString("Version", "0")).compareTo(new Version("2.11.2a+"))) != 0) {
Files.move(new UniversalFile(dir, "config.yml").toPath(), new UniversalFile(dir, "config.old" + Math.round(Math.random() * 100000) + ".yml").toPath());
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Proxy/Library/Files/config.yml", new UniversalFile(dir, "config.yml").getPath());
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/config.yml", new UniversalFile(dir, "config.yml").getPath());
System.out.println("SubServers > Updated ~/SubServers/config.yml");
}
if (!(new UniversalFile(dir, "lang.yml").exists())) {
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Proxy/Library/Files/lang.yml", new UniversalFile(dir, "lang.yml").getPath());
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/lang.yml", new UniversalFile(dir, "lang.yml").getPath());
System.out.println("SubServers > Created ~/SubServers/lang.yml");
} else if ((new Version((new YAMLConfig(new UniversalFile(dir, "lang.yml"))).get().getString("Version", "0")).compareTo(new Version("2.11.0a+"))) != 0) {
} else if ((new Version((new YAMLConfig(new UniversalFile(dir, "lang.yml"))).get().getString("Version", "0")).compareTo(new Version("2.11.2a+"))) != 0) {
Files.move(new UniversalFile(dir, "lang.yml").toPath(), new UniversalFile(dir, "lang.old" + Math.round(Math.random() * 100000) + ".yml").toPath());
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Proxy/Library/Files/lang.yml", new UniversalFile(dir, "lang.yml").getPath());
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/lang.yml", new UniversalFile(dir, "lang.yml").getPath());
System.out.println("SubServers > Updated ~/SubServers/lang.yml");
}
if (!(new UniversalFile(dir, "build.sh").exists())) {
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Proxy/Library/Files/build.sh", new UniversalFile(dir, "build.sh").getPath());
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/build.sh", new UniversalFile(dir, "build.sh").getPath());
System.out.println("SubServers > Created ~/SubServers/build.sh");
} else {
String Version = "null";
@ -88,12 +100,12 @@ public final class SubPlugin extends BungeeCord {
if (!Version.equalsIgnoreCase("2.11.0a+")) {
Files.move(new UniversalFile(dir, "build.sh").toPath(), new UniversalFile(dir, "build.old" + Math.round(Math.random() * 100000) + ".sh").toPath());
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Proxy/Library/Files/build.sh", new UniversalFile(dir, "build.sh").getPath());
Util.copyFromJar(SubPlugin.class.getClassLoader(), "net/ME1312/SubServers/Bungee/Library/Files/build.sh", new UniversalFile(dir, "build.sh").getPath());
System.out.println("SubServers > Updated ~/SubServers/build.sh");
}
}
hostDrivers.put("built-in", net.ME1312.SubServers.Proxy.Host.Internal.InternalHost.class);
hostDrivers.put("built-in", net.ME1312.SubServers.Bungee.Host.Internal.InternalHost.class);
System.out.println("SubServers > Loading BungeeCord Libraries...");
}
@ -156,7 +168,7 @@ public final class SubPlugin extends BungeeCord {
SubServer server = this.hosts.get(config.get().getSection("Servers").getSection(name).getString("Host").toLowerCase()).addSubServer(name, config.get().getSection("Servers").getSection(name).getBoolean("Enabled"),
config.get().getSection("Servers").getSection(name).getInt("Port"), config.get().getSection("Servers").getSection(name).getColoredString("Motd", '&'), config.get().getSection("Servers").getSection(name).getBoolean("Log"),
config.get().getSection("Servers").getSection(name).getRawString("Directory"), new Executable(config.get().getSection("Servers").getSection(name).getRawString("Executable")), config.get().getSection("Servers").getSection(name).getRawString("Stop-Command"),
config.get().getSection("Servers").getSection(name).getBoolean("Run-On-Launch"), config.get().getSection("Servers").getSection(name).getBoolean("Hidden", false), config.get().getSection("Servers").getSection(name).getBoolean("Auto-Restart"), config.get().getSection("Servers").getSection(name).getBoolean("Restricted"), false);
config.get().getSection("Servers").getSection(name).getBoolean("Run-On-Launch"), config.get().getSection("Servers").getSection(name).getBoolean("Hidden"), config.get().getSection("Servers").getSection(name).getBoolean("Auto-Restart"), config.get().getSection("Servers").getSection(name).getBoolean("Restricted"), false);
subservers++;
} catch (Exception e) {
e.printStackTrace();
@ -165,7 +177,11 @@ public final class SubPlugin extends BungeeCord {
System.out.println("SubServers > " + hosts + " Host(s), " + servers + " Server(s), and " + subservers + " SubServer(s) loaded in " + (Calendar.getInstance().getTime().getTime() - begin) + "ms");
getPluginManager().registerCommand(null, new SubCommand(this));
getPluginManager().registerCommand(null, new SubCommand.BungeeServer(this, "server"));
getPluginManager().registerCommand(null, new SubCommand.BungeeList(this, "glist"));
getPluginManager().registerCommand(null, new SubCommand(this, "subservers"));
getPluginManager().registerCommand(null, new SubCommand(this, "subserver"));
getPluginManager().registerCommand(null, new SubCommand(this, "sub"));
super.startListeners();
} catch (IOException e) {
@ -179,7 +195,7 @@ public final class SubPlugin extends BungeeCord {
try {
subdata.addClient(subdata.getServer().accept());
} catch (IOException e) {
if (e.getMessage() == null || !e.getMessage().equals("Socket closed")) e.printStackTrace();
if (!(e instanceof SocketException)) e.printStackTrace();
}
}
}).start();

View File

@ -1,5 +1,5 @@
Settings:
Version: '2.11.0a+'
Version: '2.11.2a+'
Use-Title-Messages: true
SubData:
Name: 'Server_1'

View File

@ -50,7 +50,11 @@ public class UIListener implements Listener {
if (!event.isCancelled() && gui.keySet().contains(player.getUniqueId())) {
UIRenderer gui = this.gui.get(player.getUniqueId());
if (gui.open && event.getClickedInventory() != null && event.getClickedInventory().getTitle() != null) {
if (event.getClickedInventory().getTitle().equals(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Title", '&'))) { // Host Menu
if (plugin.subdata == null) {
new IllegalStateException("SubData is not connected").printStackTrace();
} else if (plugin.lang == null) {
new IllegalStateException("There are no lang options available at this time").printStackTrace();
} else if (event.getClickedInventory().getTitle().equals(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Title", '&'))) { // Host Menu
if (event.getCurrentItem() != null && event.getCurrentItem().getType() != Material.AIR && event.getCurrentItem().hasItemMeta()) {
String item = event.getCurrentItem().getItemMeta().getDisplayName();
@ -305,14 +309,14 @@ public class UIListener implements Listener {
player.sendMessage(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Admin.Command.Message", '&'));
input.put(player.getUniqueId(), m -> {
gui.setDownloading(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Downloading.Response", '&'));
plugin.subdata.sendPacket(new PacketCommandServer(player.getUniqueId(), gui.lastVistedObject, m.getString("message"), UUID.randomUUID().toString(), json -> {
plugin.subdata.sendPacket(new PacketCommandServer(player.getUniqueId(), gui.lastVistedObject, (m.getString("message").startsWith("/"))?m.getString("message").substring(1):m.getString("message"), UUID.randomUUID().toString(), json -> {
gui.reopen();
}));
});
} else gui.reopen();
} else if (item.equals(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Admin.Teleport", '&'))) {
player.closeInventory();
if (player.hasPermission("subservers.subserver.teleport.*") || player.hasPermission("subservers.subserver.teleport." + gui.lastVistedObject.toLowerCase())) {
if (player.hasPermission("subservers.server.teleport.*") || player.hasPermission("subservers.server.teleport." + gui.lastVistedObject.toLowerCase())) {
gui.setDownloading(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Downloading.Response", '&'));
plugin.subdata.sendPacket(new PacketTeleportPlayer(player.getUniqueId(), gui.lastVistedObject, UUID.randomUUID().toString(), json -> {
if (json.getInt("r") != 0) gui.reopen();

View File

@ -17,6 +17,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.scheduler.BukkitTask;
import java.text.DecimalFormat;
import java.util.*;
public class UIRenderer {
@ -91,7 +92,7 @@ public class UIRenderer {
* @return Window History Status
*/
public boolean hasHistory() {
return !windowHistory.isEmpty();
return windowHistory.size() > 1;
}
/**
@ -267,7 +268,7 @@ public class UIRenderer {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, enabled);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(ChatColor.AQUA + host);
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Host-Server-Count", '&').replace("$int$", Integer.toString(json.getJSONObject("hosts").getJSONObject(host).getJSONObject("servers").keySet().size()))));
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Host-Server-Count", '&').replace("$int$", new DecimalFormat("#,###").format(json.getJSONObject("hosts").getJSONObject(host).getJSONObject("servers").keySet().size()))));
} else {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, disabled);
blockMeta = block.getItemMeta();
@ -336,7 +337,7 @@ public class UIRenderer {
}
/**
* Opens Hosts/&lt;name&gt;
* Opens Host/&lt;name&gt;
*
* @param host Host Name
*/
@ -345,7 +346,7 @@ public class UIRenderer {
plugin.subdata.sendPacket(new PacketDownloadHostInfo(host, UUID.randomUUID().toString(), (json) -> {
windowHistory.add(() -> hostAdmin(host));
if (!json.getBoolean("valid")) {
back();
if (hasHistory()) back();
} else {
setDownloading(null);
lastVistedObject = host;
@ -423,7 +424,7 @@ public class UIRenderer {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 11);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(ChatColor.AQUA + host);
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Host-Server-Count", '&').replace("$int$", Integer.toString(json.getJSONObject("host").getJSONObject("servers").keySet().size()))));
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Host-Server-Count", '&').replace("$int$", new DecimalFormat("#,###").format(json.getJSONObject("host").getJSONObject("servers").keySet().size()))));
} else {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 14);
blockMeta = block.getItemMeta();
@ -436,12 +437,14 @@ public class UIRenderer {
inv.setItem(32, block);
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 14);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Back", '&'));
block.setItemMeta(blockMeta);
inv.setItem(34, block);
inv.setItem(35, block);
if (hasHistory()) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 14);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Back", '&'));
block.setItemMeta(blockMeta);
inv.setItem(34, block);
inv.setItem(35, block);
}
Bukkit.getPlayer(player).openInventory(inv);
open = true;
@ -450,7 +453,7 @@ public class UIRenderer {
}
/**
* Opens Hosts/&lt;name&gt;/Create
* Opens Host/&lt;name&gt;/Create
*
* @param options Creator Options
*/
@ -463,9 +466,9 @@ public class UIRenderer {
}
plugin.subdata.sendPacket(new PacketDownloadHostInfo(options.getHost(), UUID.randomUUID().toString(), json -> {
if (!json.getJSONObject("host").getBoolean("enabled") || json.getJSONObject("host").getJSONObject("creator").getBoolean("busy")) {
if (!json.getBoolean("valid")|| !json.getJSONObject("host").getBoolean("enabled") || json.getJSONObject("host").getJSONObject("creator").getBoolean("busy")) {
lastUsedOptions = null;
back();
if (hasHistory()) back();
} else {
setDownloading(null);
ItemStack block;
@ -586,12 +589,14 @@ public class UIRenderer {
inv.setItem(49, block);
inv.setItem(50, block);
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 14);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Back", '&'));
block.setItemMeta(blockMeta);
inv.setItem(52, block);
inv.setItem(53, block);
if (hasHistory()) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 14);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Back", '&'));
block.setItemMeta(blockMeta);
inv.setItem(52, block);
inv.setItem(53, block);
}
Bukkit.getPlayer(player).openInventory(inv);
open = true;
@ -726,7 +731,7 @@ public class UIRenderer {
}
/**
* Opens Hosts/&lt;name&gt;/Edit
* Opens Host/&lt;name&gt;/Edit
*
* @param options Host Editor Options
*/
@ -773,7 +778,7 @@ public class UIRenderer {
HashMap<String, String> hosts = new HashMap<String, String>();
List<String> subservers = new ArrayList<String>();
if (host != null) {
if (host != null && json.getJSONObject("hosts").keySet().contains(host)) {
lastVistedObject = host;
for (String subserver : json.getJSONObject("hosts").getJSONObject(host).getJSONObject("servers").keySet()) {
hosts.put(subserver, host);
@ -789,6 +794,7 @@ public class UIRenderer {
}
}
}
Collections.sort(subservers);
windowHistory.add(() -> subserverMenu(page, host));
ItemStack block;
@ -828,13 +834,13 @@ public class UIRenderer {
if (json.getJSONObject("hosts").getJSONObject(hosts.get(subserver)).getJSONObject("servers").getJSONObject(subserver).getBoolean("temp")) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, temp);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(ChatColor.BLUE + subserver);
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Player-Count", '&').replace("$int$", Integer.toString(json.getJSONObject("hosts").getJSONObject(hosts.get(subserver)).getJSONObject("servers").getJSONObject(subserver).getJSONObject("players").keySet().size())), plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Temporary", '&')));
blockMeta.setDisplayName(ChatColor.AQUA + subserver);
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Player-Count", '&').replace("$int$", new DecimalFormat("#,###").format(json.getJSONObject("hosts").getJSONObject(hosts.get(subserver)).getJSONObject("servers").getJSONObject(subserver).getJSONObject("players").keySet().size())), plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Temporary", '&')));
} else if (json.getJSONObject("hosts").getJSONObject(hosts.get(subserver)).getJSONObject("servers").getJSONObject(subserver).getBoolean("running")) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, online);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(ChatColor.GREEN + subserver);
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Player-Count", '&').replace("$int$", Integer.toString(json.getJSONObject("hosts").getJSONObject(hosts.get(subserver)).getJSONObject("servers").getJSONObject(subserver).getJSONObject("players").keySet().size()))));
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Player-Count", '&').replace("$int$", new DecimalFormat("#,###").format(json.getJSONObject("hosts").getJSONObject(hosts.get(subserver)).getJSONObject("servers").getJSONObject(subserver).getJSONObject("players").keySet().size()))));
} else if (json.getJSONObject("hosts").getJSONObject(hosts.get(subserver)).getJSONObject("servers").getJSONObject(subserver).getBoolean("enabled")) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, offline);
blockMeta = block.getItemMeta();
@ -885,14 +891,16 @@ public class UIRenderer {
inv.setItem(i++, block);
} else i += 2;
i++;
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) ((host == null)?11:14));
blockMeta = block.getItemMeta();
blockMeta.setDisplayName((host == null)?plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.Host-Menu", '&'):plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Back", '&'));
block.setItemMeta(blockMeta);
inv.setItem(i++, block);
inv.setItem(i++, block);
inv.setItem(i++, block);
i++;
if (host == null || hasHistory()) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) ((host == null) ? 11 : 14));
blockMeta = block.getItemMeta();
blockMeta.setDisplayName((host == null) ? plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.Host-Menu", '&') : plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Back", '&'));
block.setItemMeta(blockMeta);
inv.setItem(i++, block);
inv.setItem(i++, block);
inv.setItem(i++, block);
i++;
}
if (subservers.size() - 1 > max) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 4);
blockMeta = block.getItemMeta();
@ -917,7 +925,7 @@ public class UIRenderer {
plugin.subdata.sendPacket(new PacketDownloadServerInfo(subserver, UUID.randomUUID().toString(), json -> {
windowHistory.add(() -> subserverAdmin(subserver));
if (!json.getString("type").equals("subserver")) {
back();
if (hasHistory()) back();
} else {
setDownloading(null);
lastVistedObject = subserver;
@ -987,11 +995,11 @@ public class UIRenderer {
inv.setItem(15, block);
inv.setItem(16, block);
if (!(Bukkit.getPlayer(player).hasPermission("subservers.subserver.teleport.*") || Bukkit.getPlayer(player).hasPermission("subservers.subserver.teleport." + subserver.toLowerCase()))) {
if (!(Bukkit.getPlayer(player).hasPermission("subservers.server.teleport.*") || Bukkit.getPlayer(player).hasPermission("subservers.server.teleport." + subserver.toLowerCase()))) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 7);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(ChatColor.GRAY+ChatColor.stripColor(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Admin.Teleport", '&')));
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Invalid-Permission", '&').replace("$str$", "subservers.subserver.teleport." + subserver.toLowerCase())));
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Invalid-Permission", '&').replace("$str$", "subservers.server.teleport." + subserver.toLowerCase())));
} else {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 11);
blockMeta = block.getItemMeta();
@ -1051,13 +1059,13 @@ public class UIRenderer {
if (json.getJSONObject("server").getBoolean("temp")) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 11);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(ChatColor.BLUE + subserver);
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Player-Count", '&').replace("$int$", Integer.toString(json.getJSONObject("server").getJSONObject("players").keySet().size())), plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Temporary", '&')));
blockMeta.setDisplayName(ChatColor.AQUA + subserver);
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Player-Count", '&').replace("$int$", new DecimalFormat("#,###").format(json.getJSONObject("server").getJSONObject("players").keySet().size())), plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Temporary", '&')));
} else if (json.getJSONObject("server").getBoolean("running")) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 5);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(ChatColor.GREEN + subserver);
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Player-Count", '&').replace("$int$", Integer.toString(json.getJSONObject("server").getJSONObject("players").keySet().size()))));
blockMeta.setLore(Arrays.asList(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Player-Count", '&').replace("$int$", new DecimalFormat("#,###").format(json.getJSONObject("server").getJSONObject("players").keySet().size()))));
} else if (json.getJSONObject("server").getBoolean("enabled")) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 4);
blockMeta = block.getItemMeta();
@ -1074,13 +1082,14 @@ public class UIRenderer {
inv.setItem(31, block);
inv.setItem(32, block);
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 14);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Back", '&'));
block.setItemMeta(blockMeta);
inv.setItem(34, block);
inv.setItem(35, block);
if (hasHistory()) {
block = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 14);
blockMeta = block.getItemMeta();
blockMeta.setDisplayName(plugin.lang.getSection("Lang").getColoredString("Interface.Generic.Back", '&'));
block.setItemMeta(blockMeta);
inv.setItem(34, block);
inv.setItem(35, block);
}
Bukkit.getPlayer(player).openInventory(inv);
open = true;

View File

@ -86,6 +86,8 @@ public class YAMLSection {
map.put(label, ((YAMLSection) value).map);
} else if (value instanceof YAMLValue) {
map.put(label, ((YAMLValue) value).asObject());
} else if (value instanceof UUID) {
map.put(label, ((UUID) value).toString());
} else {
map.put(label, value);
}
@ -408,6 +410,26 @@ public class YAMLSection {
}
}
public List<UUID> getUUIDList(String label) {
if (map.get(label) != null) {
List<UUID> values = new ArrayList<UUID>();
for (String value : (List<String>) map.get(label)) {
values.add(UUID.fromString(value));
}
return values;
} else {
return null;
}
}
public List<UUID> getUUIDList(String label, List<UUID> def) {
if (map.get(label) != null) {
return getUUIDList(label);
} else {
return def;
}
}
public boolean isBoolean(String label) {
return (map.get(label) instanceof Boolean);
}

View File

@ -6,6 +6,7 @@ import org.yaml.snakeyaml.Yaml;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@SuppressWarnings({"unchecked", "unused"})
public class YAMLValue {
@ -117,6 +118,18 @@ public class YAMLValue {
return values;
}
public UUID asUUID() {
return UUID.fromString((String) obj);
}
public List<UUID> asUUIDList() {
List<UUID> values = new ArrayList<UUID>();
for (String value : (List<String>) obj) {
values.add(UUID.fromString(value));
}
return values;
}
public boolean isBoolean() {
return (obj instanceof Boolean);
}

View File

@ -29,6 +29,16 @@ public final class Util {
}
}
public static boolean isSpigot() {
boolean spigot = false;
try {
if (Class.forName("org.spigotmc.SpigotConfig") != null) {
spigot = true;
}
} catch (ClassNotFoundException e) {}
return spigot;
}
public static boolean isException(Runnable runnable) {
try {
runnable.run();

View File

@ -24,7 +24,7 @@ public class PacketDownloadHostInfo implements PacketIn, PacketOut {
public JSONObject generate() {
JSONObject json = new JSONObject();
json.put("id", id);
if (host != null) json.put("host", host);
json.put("host", host);
return json;
}

View File

@ -7,30 +7,37 @@ import net.ME1312.SubServers.Client.Bukkit.Network.PacketOut;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class PacketDownloadPlayerList implements PacketIn, PacketOut {
private List<JSONCallback> callbacks = new ArrayList<JSONCallback>();
private static HashMap<String, JSONCallback> callbacks = new HashMap<String, JSONCallback>();
private String id;
public PacketDownloadPlayerList() {}
public PacketDownloadPlayerList(String id, JSONCallback callback) {
this.id = id;
callbacks.put(id, callback);
}
@Override
public JSONObject generate() {
return null;
if (id != null) {
JSONObject json = new JSONObject();
json.put("id", id);
return json;
} else {
return null;
}
}
@Override
public void execute(JSONObject data) {
callbacks.get(0).run(data);
callbacks.remove(0);
callbacks.get(data.getString("id")).run(data);
callbacks.remove(data.getString("id"));
}
@Override
public Version getVersion() {
return new Version("2.11.0a");
}
public void callback(String id, JSONCallback callback) {
callbacks.add(callback);
}
}

View File

@ -19,36 +19,36 @@ public class PacketInRunEvent implements PacketIn {
callback("SubAddServerEvent", new JSONCallback() {
@Override
public void run(JSONObject json) {
Bukkit.getPluginManager().callEvent(new SubAddServerEvent(UUID.fromString(json.getString("player")), json.getString("host"), json.getString("server")));
Bukkit.getPluginManager().callEvent(new SubAddServerEvent((json.keySet().contains("player"))?UUID.fromString(json.getString("player")):null, json.getString("host"), json.getString("server")));
callback("SubAddServerEvent", this);
}
});
callback("SubCreateEvent", new JSONCallback() {
@Override
public void run(JSONObject json) {
Bukkit.getPluginManager().callEvent(new SubCreateEvent(UUID.fromString(json.getString("player")), json.getString("host"), json.getString("server"),
PacketCreateServer.ServerType.valueOf(json.getString("").toUpperCase()), new Version(json.getString("version")), json.getInt("memory"), json.getInt("port")));
Bukkit.getPluginManager().callEvent(new SubCreateEvent((json.keySet().contains("player"))?UUID.fromString(json.getString("player")):null, json.getString("host"), json.getString("name"),
PacketCreateServer.ServerType.valueOf(json.getString("type").toUpperCase()), new Version(json.getString("version")), json.getInt("memory"), json.getInt("port")));
callback("SubCreateEvent", this);
}
});
callback("SubSendCommandEvent", new JSONCallback() {
@Override
public void run(JSONObject json) {
Bukkit.getPluginManager().callEvent(new SubSendCommandEvent(UUID.fromString(json.getString("player")), json.getString("server"), json.getString("command")));
Bukkit.getPluginManager().callEvent(new SubSendCommandEvent((json.keySet().contains("player"))?UUID.fromString(json.getString("player")):null, json.getString("server"), json.getString("command")));
callback("SubSendCommandEvent", this);
}
});
callback("SubStartEvent", new JSONCallback() {
@Override
public void run(JSONObject json) {
Bukkit.getPluginManager().callEvent(new SubStartEvent(UUID.fromString(json.getString("player")), json.getString("server")));
Bukkit.getPluginManager().callEvent(new SubStartEvent((json.keySet().contains("player"))?UUID.fromString(json.getString("player")):null, json.getString("server")));
callback("SubStartEvent", this);
}
});
callback("SubStopEvent", new JSONCallback() {
@Override
public void run(JSONObject json) {
Bukkit.getPluginManager().callEvent(new SubStopEvent(UUID.fromString(json.getString("player")), json.getString("server"), json.getBoolean("force")));
Bukkit.getPluginManager().callEvent(new SubStopEvent((json.keySet().contains("player"))?UUID.fromString(json.getString("player")):null, json.getString("server"), json.getBoolean("force")));
callback("SubStopEvent", this);
}
});
@ -62,7 +62,7 @@ public class PacketInRunEvent implements PacketIn {
callback("SubRemoveServerEvent", new JSONCallback() {
@Override
public void run(JSONObject json) {
Bukkit.getPluginManager().callEvent(new SubRemoveServerEvent(UUID.fromString(json.getString("player")), json.getString("host"), json.getString("server")));
Bukkit.getPluginManager().callEvent(new SubRemoveServerEvent((json.keySet().contains("player"))?UUID.fromString(json.getString("player")):null, json.getString("host"), json.getString("server")));
callback("SubRemoveServerEvent", this);
}
});

View File

@ -15,6 +15,7 @@ import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketException;
import java.util.HashMap;
public final class SubDataClient {
@ -106,7 +107,7 @@ public final class SubDataClient {
e1.printStackTrace();
}
} catch (Exception e) {
if (e.getMessage() == null || !e.getMessage().equals("Socket closed")) e.printStackTrace();
if (!(e instanceof SocketException)) e.printStackTrace();
try {
destroy(true);
} catch (IOException e1) {

View File

@ -1,9 +1,19 @@
package net.ME1312.SubServers.Client.Bukkit;
import net.ME1312.SubServers.Client.Bukkit.Graphic.UIRenderer;
import net.ME1312.SubServers.Client.Bukkit.Library.Util;
import net.ME1312.SubServers.Client.Bukkit.Library.Version.Version;
import net.ME1312.SubServers.Client.Bukkit.Network.Packet.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.json.JSONObject;
import java.text.DecimalFormat;
import java.util.*;
public final class SubCommand implements CommandExecutor {
private SubPlugin plugin;
@ -14,7 +24,454 @@ public final class SubCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
plugin.gui.getRenderer((Player) sender).newUI();
return true;
label = "/" + label;
if (plugin.subdata == null) {
new IllegalStateException("SubData is not connected").printStackTrace();
return false;
} else if (plugin.lang == null) {
new IllegalStateException("There are no lang options available at this time").printStackTrace();
return false;
} else {
if (sender.hasPermission("subservers.command")) {
if (args.length > 0) {
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("?")) {
sender.sendMessage(printHelp(label));
} else if (args[0].equalsIgnoreCase("version") || args[0].equalsIgnoreCase("ver")) {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Version", '&').replace("$str$", plugin.version.toString() + ((plugin.bversion != null)?" BETA "+plugin.bversion.toString():"")));
} else if (args[0].equalsIgnoreCase("list")) {
plugin.subdata.sendPacket(new PacketDownloadServerList(null, UUID.randomUUID().toString(), json -> {
int i = 0;
TreeMap<String, JSONObject> servers = new TreeMap<String, JSONObject>();
if (Util.isSpigot() && sender instanceof Player) {
net.md_5.bungee.api.chat.TextComponent hostm = new net.md_5.bungee.api.chat.TextComponent(ChatColor.RESET.toString());
net.md_5.bungee.api.chat.TextComponent serverm = new net.md_5.bungee.api.chat.TextComponent(ChatColor.RESET.toString());
net.md_5.bungee.api.chat.TextComponent div = new net.md_5.bungee.api.chat.TextComponent(plugin.lang.getSection("Lang").getColoredString("Command.List.Divider", '&'));
for (String server : json.getJSONObject("servers").keySet()) {
servers.put(server, json.getJSONObject("servers").getJSONObject(server));
}
for (String host : json.getJSONObject("hosts").keySet()) {
List<net.md_5.bungee.api.chat.TextComponent> hoverm = new LinkedList<net.md_5.bungee.api.chat.TextComponent>();
net.md_5.bungee.api.chat.TextComponent message = new net.md_5.bungee.api.chat.TextComponent(host);
net.md_5.bungee.api.chat.TextComponent hover = new net.md_5.bungee.api.chat.TextComponent(host + '\n');
if (json.getJSONObject("hosts").getJSONObject(host).getBoolean("enabled")) {
message.setColor(net.md_5.bungee.api.ChatColor.AQUA);
hover.setColor(net.md_5.bungee.api.ChatColor.AQUA);
hoverm.add(hover);
hover = new net.md_5.bungee.api.chat.TextComponent(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Host-Server-Count", '&').replace("$int$", new DecimalFormat("#,###").format(json.getJSONObject("hosts").getJSONObject(host).getJSONObject("servers").keySet().size())));
} else {
message.setColor(net.md_5.bungee.api.ChatColor.RED);
hover.setColor(net.md_5.bungee.api.ChatColor.RED);
hoverm.add(hover);
hover = new net.md_5.bungee.api.chat.TextComponent(plugin.lang.getSection("Lang").getColoredString("Interface.Host-Menu.Host-Disabled", '&'));
}
hoverm.add(hover);
if (i != 0) hostm.addExtra(div);
message.setClickEvent(new net.md_5.bungee.api.chat.ClickEvent(net.md_5.bungee.api.chat.ClickEvent.Action.RUN_COMMAND, "/subservers open Host/ " + host));
message.setHoverEvent(new net.md_5.bungee.api.chat.HoverEvent(net.md_5.bungee.api.chat.HoverEvent.Action.SHOW_TEXT, hoverm.toArray(new net.md_5.bungee.api.chat.TextComponent[hoverm.size()])));
hostm.addExtra(message);
i++;
for (String subserver : json.getJSONObject("hosts").getJSONObject(host).getJSONObject("servers").keySet()) {
servers.put(subserver, json.getJSONObject("hosts").getJSONObject(host).getJSONObject("servers").getJSONObject(subserver));
}
}
i = 0;
for (String server : servers.keySet()) {
List<net.md_5.bungee.api.chat.TextComponent> hoverm = new LinkedList<net.md_5.bungee.api.chat.TextComponent>();
net.md_5.bungee.api.chat.TextComponent message = new net.md_5.bungee.api.chat.TextComponent(server);
net.md_5.bungee.api.chat.TextComponent hover = new net.md_5.bungee.api.chat.TextComponent(server + '\n');
if (!servers.get(server).keySet().contains("enabled")) {
message.setColor(net.md_5.bungee.api.ChatColor.WHITE);
hover.setColor(net.md_5.bungee.api.ChatColor.WHITE);
hoverm.add(hover);
hover = new net.md_5.bungee.api.chat.TextComponent(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-External", '&'));
} else {
message.setClickEvent(new net.md_5.bungee.api.chat.ClickEvent(net.md_5.bungee.api.chat.ClickEvent.Action.RUN_COMMAND, "/subservers open SubServer/ " + server));
if (servers.get(server).getBoolean("temp")) {
message.setColor(net.md_5.bungee.api.ChatColor.AQUA);
hover.setColor(net.md_5.bungee.api.ChatColor.AQUA);
hoverm.add(hover);
hover = new net.md_5.bungee.api.chat.TextComponent(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Player-Count", '&').replace("$int$", new DecimalFormat("#,###").format(servers.get(server).getJSONObject("players").keySet().size())) + '\n');
hoverm.add(hover);
hover = new net.md_5.bungee.api.chat.TextComponent(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Temporary", '&'));
} else if (servers.get(server).getBoolean("running")) {
message.setColor(net.md_5.bungee.api.ChatColor.GREEN);
hover.setColor(net.md_5.bungee.api.ChatColor.GREEN);
hoverm.add(hover);
hover = new net.md_5.bungee.api.chat.TextComponent(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Player-Count", '&').replace("$int$", new DecimalFormat("#,###").format(servers.get(server).getJSONObject("players").keySet().size())));
} else if (servers.get(server).getBoolean("enabled")) {
message.setColor(net.md_5.bungee.api.ChatColor.YELLOW);
hover.setColor(net.md_5.bungee.api.ChatColor.YELLOW);
hoverm.add(hover);
hover = new net.md_5.bungee.api.chat.TextComponent(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Offline", '&'));
} else {
message.setColor(net.md_5.bungee.api.ChatColor.RED);
hover.setColor(net.md_5.bungee.api.ChatColor.RED);
hoverm.add(hover);
hover = new net.md_5.bungee.api.chat.TextComponent(plugin.lang.getSection("Lang").getColoredString("Interface.SubServer-Menu.SubServer-Disabled", '&'));
}
}
hoverm.add(hover);
if (i != 0) serverm.addExtra(div);
message.setHoverEvent(new net.md_5.bungee.api.chat.HoverEvent(net.md_5.bungee.api.chat.HoverEvent.Action.SHOW_TEXT, hoverm.toArray(new net.md_5.bungee.api.chat.TextComponent[hoverm.size()])));
serverm.addExtra(message);
i++;
}
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.List.Host-Header", '&'));
((Player) sender).spigot().sendMessage(hostm);
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.List.Server-Header", '&'));
((Player) sender).spigot().sendMessage(serverm);
} else {
String hostm = "";
String serverm = "";
String div = plugin.lang.getSection("Lang").getColoredString("Command.List.Divider", '&');
for (String server : json.getJSONObject("servers").keySet()) {
servers.put(server, json.getJSONObject("servers").getJSONObject(server));
}
for (String host : json.getJSONObject("hosts").keySet()) {
if (i != 0) hostm += div;
if (json.getJSONObject("hosts").getJSONObject(host).getBoolean("enabled")) {
hostm += ChatColor.AQUA + host;
} else {
hostm += ChatColor.RED + host;
}
i++;
for (String subserver : json.getJSONObject("hosts").getJSONObject(host).getJSONObject("servers").keySet()) {
servers.put(subserver, json.getJSONObject("hosts").getJSONObject(host).getJSONObject("servers").getJSONObject(subserver));
}
}
i = 0;
for (String server : servers.keySet()) {
if (i != 0) serverm += div;
if (!servers.get(server).keySet().contains("enabled")) {
serverm += ChatColor.WHITE + server;
} else if (servers.get(server).getBoolean("temp")) {
serverm += ChatColor.AQUA + server;
} else if (servers.get(server).getBoolean("running")) {
serverm += ChatColor.GREEN + server;
} else if (servers.get(server).getBoolean("enabled")) {
serverm += ChatColor.YELLOW + server;
} else {
serverm += ChatColor.RED + server;
}
i++;
}
sender.sendMessage(new String[]{plugin.lang.getSection("Lang").getColoredString("Command.List.Host-Header", '&'), hostm, plugin.lang.getSection("Lang").getColoredString("Command.List.Server-Header", '&'), serverm});
}
}));
} else if (args[0].equalsIgnoreCase("start")) {
if (sender.hasPermission("subservers.subserver.start.*") || sender.hasPermission("subservers.subserver.start." + args[1].toLowerCase())) {
if (args.length > 1) {
plugin.subdata.sendPacket(new PacketStartServer((sender instanceof Player)?((Player) sender).getUniqueId():null, args[1], UUID.randomUUID().toString(), json -> {
switch (json.getInt("r")) {
case 3:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Start.Unknown", '&'));
break;
case 4:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Start.Invalid", '&'));
break;
case 5:
if (json.getString("m").contains("Host")) {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Start.Host-Disabled", '&'));
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Start.Server-Disabled", '&'));
}
break;
case 6:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Start.Running", '&'));
break;
case 0:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Start", '&'));
break;
default:
Bukkit.getLogger().warning("SubData > PacketStartServer(" + ((sender instanceof Player)?((Player) sender).getUniqueId().toString():"null") + ", " + args[1] + ") responded with: " + json.getString("m"));
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Start", '&'));
break;
}
}));
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Usage", '&').replace("$str$", label.toLowerCase() + " " + args[0].toLowerCase() + " <SubServer>"));
}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Permission", '&').replace("$str$", "subservers.subserver.start." + args[1].toLowerCase()));
}
} else if (args[0].equalsIgnoreCase("stop")) {
if (sender.hasPermission("subservers.subserver.stop.*") || sender.hasPermission("subservers.subserver.stop." + args[1].toLowerCase())) {
if (args.length > 1) {
plugin.subdata.sendPacket(new PacketStopServer((sender instanceof Player)?((Player) sender).getUniqueId():null, args[1], false, UUID.randomUUID().toString(), json -> {
switch (json.getInt("r")) {
case 3:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Stop.Unknown", '&'));
break;
case 4:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Stop.Invalid", '&'));
break;
case 5:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Stop.Not-Running", '&'));
break;
case 0:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Stop", '&'));
break;
default:
Bukkit.getLogger().warning("SubData > PacketStopServer(" + ((sender instanceof Player)?((Player) sender).getUniqueId().toString():"null") + ", " + args[1] + ", false) responded with: " + json.getString("m"));
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Stop", '&'));
break;
}
}));
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Usage", '&').replace("$str$", label.toLowerCase() + " " + args[0].toLowerCase() + " <SubServer>"));
}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Permission", '&').replace("$str$", "subservers.subserver.stop." + args[1].toLowerCase()));
}
} else if (args[0].equalsIgnoreCase("kill") || args[0].equalsIgnoreCase("terminate")) {
if (sender.hasPermission("subservers.subserver.terminate.*") || sender.hasPermission("subservers.subserver.terminate." + args[1].toLowerCase())) {
if (args.length > 1) {
plugin.subdata.sendPacket(new PacketStopServer((sender instanceof Player)?((Player) sender).getUniqueId():null, args[1], true, UUID.randomUUID().toString(), json -> {
switch (json.getInt("r")) {
case 3:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Terminate.Unknown", '&'));
break;
case 4:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Terminate.Invalid", '&'));
break;
case 5:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Terminate.Not-Running", '&'));
break;
case 0:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Terminate", '&'));
break;
default:
Bukkit.getLogger().warning("SubData > PacketStopServer(" + ((sender instanceof Player)?((Player) sender).getUniqueId().toString():"null") + ", " + args[1] + ", true) responded with: " + json.getString("m"));
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Terminate", '&'));
break;
}
}));
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Usage", '&').replace("$str$", label.toLowerCase() + " " + args[0].toLowerCase() + " <SubServer>"));
}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Permission", '&').replace("$str$", "subservers.subserver.terminate." + args[1].toLowerCase()));
}
} else if (args[0].equalsIgnoreCase("cmd") || args[0].equalsIgnoreCase("command")) {
if (sender.hasPermission("subservers.subserver.command.*") || sender.hasPermission("subservers.subserver.command." + args[1].toLowerCase())) {
if (args.length > 2) {
int i = 2;
String str = args[2];
if (args.length > 3) {
do {
i++;
str = str + " " + args[i];
} while ((i + 1) != args.length);
}
final String cmd = str;
plugin.subdata.sendPacket(new PacketCommandServer((sender instanceof Player)?((Player) sender).getUniqueId():null, args[1], cmd, UUID.randomUUID().toString(), json -> {
switch (json.getInt("r")) {
case 3:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Command.Unknown", '&'));
break;
case 4:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Command.Invalid", '&'));
break;
case 5:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Command.Not-Running", '&'));
break;
case 0:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Command", '&'));
break;
default:
Bukkit.getLogger().warning("SubData > PacketCommandServer(" + ((sender instanceof Player)?((Player) sender).getUniqueId().toString():"null") + ", " + args[1] + ", /" + cmd + ") responded with: " + json.getString("m"));
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Command", '&'));
break;
}
}));
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Usage", '&').replace("$str$", label.toLowerCase() + " " + args[0].toLowerCase() + " <SubServer> <Command> [Args...]"));
}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Permission", '&').replace("$str$", "subservers.subserver.command." + args[1].toLowerCase()));
}
} else if (args[0].equalsIgnoreCase("create")) {
if (sender.hasPermission("subservers.host.create.*") || sender.hasPermission("subservers.host.create." + args[2].toLowerCase())) {
if (args.length > 5) {
if (Util.isException(() -> PacketCreateServer.ServerType.valueOf(args[3].toUpperCase()))) {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator.Invalid-Type", '&'));
} else if (Util.isException(() -> Integer.parseInt(args[5]))) {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator.Invalid-Port", '&'));
} else if (args.length > 6 && Util.isException(() -> Integer.parseInt(args[6]))) {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator.Invalid-Memory", '&'));
} else {
plugin.subdata.sendPacket(new PacketCreateServer((sender instanceof Player)?((Player) sender).getUniqueId():null, args[1], args[2], PacketCreateServer.ServerType.valueOf(args[3].toUpperCase()), new Version(args[4]), Integer.parseInt(args[5]), (args.length > 6)?Integer.parseInt(args[6]):1024, UUID.randomUUID().toString(), json -> {
switch (json.getInt("r")) {
case 3:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator.Exists", '&'));
break;
case 4:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator.Unknown-Host", '&'));
break;
case 5:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator.Running", '&'));
break;
case 6:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator.Invalid-Type", '&'));
break;
case 7:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator.Invalid-Version", '&'));
break;
case 8:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator.Invalid-Port", '&'));
break;
case 9:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator.Invalid-Memory", '&'));
break;
case 0:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator", '&'));
break;
default:
Bukkit.getLogger().warning("SubData > PacketCreateServer(" + ((sender instanceof Player)?((Player) sender).getUniqueId().toString():"null") + ", " + args[1] + ", " + args[2] + ", " + args[3].toUpperCase() + ", " + args[4] + ", " + args[5] + ", " + ((args.length > 6)?args[6]:"1024") + ") responded with: " + json.getString("m"));
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Creator", '&'));
break;
}
}));
}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Usage", '&').replace("$str$", label.toLowerCase() + " " + args[0].toLowerCase() + " <Name> <Host> <Type> <Version> <Port> [RAM]"));
}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Permission", '&').replace("$str$", "subservers.host.create." + args[2].toLowerCase()));
}
} else if ((args[0].equalsIgnoreCase("view") || args[0].equalsIgnoreCase("open")) && sender instanceof Player) {
if (sender.hasPermission("subservers.interface")) {
try {
plugin.gui.getRenderer((Player) sender).clearHistory();
switch (args[1].toLowerCase()) {
case "host":
if (args.length > 2) plugin.gui.getRenderer((Player) sender).hostMenu(Integer.parseInt(args[2]));
else plugin.gui.getRenderer((Player) sender).hostMenu(1);
break;
case "host/":
plugin.gui.getRenderer((Player) sender).hostAdmin(args[2]);
break;
case "host/creator":
if (sender.hasPermission("subservers.host.create.*") || sender.hasPermission("subservers.host.create." + args[2].toLowerCase())) plugin.gui.getRenderer((Player) sender).hostCreator(new UIRenderer.CreatorOptions(args[2]));
break;
case "host/editor":
if (sender.hasPermission("subservers.host.edit.*") || sender.hasPermission("subservers.host.edit." + args[2].toLowerCase())) plugin.gui.getRenderer((Player) sender).hostEditor(new UIRenderer.HostEditorOptions(args[2]));
break;
case "subserver":
if (args.length > 3) plugin.gui.getRenderer((Player) sender).subserverMenu(Integer.parseInt(args[2]), args[3]);
else if (args.length > 2) plugin.gui.getRenderer((Player) sender).subserverMenu(Integer.parseInt(args[2]), null);
else plugin.gui.getRenderer((Player) sender).subserverMenu(1, null);
break;
case "subserver/":
plugin.gui.getRenderer((Player) sender).subserverAdmin(args[2]);
break;
case "subserver/editor":
if (sender.hasPermission("subservers.subserver.edit.*") || sender.hasPermission("subservers.subserver.edit." + args[2].toLowerCase())) plugin.gui.getRenderer((Player) sender).subserverEditor(new UIRenderer.SubServerEditorOptions(args[2]));
break;
}
} catch (Throwable e) {}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Permission", '&').replace("$str$", "subservers.interface"));
}
} else if (args[0].equalsIgnoreCase("tp") || args[0].equalsIgnoreCase("teleport")) {
if (args.length > 2) {
if (sender.hasPermission("subservers.server.teleport.*") || sender.hasPermission("subservers.server.teleport." + args[1].toLowerCase())) {
if (sender.hasPermission("subservers.server.teleport-others")) {
plugin.subdata.sendPacket(new PacketDownloadPlayerList(UUID.randomUUID().toString(), players -> {
UUID uuid = null;
for (String id : players.getJSONObject("players").keySet()) {
if (players.getJSONObject("players").getJSONObject(id).getString("name").equalsIgnoreCase(args[2]))
uuid = UUID.fromString(id);
}
if (uuid == null) {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Teleport.Offline", '&'));
} else {
final UUID player = uuid;
plugin.subdata.sendPacket(new PacketTeleportPlayer(player, args[1], UUID.randomUUID().toString(), json -> {
switch (json.getInt("r")) {
case 2:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Teleport.Invalid", '&'));
break;
case 3:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Teleport.Offline", '&'));
break;
case 0:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Teleport", '&'));
break;
default:
Bukkit.getLogger().warning("SubData > PacketTeleportPlayer(" + player.toString() + ", " + args[1] + ") responded with: " + json.getString("m"));
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Teleport", '&'));
}
}));
}
}));
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Permission", '&').replace("$str$", "subservers.server.teleport-others"));
}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Permission", '&').replace("$str$", "subservers.server.teleport." + args[1].toLowerCase()));
}
} else if (args.length > 1) {
if (sender.hasPermission("subservers.server.teleport.*") || sender.hasPermission("subservers.server.teleport." + args[1].toLowerCase())) {
if (sender instanceof Player) {
plugin.subdata.sendPacket(new PacketTeleportPlayer(((Player) sender).getUniqueId(), args[1], UUID.randomUUID().toString(), json -> {
switch (json.getInt("r")) {
case 2:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Teleport.Invalid", '&'));
break;
case 3:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Teleport.Offline", '&'));
break;
case 0:
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Teleport", '&'));
break;
default:
Bukkit.getLogger().warning("SubData > PacketTeleportPlayer(" + ((Player) sender).getUniqueId().toString() + ", " + args[1] + ") responded with: " + json.getString("m"));
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Teleport", '&'));
}
}));
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Player-Only", '&'));
}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Permission", '&').replace("$str$", "subservers.server.teleport." + args[1].toLowerCase()));
}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Usage", '&').replace("$str$", label.toLowerCase() + " " + args[0].toLowerCase() + " <Server> [Player]"));
}
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Subcommand", '&').replace("$str$", args[0]));
}
} else {
if (sender.hasPermission("subservers.interface") && sender instanceof Player) {
plugin.gui.getRenderer((Player) sender).newUI();
} else {
sender.sendMessage(printHelp(label));
}
}
} else if (sender.hasPermission("subservers.interface") && sender instanceof Player) {
plugin.gui.getRenderer((Player) sender).newUI();
} else {
sender.sendMessage(plugin.lang.getSection("Lang").getColoredString("Command.Generic.Invalid-Permission", '&').replace("$str$", "subservers.command"));
}
return true;
}
}
private String[] printHelp(String label) {
return new String[]{
plugin.lang.getSection("Lang").getColoredString("Command.Help.Header", '&'),
plugin.lang.getSection("Lang").getColoredString("Command.Help.Help", '&').replace("$str$", label.toLowerCase() + " help"),
plugin.lang.getSection("Lang").getColoredString("Command.Help.List", '&').replace("$str$", label.toLowerCase() + " list"),
plugin.lang.getSection("Lang").getColoredString("Command.Help.Version", '&').replace("$str$", label.toLowerCase() + " version"),
plugin.lang.getSection("Lang").getColoredString("Command.Help.SubServer.Start", '&').replace("$str$", label.toLowerCase() + " start <SubServer>"),
plugin.lang.getSection("Lang").getColoredString("Command.Help.SubServer.Stop", '&').replace("$str$", label.toLowerCase() + " stop <SubServer>"),
plugin.lang.getSection("Lang").getColoredString("Command.Help.SubServer.Terminate", '&').replace("$str$", label.toLowerCase() + " kill <SubServer>"),
plugin.lang.getSection("Lang").getColoredString("Command.Help.SubServer.Command", '&').replace("$str$", label.toLowerCase() + " cmd <SubServer> <Command> [Args...]"),
plugin.lang.getSection("Lang").getColoredString("Command.Help.Server.Teleport", '&').replace("$str$", label.toLowerCase() + " tp <Server> [Player]"),
plugin.lang.getSection("Lang").getColoredString("Command.Help.Host.Create", '&').replace("$str$", label.toLowerCase() + " create <Name> <Host> <Type> <Version> <Port> [RAM]"),
};
}
}

View File

@ -20,13 +20,14 @@ public final class SubPlugin extends JavaPlugin {
public SubDataClient subdata = null;
public UIListener gui = null;
public final Version version = new Version("2.11.0a");
protected Version bversion = new Version(3);
public Version version;
protected Version bversion = new Version(4);
//public final SubAPI api = new SubAPI(this);
@Override
public void onEnable() {
version = new Version(getDescription().getVersion());
try {
Bukkit.getLogger().info("SubServers > Loading SubServers v" + version.toString() + " Libraries... ");
getDataFolder().mkdirs();
@ -47,7 +48,8 @@ public final class SubPlugin extends JavaPlugin {
gui = new UIListener(this);
getCommand("subservers").setExecutor(new SubCommand(this));
getCommand("subservers").setAliases(Arrays.asList("sub", "subserver"));
getCommand("subserver").setExecutor(new SubCommand(this));
getCommand("sub").setExecutor(new SubCommand(this));
} catch (IOException e) {
setEnabled(false);
e.printStackTrace();
@ -56,11 +58,12 @@ public final class SubPlugin extends JavaPlugin {
@Override
public void onDisable() {
try {
subdata.destroy(false);
} catch (IOException e) {
e.printStackTrace();
}
if (subdata != null)
try {
subdata.destroy(false);
} catch (IOException e) {
e.printStackTrace();
}
}
private void copyFromJar(String resource, String destination) {

View File

@ -1,6 +1,6 @@
name: 'SubServers'
main: 'net.ME1312.SubServers.Client.Bukkit.SubPlugin'
version: '2.11.0a'
version: '2.11.2a'
authors: [ME1312]
softdepend: [TitleManager]
website: 'http://www.ME1312.net/'
@ -8,15 +8,21 @@ commands:
subservers:
description: 'The SubServers Command'
usage: /subservers help
subserver:
description: 'The SubServers Command'
usage: /subserver help
sub:
description: 'The SubServers Command'
usage: /sub help
permissions:
subservers.*:
description: 'Grants Access to to Everything in SubServers.Client'
default: op
children:
subserver.interface:
subservers.interface:
description: 'Grants Access to the SubServers Interface'
default: op
subserver.command:
subservers.command:
description: 'Grants Access to the SubServers Command'
default: op
subservers.reload:
@ -33,7 +39,7 @@ permissions:
description: 'Grants Access to Edit a Host'
default: op
subservers.subserver.*:
description: 'Grants Access to SubServers Server Actions'
description: 'Grants Access to SubServers SubServer Actions'
default: op
children:
subservers.subserver.start.*:
@ -51,6 +57,13 @@ permissions:
subservers.subserver.edit.*:
description: 'Grants Access to Edit a SubServer'
default: op
subservers.subserver.teleport.*:
description: 'Grants Acces to Teleport to a SubServer'
subservers.server.*:
description: 'Grants Access to SubServer Server Actions'
default: op
children:
subservers.server.teleport-others:
description: 'Grants Acces to Teleport Others to a Server'
default: op
subservers.server.teleport.*:
description: 'Grants Acces to Teleport to a Server'
default: op