This commit is contained in:
Ty Sayers 2015-08-02 20:00:15 -04:00
commit 32a2687991
5 changed files with 71 additions and 69 deletions

View File

@ -39,7 +39,7 @@ public class MotdManager implements Listener, Runnable
if (new File("updateMOTD.dat").exists())
{
List<String> lines = new ArrayList<String>();
lines.add(" §b§l◄§f§lNEW§b§l► §f§l◄§b§lSKYWARS§f§l► §b§l◄§f§lNEW§b§l►");
lines.add(" §f§l◄ §6§lNEW ARCADE GAME §f§l▬ §c§lBOMB LOBBERS §f§l►");
//lines.add(" §d§lRank Sale §a§l40% Off");
//lines.add(" §f§l◄§c§lMAINTENANCE§f§l►");

View File

@ -227,7 +227,7 @@ public class CoreClientManager extends MiniPlugin
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
if (client.getAccountId() > 0)
_accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()));
_accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()), 60 * 60 * 6);
}
catch (Exception exception)
{
@ -301,7 +301,16 @@ public class CoreClientManager extends MiniPlugin
System.out.println(client.GetPlayerName() + "'s account id = " + client.getAccountId());
if (client.getAccountId() > 0)
_accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()));
{
try
{
_accountCacheRepository.addElement(new AccountCache(uuid, client.getAccountId()), 60 * 60 * 6);
}
catch (Exception e)
{
e.printStackTrace();
}
}
return !_clientLoginLock.containsKey(client.GetPlayerName());
}

View File

@ -157,7 +157,7 @@ public class PersonalServerManager extends MiniPlugin
}
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
true, false, false, games, "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU);
true, false, false, games, "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{

View File

@ -59,6 +59,7 @@ import mineplex.hub.server.ui.LobbyShop;
import mineplex.hub.server.ui.QuickShop;
import mineplex.hub.server.ui.ServerCountSorter;
import mineplex.hub.server.ui.ServerNpcShop;
import mineplex.serverdata.Region;
import mineplex.serverdata.data.MinecraftServer;
import mineplex.serverdata.data.ServerGroup;
@ -114,7 +115,7 @@ public class ServerManager extends MiniPlugin
plugin.getServer().getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord");
LoadServers();
loadServers();
_quickShop = new QuickShop(this, clientManager, donationManager, "Quick Menu");
_lobbyShop = new LobbyShop(this, clientManager, donationManager, "Lobby Menu");
@ -628,7 +629,7 @@ public class ServerManager extends MiniPlugin
}
}
public void LoadServers()
public void loadServers()
{
_serverInfoMap.clear();
_serverUpdate.clear();
@ -640,82 +641,49 @@ public class ServerManager extends MiniPlugin
_serverKeyTagMap.clear();
FileInputStream fstream = null;
BufferedReader br = null;
HashSet<String> npcNames = new HashSet<String>();
Region region = getPlugin().getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU;
try
{
File npcFile = new File("ServerManager.dat");
if (npcFile.exists())
for (ServerGroup serverGroup : mineplex.serverdata.servers.ServerManager.getServerRepository(region).getServerGroups(null))
{
fstream = new FileInputStream(npcFile);
br = new BufferedReader(new InputStreamReader(fstream));
String line = br.readLine();
while (line != null)
if (!serverGroup.getServerNpcName().isEmpty())
{
String serverNpcName = line.substring(0, line.indexOf('|')).trim();
String[] serverTags = line.substring(line.indexOf('|') + 1, line.indexOf('|', line.indexOf('|') + 1)).trim().split(",");
String[] locations = line.substring(line.indexOf('|', line.indexOf('|') + 1) + 1).trim().split(",");
if (!HasServerNpc(serverGroup.getServerNpcName()))
{
AddServerNpc(serverGroup.getServerNpcName(), serverGroup.getPrefix());
}
}
for (String location : locations)
if (!serverGroup.getPortalBottomCornerLocation().isEmpty() && !serverGroup.getPortalTopCornerLocation().isEmpty())
{
Vector bottomVector = ParseVector(serverGroup.getPortalBottomCornerLocation());
Vector topVector = ParseVector(serverGroup.getPortalTopCornerLocation());
int blocks = 0;
while (blocks < 10 && (bottomVector.getBlockX() != topVector.getBlockX() || bottomVector.getBlockZ() != topVector.getBlockZ()))
{
_serverPortalLocations.put(ParseVector(location), serverNpcName);
_serverPortalLocations.put(new Vector(bottomVector.getBlockX(), bottomVector.getBlockY(), bottomVector.getBlockZ()), serverGroup.getServerNpcName());
if (bottomVector.getBlockX() != topVector.getBlockX())
{
bottomVector.add(new Vector(-(bottomVector.getBlockX() - topVector.getBlockX()) / Math.abs(bottomVector.getBlockX() - topVector.getBlockX()), 0, 0));
}
else if (bottomVector.getBlockZ() != topVector.getBlockZ())
{
bottomVector.add(new Vector(0, 0, -(bottomVector.getBlockZ() - topVector.getBlockZ()) / Math.abs(bottomVector.getBlockZ() - topVector.getBlockZ())));
}
blocks++;
}
if (!HasServerNpc(serverNpcName))
{
AddServerNpc(serverNpcName, serverTags);
}
npcNames.add(serverNpcName);
line = br.readLine();
_serverPortalLocations.put(bottomVector, serverGroup.getServerNpcName());
}
}
}
catch (Exception e)
{
System.out.println("ServerManager - Error parsing servers file : " + e.getMessage());
}
finally
{
if (br != null)
{
try
{
br.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
if (fstream != null)
{
try
{
fstream.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
for (String npcName : npcNames)
{
if (!_serverNpcShopMap.containsKey(npcName))
_serverNpcShopMap.remove(npcName);
if (!_serverKeyInfoMap.containsKey(npcName))
_serverKeyInfoMap.remove(npcName);
System.out.println("ServerManager - Error parsing servergroups : " + e.getMessage());
}
}

View File

@ -57,6 +57,12 @@ public class ServerGroup
private boolean _staffOnly;
private String _resourcePack = "";
private String _npcName = "";
private String _portalBottomCornerLocation = "";
private String _portalTopCornerLocation = "";
private String _teamServerKey = "";
private Region _region;
private Set<MinecraftServer> _servers;
@ -101,6 +107,10 @@ public class ServerGroup
_resourcePack = data.containsKey("resourcePack") ? data.get("resourcePack") : "";
_host = data.get("host");
_region = data.containsKey("region") ? Region.valueOf(data.get("region")) : Region.ALL;
_teamServerKey = data.containsKey("teamServerKey") ? data.get("teamServerKey") : "";
_portalBottomCornerLocation = data.containsKey("portalBottomCornerLocation") ? data.get("portalBottomCornerLocation") : "";
_portalTopCornerLocation = data.containsKey("portalTopCornerLocation") ? data.get("portalTopCornerLocation") : "";
_npcName = data.containsKey("npcName") ? data.get("npcName") : "";
if (serverStatuses != null)
parseServers(serverStatuses);
@ -109,7 +119,8 @@ public class ServerGroup
public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, boolean arcade, String worldZip, String plugin, String configPath
, int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin
, boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats
, boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region)
, boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region
, String teamServerKey, String portalBottomCornerLocation, String portalTopCornerLocation, String npcName)
{
_name = name;
_prefix = prefix;
@ -148,6 +159,10 @@ public class ServerGroup
_whitelist = whitelist;
_resourcePack = resourcePack;
_region = region;
_teamServerKey = teamServerKey;
_portalBottomCornerLocation = portalBottomCornerLocation;
_portalTopCornerLocation = portalTopCornerLocation;
_npcName = npcName;
}
public String getName() { return _name; }
@ -196,6 +211,12 @@ public class ServerGroup
public String getResourcePack() { return _resourcePack; }
public Region getRegion() { return _region; }
public String getTeamServerKey() { return _teamServerKey; }
public String getServerNpcName() { return _npcName; }
public String getPortalBottomCornerLocation() { return _portalBottomCornerLocation; }
public String getPortalTopCornerLocation() { return _portalTopCornerLocation; }
public Set<MinecraftServer> getServers() { return _servers; }
public int getServerCount()
@ -350,6 +371,10 @@ public class ServerGroup
_dataMap.put("resourcePack", _resourcePack);
_dataMap.put("host", _host);
_dataMap.put("region", _region.name());
_dataMap.put("teamServerKey", _teamServerKey);
_dataMap.put("portalBottomCornerLocation", _portalBottomCornerLocation);
_dataMap.put("portalTopCornerLocation", _portalTopCornerLocation);
_dataMap.put("npcName", _npcName);
}
return _dataMap;