Swapped default connections to new dns names.
Fixed bug with LobbyBalancer and retrieving no lobbies.
This commit is contained in:
parent
55c9a85763
commit
f2570caad5
Binary file not shown.
|
@ -3,11 +3,18 @@ package mineplex.bungee;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mineplex.bungee.lobbyBalancer.LobbyBalancer;
|
||||
import mineplex.bungee.motd.MotdManager;
|
||||
import mineplex.bungee.playerCount.PlayerCount;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.conf.YamlConfig;
|
||||
|
||||
public class Mineplexer extends Plugin
|
||||
{
|
||||
|
@ -15,40 +22,50 @@ public class Mineplexer extends Plugin
|
|||
public void onEnable()
|
||||
{
|
||||
//_dynamicServers = new GlobalServer(this);
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
Field config = YamlConfig.class.getDeclaredField("config");
|
||||
config.setAccessible(true);
|
||||
Map configMap = (Map)config.get(getProxy().getConfigurationAdapter());
|
||||
|
||||
System.out.println("Printing groups.");
|
||||
for (String playerName : ((HashMap<String, List<String>>)configMap.get("groups")).keySet())
|
||||
{
|
||||
System.out.println(playerName);
|
||||
|
||||
for (String rank : ((HashMap<String, List<String>>)configMap.get("groups")).get(playerName))
|
||||
{
|
||||
System.out.println("-" + rank);
|
||||
}
|
||||
}
|
||||
|
||||
((HashMap<String, List<String>>)configMap.get("groups")).clear();
|
||||
((HashMap<String, List<String>>)configMap.get("groups")).put("defek7", Arrays.asList("admin", "owner"));
|
||||
|
||||
config.set(getProxy().getConfigurationAdapter(), configMap);
|
||||
System.out.println("Printing groups.");
|
||||
for (String playerName : ((HashMap<String, List<String>>)configMap.get("groups")).keySet())
|
||||
{
|
||||
System.out.println(playerName);
|
||||
|
||||
for (String rank : ((HashMap<String, List<String>>)configMap.get("groups")).get(playerName))
|
||||
{
|
||||
System.out.println("-" + rank);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
*/
|
||||
|
||||
new MotdManager(this);
|
||||
new LobbyBalancer(this);
|
||||
new PlayerCount(this);
|
||||
new FileUpdater(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
|
||||
|
|
|
@ -22,7 +22,7 @@ public class LobbyBalancer implements Listener, Runnable
|
|||
|
||||
private int _bestServerIndex = 0;
|
||||
private int _playersSentToBestServer = 0;
|
||||
private int _maxPlayersToSendToBestServer = 0;
|
||||
private int _maxPlayersToSendToBestServer = 1;
|
||||
|
||||
public LobbyBalancer(Plugin plugin)
|
||||
{
|
||||
|
@ -109,7 +109,9 @@ public class LobbyBalancer implements Listener, Runnable
|
|||
Collections.sort(_sortedLobbies, new LobbySorter());
|
||||
|
||||
_bestServerIndex = 0;
|
||||
_maxPlayersToSendToBestServer = (_sortedLobbies.get(_bestServerIndex).MaxPlayers - _sortedLobbies.get(_bestServerIndex).Players) / 10;
|
||||
|
||||
if (_sortedLobbies.size() > 0)
|
||||
_maxPlayersToSendToBestServer = (_sortedLobbies.get(_bestServerIndex).MaxPlayers - _sortedLobbies.get(_bestServerIndex).Players) / 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||
public class LobbyBalancerRepository
|
||||
{
|
||||
private Connection _connection = null;
|
||||
private String _connectionString = "jdbc:mysql://sql.mineplex.com:3306/ServerStatus?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
|
||||
private String _connectionString = "jdbc:mysql://db.mineplex.com:3306/ServerStatus?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
|
||||
private String _userName = "root";
|
||||
private String _password = "tAbechAk3wR7tuTh";
|
||||
private boolean _us;
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.sql.SQLException;
|
|||
public class MotdRepository
|
||||
{
|
||||
private Connection _connection = null;
|
||||
private String _connectionString = "jdbc:mysql://sql.mineplex.com:3306/BungeeServers?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
|
||||
private String _connectionString = "jdbc:mysql://db.mineplex.com:3306/BungeeServers?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
|
||||
private String _userName = "root";
|
||||
private String _password = "tAbechAk3wR7tuTh";
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.sql.Statement;
|
|||
public class PlayerCountRepository
|
||||
{
|
||||
private Connection _connection = null;
|
||||
private String _connectionString = "jdbc:mysql://sql.mineplex.com:3306/BungeeServers?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
|
||||
private String _connectionString = "jdbc:mysql://db.mineplex.com:3306/BungeeServers?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
|
||||
private String _userName = "root";
|
||||
private String _password = "tAbechAk3wR7tuTh";
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ public class RetrieveClientInformationEvent extends Event
|
|||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private static Connection _connection;
|
||||
private String _connectionString = "jdbc:mysql://sql.mineplex.com:3306/Stats?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
|
||||
private String _connectionString = "jdbc:mysql://db.mineplex.com:3306/Stats?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
|
||||
private String _userName = "root";
|
||||
private String _password = "tAbechAk3wR7tuTh";
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ public class AntiHackRepository
|
|||
private String _serverName;
|
||||
|
||||
private Connection _connection;
|
||||
private String _connectionString = "jdbc:mysql://sql.mineplex.com:3306/Mineplex";
|
||||
private String _connectionString = "jdbc:mysql://db.mineplex.com:3306/Mineplex";
|
||||
private String _userName = "root";
|
||||
private String _password = "tAbechAk3wR7tuTh";
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ public class Table
|
|||
{
|
||||
private static Connection _connection;
|
||||
|
||||
private String _connectionString = "jdbc:mysql://sql.mineplex.com:3306/Mineplex?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
|
||||
private String _connectionString = "jdbc:mysql://db.mineplex.com:3306/Mineplex?autoReconnect=true&failOverReadOnly=false&maxReconnects=10";
|
||||
private String _userName = "root";
|
||||
private String _password = "tAbechAk3wR7tuTh";
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ServerStatusManager extends MiniPlugin
|
|||
{
|
||||
try
|
||||
{
|
||||
GetPlugin().getConfig().addDefault("serverstatus.connectionurl", "jdbc:mysql://sql.mineplex.com:3306/ServerStatus");
|
||||
GetPlugin().getConfig().addDefault("serverstatus.connectionurl", "jdbc:mysql://db.mineplex.com:3306/ServerStatus");
|
||||
GetPlugin().getConfig().set("serverstatus.connectionurl", GetPlugin().getConfig().getString("serverstatus.connectionurl"));
|
||||
|
||||
GetPlugin().getConfig().addDefault("serverstatus.username", "root");
|
||||
|
|
|
@ -15,7 +15,7 @@ public class EnjinTranslator extends JavaPlugin
|
|||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/");
|
||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
saveConfig();
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
|
|||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/");
|
||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
saveConfig();
|
||||
|
|
|
@ -90,7 +90,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin
|
|||
DeleteFolders();
|
||||
|
||||
//Configs
|
||||
getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/");
|
||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
saveConfig();
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public abstract class GamePlugin extends JavaPlugin implements IRelation
|
|||
{
|
||||
try
|
||||
{
|
||||
getConfig().addDefault(WEB_CONFIG, "http://api.mineplex.com/");
|
||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
saveConfig();
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class MineKart extends JavaPlugin implements INautilusPlugin, Listener
|
|||
{
|
||||
ClearRaceFolders();
|
||||
|
||||
getConfig().addDefault(WEB_CONFIG, "http:/api.mineplex.com/");
|
||||
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
|
||||
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
|
||||
saveConfig();
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue