SubServers-2/SubServers.Bungee/src/net/ME1312/SubServers/Proxy/Host/Host.java

204 lines
5.3 KiB
Java

package net.ME1312.SubServers.Proxy.Host;
import net.ME1312.SubServers.Proxy.Libraries.Exception.InvalidServerException;
import net.ME1312.SubServers.Proxy.Libraries.UniversalFile;
import net.ME1312.SubServers.Proxy.SubPlugin;
import java.io.File;
import java.net.InetAddress;
import java.util.Map;
import java.util.UUID;
/**
* Host Layout Class
*
* @author ME1312
*/
public abstract class Host {
/**
* This constructor is required to launch your host from the drivers list. Do not add or remove any arguments.
*
* @param plugin SubServers Internals
* @param enabled If your host is enabled
* @param address The address of your host
* @param directory The runtime directory of your host
*/
public Host(SubPlugin plugin, String name, Boolean enabled, InetAddress address, UniversalFile directory) {}
/**
* Is this Host Enabled?
*
* @return Enabled Status
*/
public abstract boolean isEnabled();
/**
* Set if this Host is Enabled
*
* @param value Value
*/
public abstract void setEnabled(boolean value);
/**
* Get the Address of this Host
*
* @return Host Address
*/
public abstract InetAddress getAddress();
/**
* Get the Name of this Host
*
* @return Host Name
*/
public abstract String getName();
/**
* Starts the Servers Specified
*
* @param servers Servers
*/
public void start(String... servers) {
start(null, servers);
}
/**
* Starts the Servers Specified
*
* @param player Player who started
* @param servers Servers
*/
public abstract void start(UUID player, String... servers);
/**
* Stops the Servers Specified
*
* @param servers Servers
*/
public void stop(String... servers) {
stop(null, servers);
}
/**
* Stops the Servers Specified
*
* @param player Player who started
* @param servers Servers
*/
public abstract void stop(UUID player, String... servers);
/**
* Terminates the Servers Specified
*
* @param servers Servers
*/
public void terminate(String... servers) {
terminate(null, servers);
}
/**
* Terminates the Servers Specified
*
* @param player Player who started
* @param servers Servers
*/
public abstract void terminate(UUID player, String... servers);
/**
* Commands the Servers Specified
*
* @param command Command to send
* @param servers Servers
*/
public void command(String command, String... servers) {
command(null, command, servers);
}
/**
* Commands the Servers Specified
*
* @param player Player who started
* @param command Command to send
* @param servers Servers
*/
public abstract void command(UUID player, String command, String... servers);
/**
* Gets the SubCreator Instance for this Host
*
* @return SubCreator
*/
public abstract SubCreator getCreator();
/**
* Gets the SubServers on this Host
*
* @return SubServer Map
*/
public abstract Map<String, ? extends SubServer> getSubServers();
/**
* Gets a SubServer
*
* @param name SubServer Name
* @return a SubServer
*/
public abstract SubServer getSubServer(String name);
/**
* Adds a SubServer
*
* @param player Player who Added
* @param name Name of Server
* @param enabled Enabled Status
* @param port Port Number
* @param motd Motd of the Server
* @param log Logging Status
* @param directory Directory
* @param executable Executable
* @param stopcmd Command to Stop the Server
* @param restart Auto Restart Status
* @param temporary Temporary Status
* @return The SubServer
* @throws InvalidServerException
*/
public abstract SubServer addSubServer(UUID player, String name, boolean enabled, int port, String motd, boolean log, String directory, Executable executable, String stopcmd, boolean start, boolean restart, boolean temporary) throws InvalidServerException;
/**
* Adds a SubServer
*
* @param name Name of Server
* @param enabled Enabled Status
* @param port Port Number
* @param motd Motd of the Server
* @param log Logging Status
* @param directory Directory
* @param executable Executable
* @param stopcmd Command to Stop the Server
* @param restart Auto Restart Status
* @param temporary Temporary Status
* @return The SubServer
* @throws InvalidServerException
*/
public SubServer addSubServer(String name, boolean enabled, int port, String motd, boolean log, String directory, Executable executable, String stopcmd, boolean start, boolean restart, boolean temporary) throws InvalidServerException {
return addSubServer(null, name, enabled, port, motd, log, directory, executable, stopcmd, start, restart, temporary);
}
/**
* Removes a SubServer
*
* @param name SubServer Name
* @throws InterruptedException
*/
public abstract void removeSubServer(String name) throws InterruptedException;
/**
* Forces the Removal of a SubServer
*
* @param name SubServer Name
*/
public abstract void forceRemoveSubServer(String name);
}