2013-09-11 22:53:24 +02:00
|
|
|
package mineplex.bungee;
|
|
|
|
|
2013-09-18 14:16:29 +02:00
|
|
|
import java.io.DataInputStream;
|
|
|
|
import java.io.DataOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
2013-09-11 22:53:24 +02:00
|
|
|
import mineplex.bungee.bungeeSigns.BungeeSigns;
|
|
|
|
import mineplex.bungee.lobbyBalancer.LobbyBalancer;
|
|
|
|
import mineplex.bungee.playerCount.PlayerCount;
|
|
|
|
import net.md_5.bungee.api.plugin.Plugin;
|
|
|
|
|
|
|
|
public class Mineplexer extends Plugin
|
2013-09-19 09:05:23 +02:00
|
|
|
{
|
2013-09-11 22:53:24 +02:00
|
|
|
@Override
|
|
|
|
public void onEnable()
|
|
|
|
{
|
|
|
|
new BungeeSigns(this);
|
|
|
|
|
2013-09-18 14:16:29 +02:00
|
|
|
//_dynamicServers = new GlobalServer(this);
|
2013-09-19 09:05:23 +02:00
|
|
|
new LobbyBalancer(this);
|
2013-09-18 00:50:23 +02:00
|
|
|
new PlayerCount(this);
|
2013-09-18 14:16:29 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
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);
|
2013-09-11 22:53:24 +02:00
|
|
|
|
2013-09-18 14:16:29 +02:00
|
|
|
dataInputStream.read();
|
|
|
|
System.out.println(dataInputStream.readByte());
|
|
|
|
System.out.println(readString(dataInputStream, 16));
|
|
|
|
System.out.println(readString(dataInputStream, 24));
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
ex.printStackTrace();
|
|
|
|
}
|
|
|
|
*/
|
2013-09-11 22:53:24 +02:00
|
|
|
}
|
2013-09-18 14:16:29 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2013-09-11 22:53:24 +02:00
|
|
|
}
|