Fixes again for number player names.

This commit is contained in:
Jonathan Williams 2015-01-03 04:27:28 -06:00
parent cc06b0ad33
commit 86993ddd55
8 changed files with 48 additions and 8 deletions

View File

@ -18,7 +18,7 @@ public abstract class MiniPlugin implements Listener
protected String _moduleName = "Default";
protected JavaPlugin _plugin;
protected NautHashMap<String, ICommand> _commands;
public MiniPlugin(String moduleName, JavaPlugin plugin)

View File

@ -22,7 +22,22 @@ public class ServerConfiguration extends MiniPlugin
super("Server Configuration", plugin);
Region region = plugin.getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU;
String groupName = plugin.getConfig().getString("serverstatus.group").replace(".0", "");
String groupName = plugin.getConfig().getString("serverstatus.group");
String serverName = plugin.getConfig().getString("serverstatus.name");
// Ugh serializing json to redis converts a players name that is only numbers to name.0 so we have to parse this off so things don't go boom. hackfix ftw
try
{
String name = serverName.split("-")[0];
Integer.parseInt(name);
groupName = name;
System.out.println("Changed to server group name : " + serverName);
}
catch (NumberFormatException ex)
{
// Nothing stupid..
}
for (ServerGroup serverGroup : ServerManager.getServerRepository(region).getServerGroups(null))
{

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="Hub,Arcade,StaffServer,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="Arcade,Hub,StaffServer,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="Arcade,Hub,StaffServer,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="Hub,Arcade,StaffServer,ServerMonitor,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="Arcade,Hub,StaffServer,ServerMonitor,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="Arcade,Hub,StaffServer,ServerMonitor,"/>
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>

View File

@ -106,4 +106,9 @@ public class MinecraftServer
}
return false;
}
public void setGroup(String group)
{
_group = group;
}
}

View File

@ -73,6 +73,20 @@ public class RedisServerRepository implements ServerRepository
if (server != null)
{
// Ugh serializing json to redis converts a players name that is only numbers to name.0 so we have to parse this off so things don't go boom. hackfix ftw
try
{
String name = server.getName().split("-")[0];
Integer.parseInt(name);
server.setGroup(name);
System.out.println("Changed to server group name : " + server.getGroup());
}
catch (NumberFormatException ex)
{
// Nothing stupid..
}
servers.add(server);
}
}

View File

@ -257,7 +257,7 @@ public class ServerGroup
for (MinecraftServer server : servers)
{
if (_name.equalsIgnoreCase(server.getGroup().replace(".0", "")))
if (_name.equalsIgnoreCase(server.getGroup()))
{
_servers.add(server);
}

View File

@ -166,9 +166,12 @@ public class ServerMonitor
/*
if (groupStatus.getHost() == null || groupStatus.getHost().isEmpty())
{
if (groupStatus.getName().startsWith("0"))
{
int serverCount = groupStatus.getServers().size();
log(groupStatus.getName() + " : " + groupStatus.getPlayerCount() + " players on " + serverCount + " servers " + String.format("%.2f", ((double)serverCount * (double)groupStatus.getRequiredCpu() / totalCPU)) + "% CPU," + String.format("%.2f", ((double)serverCount * (double)groupStatus.getRequiredRam() / totalRAM)) + "% RAM", true);
log(groupStatus.getName() + " : " + groupStatus.getPlayerCount() + " players on " + serverCount + " servers " + String.format("%.2f", ((double)serverCount * (double)groupStatus.getRequiredCpu() / totalCPU)) + "% CPU," + String.format("%.2f", ((double)serverCount * (double)groupStatus.getRequiredRam() / totalRAM)) + "% RAM", false);
}
}
*/
}
@ -282,7 +285,7 @@ public class ServerMonitor
private static void handleUserServerGroup(ServerGroup serverGroup)
{
if (serverGroup != null && serverGroup.getHost() != null && !serverGroup.getHost().isEmpty() && serverGroup.getServerCount() == 0)
if (serverGroup != null && serverGroup.getHost() != null && !serverGroup.getHost().isEmpty() && serverGroup.getServerCount() <= 1)
{
_repository.removeServerGroup(serverGroup);
_serverGroupMap.remove(serverGroup);

View File

@ -15,6 +15,9 @@ public class LifetimeLegend extends SalesPackageBase
{
addButton(agent, "/sales coin " + playerName + " 60000", " 60,000 Coins");
addButton(agent, "/sales rank " + playerName + " LEGEND true", " Lifetime Legend.");
addButton(agent, "/sales item " + playerName + " 1 Morph Wither Morph", "Gives Wither Morph.");
addButton(agent, "/sales item " + playerName + " 1 Pet Widder", "Gives Wither Pet.");
addButton(agent, "/sales item " + playerName + " 1 Particle Legendary Aura", "Gives Legendary Aura Particle.");
addButton(agent, "Apply All", "/sales lifetimelegend " + playerName, " Apply all above.");
agent.sendMessage(" ");
addBackButton(agent, playerName);