2016-12-24 05:55:17 +01:00
|
|
|
package net.ME1312.SubServers.Bungee;
|
2016-12-05 04:21:04 +01:00
|
|
|
|
2017-08-22 15:02:23 +02:00
|
|
|
import net.ME1312.SubServers.Bungee.Event.SubAddHostEvent;
|
2016-12-24 05:55:17 +01:00
|
|
|
import net.ME1312.SubServers.Bungee.Event.SubAddServerEvent;
|
2017-08-22 15:02:23 +02:00
|
|
|
import net.ME1312.SubServers.Bungee.Event.SubRemoveHostEvent;
|
|
|
|
import net.ME1312.SubServers.Bungee.Event.SubRemoveServerEvent;
|
2016-12-24 05:55:17 +01:00
|
|
|
import net.ME1312.SubServers.Bungee.Host.Server;
|
|
|
|
import net.ME1312.SubServers.Bungee.Host.Host;
|
2017-08-27 20:37:25 +02:00
|
|
|
import net.ME1312.SubServers.Bungee.Host.ServerContainer;
|
2016-12-24 05:55:17 +01:00
|
|
|
import net.ME1312.SubServers.Bungee.Host.SubServer;
|
2017-08-22 15:02:23 +02:00
|
|
|
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidHostException;
|
2017-01-26 23:19:48 +01:00
|
|
|
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
|
2016-12-24 05:55:17 +01:00
|
|
|
import net.ME1312.SubServers.Bungee.Library.UniversalFile;
|
2017-01-30 21:22:36 +01:00
|
|
|
import net.ME1312.SubServers.Bungee.Library.Util;
|
2016-12-24 05:55:17 +01:00
|
|
|
import net.ME1312.SubServers.Bungee.Library.Version.Version;
|
|
|
|
import net.ME1312.SubServers.Bungee.Network.SubDataServer;
|
2016-12-05 04:21:04 +01:00
|
|
|
|
2017-08-22 15:02:23 +02:00
|
|
|
import java.lang.reflect.InvocationTargetException;
|
2016-12-15 22:04:39 +01:00
|
|
|
import java.net.InetAddress;
|
|
|
|
import java.net.InetSocketAddress;
|
2017-01-26 23:19:48 +01:00
|
|
|
import java.util.*;
|
2016-12-05 04:21:04 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SubAPI Class
|
|
|
|
*/
|
|
|
|
public final class SubAPI {
|
2017-01-26 23:19:48 +01:00
|
|
|
LinkedList<NamedContainer<Runnable, Runnable>> listeners = new LinkedList<NamedContainer<Runnable, Runnable>>();
|
2017-12-06 23:34:47 +01:00
|
|
|
boolean ready = false;
|
2016-12-05 04:21:04 +01:00
|
|
|
private SubPlugin plugin;
|
|
|
|
private static SubAPI api;
|
|
|
|
|
2017-12-06 23:34:47 +01:00
|
|
|
|
2016-12-05 04:21:04 +01:00
|
|
|
protected SubAPI(SubPlugin plugin) {
|
|
|
|
this.plugin = plugin;
|
|
|
|
api = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the SubAPI Methods
|
|
|
|
*
|
|
|
|
* @return SubAPI
|
|
|
|
*/
|
|
|
|
public static SubAPI getInstance() {
|
|
|
|
return api;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the SubServers Internals
|
|
|
|
*
|
|
|
|
* @deprecated Use SubAPI Methods when available
|
|
|
|
* @return SubPlugin Internals
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public SubPlugin getInternals() {
|
|
|
|
return plugin;
|
|
|
|
}
|
|
|
|
|
2017-01-26 23:19:48 +01:00
|
|
|
/**
|
|
|
|
* Adds a SubAPI Listener
|
|
|
|
*
|
|
|
|
* @param enable An Event that will be called when SubAPI is ready
|
|
|
|
* @param disable An Event that will be called before SubAPI is disabled
|
|
|
|
*/
|
|
|
|
public void addListener(Runnable enable, Runnable disable) {
|
|
|
|
listeners.add(new NamedContainer<Runnable, Runnable>(enable, disable));
|
|
|
|
}
|
|
|
|
|
2016-12-05 04:21:04 +01:00
|
|
|
/**
|
|
|
|
* Gets the SubData Network Manager
|
|
|
|
*
|
|
|
|
* @return SubData Network Manager
|
|
|
|
*/
|
2016-12-15 22:04:39 +01:00
|
|
|
public SubDataServer getSubDataNetwork() {
|
2016-12-05 04:21:04 +01:00
|
|
|
return plugin.subdata;
|
|
|
|
}
|
|
|
|
|
2017-08-22 15:02:23 +02:00
|
|
|
/**
|
|
|
|
* Get a list of all available Host Drivers
|
|
|
|
*
|
|
|
|
* @return Host Driver handle list
|
|
|
|
*/
|
|
|
|
public List<String> getHostDrivers() {
|
|
|
|
return new LinkedList<String>(plugin.hostDrivers.keySet());
|
|
|
|
}
|
|
|
|
|
2016-12-05 04:21:04 +01:00
|
|
|
/**
|
|
|
|
* Adds a Driver for Hosts
|
|
|
|
*
|
|
|
|
* @param driver Driver to add
|
|
|
|
* @param handle Handle to Bind
|
|
|
|
*/
|
|
|
|
public void addHostDriver(Class<? extends Host> driver, String handle) {
|
2017-01-30 21:22:36 +01:00
|
|
|
if (Util.isNull(driver, handle)) throw new NullPointerException();
|
2016-12-05 04:21:04 +01:00
|
|
|
if (plugin.hostDrivers.keySet().contains(handle.toLowerCase())) throw new IllegalStateException("Driver already exists: " + handle);
|
2017-08-22 15:02:23 +02:00
|
|
|
plugin.hostDrivers.put(handle.toLowerCase(), driver);
|
2016-12-05 04:21:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the Hosts
|
|
|
|
*
|
|
|
|
* @return Host Map
|
|
|
|
*/
|
|
|
|
public Map<String, Host> getHosts() {
|
|
|
|
return new TreeMap<>(plugin.hosts);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a Host
|
|
|
|
*
|
|
|
|
* @param name Host name
|
|
|
|
* @return a Host
|
|
|
|
*/
|
|
|
|
public Host getHost(String name) {
|
2017-01-30 21:22:36 +01:00
|
|
|
if (Util.isNull(name)) throw new NullPointerException();
|
2016-12-05 04:21:04 +01:00
|
|
|
return getHosts().get(name.toLowerCase());
|
|
|
|
}
|
|
|
|
|
2017-08-22 15:02:23 +02:00
|
|
|
/**
|
|
|
|
* Add a Host to the Network
|
|
|
|
*
|
|
|
|
* @param driver Driver to initiate
|
|
|
|
* @param name Name of the Host
|
|
|
|
* @param enabled Enabled Status
|
|
|
|
* @param address Address of the Host
|
|
|
|
* @param directory Directory of the Host
|
|
|
|
* @param gitBash Git Bash Directory
|
|
|
|
* @return The Host
|
|
|
|
* @throws NoSuchMethodException
|
|
|
|
* @throws IllegalAccessException
|
|
|
|
* @throws InvocationTargetException
|
|
|
|
* @throws InstantiationException
|
|
|
|
*/
|
|
|
|
public Host addHost(String driver, String name, boolean enabled, InetAddress address, String directory, String gitBash) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
|
|
|
|
return addHost(null, driver, name, enabled, address, directory, gitBash);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a Host to the Network
|
|
|
|
*
|
|
|
|
* @param player Player who added
|
|
|
|
* @param driver Driver to initiate
|
|
|
|
* @param name Name of the Host
|
|
|
|
* @param enabled Enabled Status
|
|
|
|
* @param address Address of the Host
|
|
|
|
* @param directory Directory of the Host
|
|
|
|
* @param gitBash Git Bash Directory
|
|
|
|
* @return The Host
|
|
|
|
* @throws NoSuchMethodException
|
|
|
|
* @throws IllegalAccessException
|
|
|
|
* @throws InvocationTargetException
|
|
|
|
* @throws InstantiationException
|
|
|
|
*/
|
|
|
|
public Host addHost(UUID player, String driver, String name, boolean enabled, InetAddress address, String directory, String gitBash) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
|
|
|
|
if (Util.isNull(driver, name, enabled, address, directory, gitBash)) throw new NullPointerException();
|
|
|
|
if (!getHostDrivers().contains(driver)) throw new InvalidHostException("Invalid Driver for host: " + name);
|
|
|
|
Host host = plugin.hostDrivers.get(driver.toLowerCase()).getConstructor(SubPlugin.class, String.class, Boolean.class, InetAddress.class, String.class, String.class).newInstance(plugin, name, (Boolean) enabled, address, directory, gitBash);
|
|
|
|
SubAddHostEvent event = new SubAddHostEvent(player, host);
|
|
|
|
plugin.getPluginManager().callEvent(event);
|
|
|
|
if (!event.isCancelled()) {
|
|
|
|
plugin.hosts.put(name.toLowerCase(), host);
|
|
|
|
return host;
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a Host from the Network
|
|
|
|
*
|
|
|
|
* @param name Name of the Host
|
|
|
|
* @return Success Status
|
|
|
|
*/
|
|
|
|
public boolean removeHost(String name) {
|
|
|
|
return removeHost(null, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a Host from the Network
|
|
|
|
*
|
|
|
|
* @param player Player Removing
|
|
|
|
* @param name Name of the Host
|
|
|
|
* @return Success Status
|
|
|
|
*/
|
|
|
|
public boolean removeHost(UUID player, String name) {
|
|
|
|
if (Util.isNull(name, getHost(name))) throw new NullPointerException();
|
|
|
|
SubRemoveHostEvent event = new SubRemoveHostEvent(player, getHost(name));
|
|
|
|
plugin.getPluginManager().callEvent(event);
|
|
|
|
if (event.isCancelled()) {
|
2017-12-09 09:43:29 +01:00
|
|
|
try {
|
|
|
|
List<String> subservers = new ArrayList<String>();
|
|
|
|
subservers.addAll(getHost(name).getSubServers().keySet());
|
|
|
|
|
|
|
|
for (String server : subservers) {
|
|
|
|
getHost(name).removeSubServer(server);
|
|
|
|
}
|
|
|
|
subservers.clear();
|
|
|
|
getHost(name).getCreator().terminate();
|
|
|
|
getHost(name).getCreator().waitFor();
|
|
|
|
plugin.hosts.remove(name.toLowerCase());
|
|
|
|
return true;
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
return false;
|
|
|
|
}
|
2017-08-22 15:02:23 +02:00
|
|
|
} else return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Force Remove a Host from the Network
|
|
|
|
*
|
|
|
|
* @param name Name of the Host
|
|
|
|
* @return Success Status
|
|
|
|
*/
|
|
|
|
public boolean forceRemoveHost(String name) {
|
|
|
|
return forceRemoveHost(null, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Force Remove a Host from the Network
|
|
|
|
*
|
|
|
|
* @param player Player Removing
|
|
|
|
* @param name Name of the Host
|
|
|
|
* @return Success Status
|
|
|
|
*/
|
|
|
|
public boolean forceRemoveHost(UUID player, String name) {
|
|
|
|
if (Util.isNull(name, getHost(name))) throw new NullPointerException();
|
|
|
|
SubRemoveHostEvent event = new SubRemoveHostEvent(player, getHost(name));
|
|
|
|
plugin.getPluginManager().callEvent(event);
|
2017-12-09 09:43:29 +01:00
|
|
|
try {
|
|
|
|
List<String> subservers = new ArrayList<String>();
|
|
|
|
subservers.addAll(getHost(name).getSubServers().keySet());
|
|
|
|
|
|
|
|
for (String server : subservers) {
|
|
|
|
getHost(name).removeSubServer(server);
|
|
|
|
}
|
|
|
|
subservers.clear();
|
|
|
|
getHost(name).getCreator().terminate();
|
|
|
|
getHost(name).getCreator().waitFor();
|
|
|
|
plugin.hosts.remove(name.toLowerCase());
|
|
|
|
return true;
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
return false;
|
|
|
|
}
|
2017-08-22 15:02:23 +02:00
|
|
|
}
|
|
|
|
|
2017-08-26 07:19:59 +02:00
|
|
|
/**
|
2017-12-06 23:34:47 +01:00
|
|
|
* Gets the Server Groups (Group names are case sensitive here)
|
2017-08-26 07:19:59 +02:00
|
|
|
*
|
|
|
|
* @return Group Map
|
|
|
|
*/
|
|
|
|
public Map<String, List<Server>> getGroups() {
|
2017-12-06 23:34:47 +01:00
|
|
|
TreeMap<String, List<Server>> groups = new TreeMap<String, List<Server>>();
|
|
|
|
HashMap<String, String> conflitresolver = new HashMap<String, String>();
|
|
|
|
for (Server server : getServers().values()) {
|
|
|
|
for (String name : server.getGroups()) {
|
|
|
|
String group = name;
|
|
|
|
if (conflitresolver.keySet().contains(name.toLowerCase())) {
|
|
|
|
group = conflitresolver.get(name.toLowerCase());
|
|
|
|
} else {
|
|
|
|
conflitresolver.put(name.toLowerCase(), name);
|
|
|
|
}
|
|
|
|
List<Server> list = (groups.keySet().contains(group))?groups.get(group):new ArrayList<Server>();
|
|
|
|
list.add(server);
|
|
|
|
groups.put(group, list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return groups;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the Server Groups (Group names are all lowercase here)
|
|
|
|
*
|
|
|
|
* @return Group Map
|
|
|
|
*/
|
|
|
|
public Map<String, List<Server>> getLowercaseGroups() {
|
|
|
|
Map<String, List<Server>> groups = getGroups();
|
|
|
|
TreeMap<String, List<Server>> lowercaseGroups = new TreeMap<String, List<Server>>();
|
|
|
|
for (String key : groups.keySet()) {
|
|
|
|
lowercaseGroups.put(key.toLowerCase(), groups.get(key));
|
|
|
|
}
|
|
|
|
return lowercaseGroups;
|
2017-08-26 07:19:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-12-06 23:34:47 +01:00
|
|
|
* Gets a Server Group (Group names are case insensitive here)
|
2017-08-26 07:19:59 +02:00
|
|
|
*
|
|
|
|
* @param name Group name
|
|
|
|
* @return a Server Group
|
|
|
|
*/
|
|
|
|
public List<Server> getGroup(String name) {
|
2017-12-09 09:43:29 +01:00
|
|
|
if (Util.isNull(name)) throw new NullPointerException();
|
|
|
|
return Util.getCaseInsensitively(getGroups(), name);
|
2017-08-26 07:19:59 +02:00
|
|
|
}
|
|
|
|
|
2016-12-05 04:21:04 +01:00
|
|
|
/**
|
|
|
|
* Gets the Servers (including SubServers)
|
|
|
|
*
|
|
|
|
* @return Server Map
|
|
|
|
*/
|
|
|
|
public Map<String, Server> getServers() {
|
|
|
|
TreeMap<String, Server> servers = new TreeMap<String, Server>();
|
|
|
|
servers.putAll(plugin.exServers);
|
|
|
|
for (Host host : plugin.hosts.values()) {
|
|
|
|
servers.putAll(host.getSubServers());
|
|
|
|
}
|
|
|
|
return servers;
|
|
|
|
}
|
|
|
|
|
2017-08-22 15:02:23 +02:00
|
|
|
/**
|
|
|
|
* Gets a Server
|
|
|
|
*
|
|
|
|
* @param name Server name
|
|
|
|
* @return a Server
|
|
|
|
*/
|
|
|
|
public Server getServer(String name) {
|
|
|
|
if (Util.isNull(name)) throw new NullPointerException();
|
|
|
|
return getServers().get(name.toLowerCase());
|
|
|
|
}
|
|
|
|
|
2016-12-15 22:04:39 +01:00
|
|
|
/**
|
|
|
|
* Adds a Server to the Network
|
|
|
|
*
|
|
|
|
* @param name Name of the Server
|
|
|
|
* @param ip IP of the Server
|
|
|
|
* @param port Port of the Server
|
|
|
|
* @param motd MOTD of the Server
|
2016-12-19 01:38:02 +01:00
|
|
|
* @param hidden if the server should be hidden from players
|
2016-12-15 22:04:39 +01:00
|
|
|
* @param restricted Players will need a permission to join if true
|
|
|
|
* @return The Server
|
|
|
|
*/
|
2016-12-19 01:38:02 +01:00
|
|
|
public Server addServer(String name, InetAddress ip, int port, String motd, boolean hidden, boolean restricted) {
|
|
|
|
return addServer(null, name, ip, port, motd, hidden, restricted);
|
2016-12-15 22:04:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a Server to the Network
|
|
|
|
*
|
|
|
|
* @param player Player who added
|
|
|
|
* @param name Name of the Server
|
|
|
|
* @param ip IP of the Server
|
|
|
|
* @param port Port of the Server
|
|
|
|
* @param motd MOTD of the Server
|
2016-12-19 01:38:02 +01:00
|
|
|
* @param hidden If the server should be hidden from players
|
2016-12-15 22:04:39 +01:00
|
|
|
* @param restricted Players will need a permission to join if true
|
|
|
|
* @return The Server
|
|
|
|
*/
|
2016-12-19 01:38:02 +01:00
|
|
|
public Server addServer(UUID player, String name, InetAddress ip, int port, String motd, boolean hidden, boolean restricted) {
|
2017-08-27 20:37:25 +02:00
|
|
|
Server server = new ServerContainer(name, new InetSocketAddress(ip, port), motd, hidden, restricted);
|
2016-12-15 22:04:39 +01:00
|
|
|
SubAddServerEvent event = new SubAddServerEvent(player, null, server);
|
|
|
|
plugin.getPluginManager().callEvent(event);
|
|
|
|
if (!event.isCancelled()) {
|
|
|
|
plugin.exServers.put(name.toLowerCase(), server);
|
|
|
|
return server;
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-05 04:21:04 +01:00
|
|
|
/**
|
2017-08-22 15:02:23 +02:00
|
|
|
* Remove a Server from the Network
|
2016-12-05 04:21:04 +01:00
|
|
|
*
|
2017-08-22 15:02:23 +02:00
|
|
|
* @param name Name of the Server
|
|
|
|
* @return Success Status
|
2016-12-05 04:21:04 +01:00
|
|
|
*/
|
2017-08-22 15:02:23 +02:00
|
|
|
public boolean removeServer(String name) {
|
|
|
|
return removeServer(null, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a Server from the Network
|
|
|
|
*
|
|
|
|
* @param player Player Removing
|
|
|
|
* @param name Name of the Server
|
|
|
|
* @return Success Status
|
|
|
|
*/
|
|
|
|
public boolean removeServer(UUID player, String name) {
|
|
|
|
if (Util.isNull(name, getServer(name))) throw new NullPointerException();
|
|
|
|
SubRemoveServerEvent event = new SubRemoveServerEvent(player, null, getServer(name));
|
|
|
|
plugin.getPluginManager().callEvent(event);
|
|
|
|
if (event.isCancelled()) {
|
|
|
|
plugin.exServers.remove(name.toLowerCase());
|
|
|
|
return true;
|
|
|
|
} else return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Force Remove a Server from the Network
|
|
|
|
*
|
|
|
|
* @param name Name of the Server
|
|
|
|
* @return Success Status
|
|
|
|
*/
|
|
|
|
public boolean forceRemoveServer(String name) {
|
|
|
|
return forceRemoveServer(null, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Force Remove a Server from the Network
|
|
|
|
*
|
|
|
|
* @param player Player Removing
|
|
|
|
* @param name Name of the Server
|
|
|
|
* @return Success Status
|
|
|
|
*/
|
|
|
|
public boolean forceRemoveServer(UUID player, String name) {
|
|
|
|
if (Util.isNull(name, getServer(name))) throw new NullPointerException();
|
|
|
|
SubRemoveServerEvent event = new SubRemoveServerEvent(player, null, getServer(name));
|
|
|
|
plugin.getPluginManager().callEvent(event);
|
|
|
|
plugin.exServers.remove(name.toLowerCase());
|
|
|
|
return true;
|
2016-12-05 04:21:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the SubServers
|
|
|
|
*
|
|
|
|
* @return SubServer Map
|
|
|
|
*/
|
|
|
|
public Map<String, SubServer> getSubServers() {
|
|
|
|
TreeMap<String, SubServer> servers = new TreeMap<String, SubServer>();
|
|
|
|
for (Host host : plugin.hosts.values()) {
|
|
|
|
servers.putAll(host.getSubServers());
|
|
|
|
}
|
|
|
|
return servers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a SubServer
|
|
|
|
*
|
|
|
|
* @param name SubServer name
|
|
|
|
* @return a SubServer
|
|
|
|
*/
|
|
|
|
public SubServer getSubServer(String name) {
|
2017-01-30 21:22:36 +01:00
|
|
|
if (Util.isNull(name)) throw new NullPointerException();
|
2016-12-05 04:21:04 +01:00
|
|
|
return getSubServers().get(name.toLowerCase());
|
|
|
|
}
|
|
|
|
|
2017-01-21 17:49:37 +01:00
|
|
|
/**
|
|
|
|
* Adds to the Language Map
|
|
|
|
*
|
|
|
|
* @param key Key
|
|
|
|
* @param value Lang Value
|
|
|
|
*/
|
|
|
|
public void setLang(String key, String value) {
|
2017-01-30 21:22:36 +01:00
|
|
|
if (Util.isNull(key, value)) throw new NullPointerException();
|
2017-01-21 17:49:37 +01:00
|
|
|
plugin.exLang.put(key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a value from the SubServers Lang
|
|
|
|
*
|
|
|
|
* @param key Key
|
|
|
|
* @return Lang Value
|
|
|
|
*/
|
|
|
|
public String getLang(String key) {
|
2017-01-30 21:22:36 +01:00
|
|
|
if (Util.isNull(key)) throw new NullPointerException();
|
2017-01-21 17:49:37 +01:00
|
|
|
return getLang().get(key);
|
|
|
|
}
|
|
|
|
|
2016-12-19 01:38:02 +01:00
|
|
|
/**
|
|
|
|
* Gets the SubServers Lang
|
|
|
|
*
|
|
|
|
* @return SubServers Lang
|
|
|
|
*/
|
|
|
|
public Map<String, String> getLang() {
|
|
|
|
HashMap<String, String> lang = new HashMap<String, String>();
|
|
|
|
for (String key : plugin.lang.get().getSection("Lang").getKeys()) {
|
|
|
|
if (plugin.lang.get().getSection("Lang").isString(key)) lang.put(key, plugin.lang.get().getSection("Lang").getString(key));
|
|
|
|
}
|
|
|
|
lang.putAll(plugin.exLang);
|
|
|
|
return lang;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-01-21 17:49:37 +01:00
|
|
|
* Gets the Runtime Directory
|
2016-12-19 01:38:02 +01:00
|
|
|
*
|
2017-01-21 17:49:37 +01:00
|
|
|
* @return Directory
|
2016-12-19 01:38:02 +01:00
|
|
|
*/
|
2017-01-21 17:49:37 +01:00
|
|
|
public UniversalFile getRuntimeDirectory() {
|
|
|
|
return plugin.dir;
|
2016-12-19 01:38:02 +01:00
|
|
|
}
|
|
|
|
|
2016-12-05 04:21:04 +01:00
|
|
|
/**
|
2017-01-21 17:49:37 +01:00
|
|
|
* Gets the SubServers Beta Version
|
2016-12-05 04:21:04 +01:00
|
|
|
*
|
2017-01-21 17:49:37 +01:00
|
|
|
* @return SubServers Beta Version (or null if this is a release version)
|
2016-12-05 04:21:04 +01:00
|
|
|
*/
|
2017-01-21 17:49:37 +01:00
|
|
|
public Version getBetaVersion() {
|
|
|
|
return plugin.bversion;
|
2016-12-05 04:21:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the SubServers Version
|
|
|
|
*
|
|
|
|
* @return SubServers Version
|
|
|
|
*/
|
|
|
|
public Version getWrapperVersion() {
|
|
|
|
return plugin.version;
|
|
|
|
}
|
2017-01-21 17:49:37 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the BungeeCord Version
|
|
|
|
*
|
|
|
|
* @return BungeeCord Version
|
|
|
|
*/
|
|
|
|
public Version getProxyVersion() {
|
|
|
|
return new Version(plugin.getVersion());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the Recommended Minecraft Version
|
|
|
|
*
|
|
|
|
* @return Minecraft Version
|
|
|
|
*/
|
|
|
|
public Version getGameVersion() {
|
|
|
|
return new Version(plugin.getGameVersion());
|
|
|
|
}
|
2016-12-05 04:21:04 +01:00
|
|
|
}
|