mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Code cleanup
This commit is contained in:
@@ -77,7 +77,6 @@ public enum CHomeUI implements ICDoc, IMenuProvider {
|
||||
*/
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
||||
Singletons.getControl().getForgeMenu().setProvider(this);
|
||||
|
||||
selectPrevious();
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
|
||||
public class NetServer {
|
||||
|
||||
private final Server srv = new Server();
|
||||
private final Set<ClientSocket> _openSockets = new CopyOnWriteArraySet<ClientSocket>();
|
||||
|
||||
@@ -42,8 +41,7 @@ public class NetServer {
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class GameServlet extends WebSocketServlet
|
||||
{
|
||||
public class GameServlet extends WebSocketServlet {
|
||||
@Override
|
||||
public WebSocket doWebSocketConnect(HttpServletRequest request, String protocol) {
|
||||
System.out.printf("Connection from %s recieved%n", request.getRemoteAddr());
|
||||
@@ -51,13 +49,10 @@ public class NetServer {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ClientSocket implements WebSocket.OnTextMessage, IClientSocket
|
||||
{
|
||||
public class ClientSocket implements WebSocket.OnTextMessage, IClientSocket {
|
||||
private Connection _connection;
|
||||
private IConnectionObserver _client;
|
||||
|
||||
|
||||
@Override
|
||||
public void onClose(int closeCode, String message) {
|
||||
System.out.println("Lost connection: " + closeCode + ", " + message);
|
||||
@@ -97,8 +92,7 @@ public class NetServer {
|
||||
}
|
||||
|
||||
public void listen(int port) {
|
||||
if (!srv.isStarted())
|
||||
{
|
||||
if (!srv.isStarted()) {
|
||||
portNumber = port;
|
||||
URI serverUri = null;
|
||||
try {
|
||||
@@ -108,10 +102,10 @@ public class NetServer {
|
||||
|
||||
String host = connector.getHost();
|
||||
serverUri = new URI(String.format("ws://%s:%d/", host == null ? "localhost" : host ,port));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
System.out.println("Server started @ " + serverUri);
|
||||
}
|
||||
else {
|
||||
@@ -123,9 +117,9 @@ public class NetServer {
|
||||
try {
|
||||
srv.stop();
|
||||
portNumber = -1;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user