Applied Eclipse formatting.
This commit is contained in:
parent
4f138a56da
commit
3940b91d0e
25 changed files with 1763 additions and 1708 deletions
|
|
@ -14,65 +14,63 @@ import org.dynmap.debug.Debugger;
|
|||
|
||||
public class WebServer extends Thread {
|
||||
|
||||
public static final String VERSION = "Huncraft";
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
public static final String VERSION = "Huncraft";
|
||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
private Debugger debugger;
|
||||
|
||||
private ServerSocket sock = null;
|
||||
private boolean running = false;
|
||||
private Debugger debugger;
|
||||
|
||||
private MapManager mgr;
|
||||
private World world;
|
||||
private PlayerList playerList;
|
||||
private ConfigurationNode configuration;
|
||||
private ServerSocket sock = null;
|
||||
private boolean running = false;
|
||||
|
||||
public WebServer(MapManager mgr, World world, PlayerList playerList, Debugger debugger, ConfigurationNode configuration) throws IOException
|
||||
{
|
||||
this.mgr = mgr;
|
||||
this.world = world;
|
||||
this.playerList = playerList;
|
||||
this.configuration = configuration;
|
||||
this.debugger = debugger;
|
||||
|
||||
String bindAddress = configuration.getString("webserver-bindaddress", "0.0.0.0");
|
||||
int port = configuration.getInt("webserver-port", 8123);
|
||||
|
||||
sock = new ServerSocket(port, 5, bindAddress.equals("0.0.0.0") ? null : InetAddress.getByName(bindAddress));
|
||||
running = true;
|
||||
start();
|
||||
log.info("Dynmap WebServer started on " + bindAddress + ":" + port);
|
||||
}
|
||||
private MapManager mgr;
|
||||
private World world;
|
||||
private PlayerList playerList;
|
||||
private ConfigurationNode configuration;
|
||||
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
while (running) {
|
||||
try {
|
||||
Socket socket = sock.accept();
|
||||
WebServerRequest requestThread = new WebServerRequest(socket, mgr, world, playerList, configuration, debugger);
|
||||
requestThread.start();
|
||||
}
|
||||
catch (IOException e) {
|
||||
log.info("map WebServer.run() stops with IOException");
|
||||
break;
|
||||
}
|
||||
}
|
||||
log.info("map WebServer run() exiting");
|
||||
} catch (Exception ex) {
|
||||
debugger.error("Exception on WebServer-thread: " + ex.toString());
|
||||
}
|
||||
}
|
||||
public WebServer(MapManager mgr, World world, PlayerList playerList, Debugger debugger, ConfigurationNode configuration) throws IOException {
|
||||
this.mgr = mgr;
|
||||
this.world = world;
|
||||
this.playerList = playerList;
|
||||
this.configuration = configuration;
|
||||
this.debugger = debugger;
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
try {
|
||||
if(sock != null) {
|
||||
sock.close();
|
||||
}
|
||||
} catch(IOException e) {
|
||||
log.info("map stop() got IOException while closing socket");
|
||||
}
|
||||
running = false;
|
||||
}
|
||||
String bindAddress = configuration.getString("webserver-bindaddress", "0.0.0.0");
|
||||
int port = configuration.getInt("webserver-port", 8123);
|
||||
|
||||
sock = new ServerSocket(port, 5, bindAddress.equals("0.0.0.0")
|
||||
? null
|
||||
: InetAddress.getByName(bindAddress));
|
||||
running = true;
|
||||
start();
|
||||
log.info("Dynmap WebServer started on " + bindAddress + ":" + port);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
while (running) {
|
||||
try {
|
||||
Socket socket = sock.accept();
|
||||
WebServerRequest requestThread = new WebServerRequest(socket, mgr, world, playerList, configuration, debugger);
|
||||
requestThread.start();
|
||||
} catch (IOException e) {
|
||||
log.info("map WebServer.run() stops with IOException");
|
||||
break;
|
||||
}
|
||||
}
|
||||
log.info("map WebServer run() exiting");
|
||||
} catch (Exception ex) {
|
||||
debugger.error("Exception on WebServer-thread: " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
try {
|
||||
if (sock != null) {
|
||||
sock.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.info("map stop() got IOException while closing socket");
|
||||
}
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue