41e9ffb018
Updated Bungee plugin to pull US servers only. Added dynamic MOTD from mysql for BungeeCord.jar Fixed crash for disguise block arm animation.
84 lines
2.3 KiB
Java
84 lines
2.3 KiB
Java
package mineplex.bungee;
|
|
|
|
import java.io.DataInputStream;
|
|
import java.io.DataOutputStream;
|
|
import java.io.IOException;
|
|
|
|
import mineplex.bungee.lobbyBalancer.LobbyBalancer;
|
|
import mineplex.bungee.motd.MotdManager;
|
|
import mineplex.bungee.playerCount.PlayerCount;
|
|
import net.md_5.bungee.api.plugin.Plugin;
|
|
|
|
public class Mineplexer extends Plugin
|
|
{
|
|
@Override
|
|
public void onEnable()
|
|
{
|
|
//_dynamicServers = new GlobalServer(this);
|
|
new MotdManager(this);
|
|
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);
|
|
}
|
|
}
|