package mineplex.bungee; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import mineplex.bungee.bungeeSigns.BungeeSigns; import mineplex.bungee.globalServer.GlobalServer; import mineplex.bungee.lobbyBalancer.LobbyBalancer; import mineplex.bungee.playerCount.PlayerCount; import net.md_5.bungee.api.plugin.Plugin; public class Mineplexer extends Plugin { private GlobalServer _dynamicServers; private LobbyBalancer _lobbyBalancer; @Override public void onEnable() { new BungeeSigns(this); //_dynamicServers = new GlobalServer(this); _lobbyBalancer = new LobbyBalancer(this); new PlayerCount(this); /* Socket socket = null; DataInputStream dataInputStream = null; DataOutputStream dataOutputStream = null; try { socket = new Socket(); socket.setSoTimeout(3000); socket.setTcpNoDelay(true); socket.setTrafficClass(18); socket.connect(new InetSocketAddress("192.95.30.130", 4444)); dataInputStream = new DataInputStream(socket.getInputStream()); dataOutputStream = new DataOutputStream(socket.getOutputStream()); dataOutputStream.writeShort(71); writeString("defek7", dataOutputStream); dataInputStream.read(); System.out.println(dataInputStream.readByte()); System.out.println(readString(dataInputStream, 16)); System.out.println(readString(dataInputStream, 24)); } catch (Exception ex) { ex.printStackTrace(); } */ } protected String readString(DataInputStream dataInputStream, int maxLength) throws IOException { short length = dataInputStream.readShort(); if (length > maxLength) { throw new IOException("Received string length longer than maximum allowed (" + length + " > " + maxLength + ")"); } else if (length < 0) { throw new IOException("Received string length is less than zero! Weird string!"); } else { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < length; i++) { stringBuilder.append(dataInputStream.readChar()); } return stringBuilder.toString(); } } protected void writeString(String string, DataOutputStream dataOutputStream) throws IOException { dataOutputStream.writeShort(string.length()); dataOutputStream.writeChars(string); } }