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

196 lines
4.1 KiB
Java
Raw Normal View History

2016-12-24 05:55:17 +01:00
package net.ME1312.SubServers.Bungee.Host;
2016-12-05 04:21:04 +01:00
2016-12-24 05:55:17 +01:00
import net.ME1312.SubServers.Bungee.Library.Exception.InvalidServerException;
import net.ME1312.SubServers.Bungee.Library.NamedContainer;
2016-12-05 04:21:04 +01:00
import java.net.InetSocketAddress;
import java.util.UUID;
/**
* SubServer Layout Class
*/
public abstract class SubServer extends Server {
/**
* Creates a SubServer
*
* @param host Host
* @param name Server Name
* @param port Port Number
* @param motd Server MOTD
* @param restricted Players will need a permission to join if true
2016-12-05 04:21:04 +01:00
* @throws InvalidServerException
*/
2016-12-19 01:38:02 +01:00
public SubServer(Host host, String name, int port, String motd, boolean hidden, boolean restricted) throws InvalidServerException {
super(name, InetSocketAddress.createUnresolved(host.getAddress().getHostAddress(), port), motd, hidden, restricted);
2016-12-05 04:21:04 +01:00
}
/**
* Starts the Server
*
* @param player Player who Started
2016-12-19 01:38:02 +01:00
* @return Success Status
2016-12-05 04:21:04 +01:00
*/
2016-12-19 01:38:02 +01:00
public abstract boolean start(UUID player);
2016-12-05 04:21:04 +01:00
/**
* Starts the Server
2016-12-19 01:38:02 +01:00
*
* @return Success Status
2016-12-05 04:21:04 +01:00
*/
2016-12-19 01:38:02 +01:00
public boolean start() {
return start(null);
2016-12-05 04:21:04 +01:00
}
/**
* Stops the Server
*
* @param player Player who Stopped
2016-12-19 01:38:02 +01:00
* @return Success Status
2016-12-05 04:21:04 +01:00
*/
2016-12-19 01:38:02 +01:00
public abstract boolean stop(UUID player);
2016-12-05 04:21:04 +01:00
/**
* Stops the Server
2016-12-19 01:38:02 +01:00
*
* @return Success Status
2016-12-05 04:21:04 +01:00
*/
2016-12-19 01:38:02 +01:00
public boolean stop() {
return stop(null);
2016-12-05 04:21:04 +01:00
}
/**
* Terminates the Server
*
* @param player Player who Terminated
2016-12-19 01:38:02 +01:00
* @return Success Status
2016-12-05 04:21:04 +01:00
*/
2016-12-19 01:38:02 +01:00
public abstract boolean terminate(UUID player);
2016-12-05 04:21:04 +01:00
/**
* Terminates the Server
2016-12-19 01:38:02 +01:00
*
* @return Success Status
2016-12-05 04:21:04 +01:00
*/
2016-12-19 01:38:02 +01:00
public boolean terminate() {
return terminate(null);
2016-12-05 04:21:04 +01:00
}
/**
* Commands the Server
*
* @param player Player who Commanded
* @param command Command to Send
2016-12-19 01:38:02 +01:00
* @return Success Status
2016-12-05 04:21:04 +01:00
*/
2016-12-19 01:38:02 +01:00
public abstract boolean command(UUID player, String command);
2016-12-05 04:21:04 +01:00
/**
* Commands the Server
*
* @param command Command to Send
2016-12-19 01:38:02 +01:00
* @return Success Status
2016-12-05 04:21:04 +01:00
*/
2016-12-19 01:38:02 +01:00
public boolean command(String command) {
return command(null, command);
2016-12-05 04:21:04 +01:00
}
/**
* Waits for the Server to Stop
*
* @throws InterruptedException
*/
public abstract void waitFor() throws InterruptedException;
/**
* If the Server is Running
*
* @return Running Status
*/
public abstract boolean isRunning();
/**
* Grabs the Host of the Server
*
* @return The Host
*/
public abstract Host getHost();
/**
* If the Server is Enabled
*
* @return Enabled Status
*/
public abstract boolean isEnabled();
/**
* Set if the Server is Enabled
*
* @param value Value
*/
public abstract void setEnabled(boolean value);
/**
* If the Server is Logging
*
* @return Logging Status
*/
public abstract boolean isLogging();
/**
* Set if the Server is Logging
*
* @param value Value
*/
public abstract void setLogging(boolean value);
/**
* Get Process Logger
*/
public abstract SubLogger getLogger();
2017-01-01 20:34:46 +01:00
/**
* Get the Server Directory
*
* @return Server Directory
*/
public abstract String getDirectory();
2016-12-05 04:21:04 +01:00
/**
* Grab the Command to Stop the Server
*
* @return Stop Command
*/
public abstract String getStopCommand();
/**
* Set the Command that Stops the Server
*
* @param value Value
*/
public abstract void setStopCommand(String value);
/**
* If the Server will Auto Restart on unexpected shutdowns
*
* @return Auto Restart Status
*/
public abstract boolean willAutoRestart();
/**
* Set if the Server will Auto Restart on unexpected shutdowns
*
* @param value Value
*/
public abstract void setAutoRestart(boolean value);
/**
* If the Server is Temporary
*
* @return Temporary Status
*/
public abstract boolean isTemporary();
}