Disabled redis pub commands.

Added getServerStatusesByPrefix to redis.
Increased timeout for servers.

Turned on DoubleGemWeekend
This commit is contained in:
Jonathan Williams 2015-03-08 13:47:49 -07:00
parent 8cc60e1b65
commit 27c17eccfb
8 changed files with 28 additions and 8 deletions

View File

@ -490,6 +490,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
// If this is a admin message, or the sender isn't muted/ignoring the target // If this is a admin message, or the sender isn't muted/ignoring the target
if (adminMessage || canSenderMessageThem(sender, playerTarget)) if (adminMessage || canSenderMessageThem(sender, playerTarget))
{ {
/*
// Construct the command to send to redis // Construct the command to send to redis
RedisMessage globalMessage = new RedisMessage(_serverName, RedisMessage globalMessage = new RedisMessage(_serverName,
@ -529,6 +530,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
// Time to send the message! // Time to send the message!
globalMessage.publish(); globalMessage.publish();
*/
} }
} }
} }

View File

@ -92,6 +92,7 @@ public class PartyManager extends MiniPlugin
@EventHandler @EventHandler
public void serverTransfer(ServerTransferEvent event) public void serverTransfer(ServerTransferEvent event)
{ {
/*
for (Party party : _parties) for (Party party : _parties)
{ {
if (party.GetLeader().equals(event.getPlayer().getName())) if (party.GetLeader().equals(event.getPlayer().getName()))
@ -123,6 +124,7 @@ public class PartyManager extends MiniPlugin
break; break;
} }
} }
*/
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)

View File

@ -167,7 +167,7 @@ public class Punish extends MiniPlugin
if (target != null) if (target != null)
target.kickPlayer(kickReason); target.kickPlayer(kickReason);
else else
new mineplex.serverdata.transfers.PunishCommand(playerName, true, false, kickReason).publish(); ;//new mineplex.serverdata.transfers.PunishCommand(playerName, true, false, kickReason).publish();
} }
}); });
@ -193,7 +193,7 @@ public class Punish extends MiniPlugin
target.playSound(target.getLocation(), Sound.CAT_MEOW, 1f, 1f); target.playSound(target.getLocation(), Sound.CAT_MEOW, 1f, 1f);
} }
else else
new mineplex.serverdata.transfers.PunishCommand(playerName, false, finalDuration != 0, F.main("Punish", F.elem(C.cGray + C.Bold + (finalDuration != 0 ? "Mute" : "Warning") + " Reason: ") + reason)).publish(); ;//new mineplex.serverdata.transfers.PunishCommand(playerName, false, finalDuration != 0, F.main("Punish", F.elem(C.cGray + C.Bold + (finalDuration != 0 ? "Mute" : "Warning") + " Reason: ") + reason)).publish();
_repository.LoadPunishClient(playerName, new Callback<PunishClientToken>() _repository.LoadPunishClient(playerName, new Callback<PunishClientToken>()
{ {

View File

@ -26,7 +26,7 @@ import mineplex.serverdata.transfers.SuicideCommand;
public class ServerStatusManager extends MiniPlugin public class ServerStatusManager extends MiniPlugin
{ {
// The default timeout (in seconds) before the ServerStatus expires. // The default timeout (in seconds) before the ServerStatus expires.
public final int DEFAULT_SERVER_TIMEOUT = 15; public final int DEFAULT_SERVER_TIMEOUT = 30;
private ServerRepository _repository; private ServerRepository _repository;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;

View File

@ -46,17 +46,19 @@ public class Teleport extends MiniPlugin
_serverName = getPlugin().getConfig().getString("serverstatus.name"); _serverName = getPlugin().getConfig().getString("serverstatus.name");
/*
RedisLocateHandler locateHandler = new RedisLocateHandler(this); RedisLocateHandler locateHandler = new RedisLocateHandler(this);
ServerCommandManager.getInstance().registerCommandType("RedisLocate", RedisLocate.class, locateHandler); ServerCommandManager.getInstance().registerCommandType("RedisLocate", RedisLocate.class, locateHandler);
ServerCommandManager.getInstance().registerCommandType("RedisLocateCallback", RedisLocateCallback.class, locateHandler); ServerCommandManager.getInstance().registerCommandType("RedisLocateCallback", RedisLocateCallback.class, locateHandler);
*/
} }
@Override @Override
public void addCommands() public void addCommands()
{ {
addCommand(new TeleportCommand(this)); addCommand(new TeleportCommand(this));
addCommand(new LocateCommand(this)); //addCommand(new LocateCommand(this));
} }
public void handleLocateCallback(RedisLocateCallback callback) public void handleLocateCallback(RedisLocateCallback callback)

View File

@ -51,6 +51,12 @@ public class RedisServerRepository implements ServerRepository
@Override @Override
public Collection<MinecraftServer> getServerStatuses() public Collection<MinecraftServer> getServerStatuses()
{
return getServerStatusesByPrefix("");
}
@Override
public Collection<MinecraftServer> getServerStatusesByPrefix(String prefix)
{ {
Collection<MinecraftServer> servers = new HashSet<MinecraftServer>(); Collection<MinecraftServer> servers = new HashSet<MinecraftServer>();
Jedis jedis = _readPool.getResource(); Jedis jedis = _readPool.getResource();
@ -62,10 +68,13 @@ public class RedisServerRepository implements ServerRepository
List<Response<String>> responses = new ArrayList<Response<String>>(); List<Response<String>> responses = new ArrayList<Response<String>>();
for (String serverName : getActiveNames(setKey)) for (String serverName : getActiveNames(setKey))
{
if (prefix.isEmpty() || serverName.startsWith(prefix))
{ {
String dataKey = concatenate(setKey, serverName); String dataKey = concatenate(setKey, serverName);
responses.add(pipeline.get(dataKey)); responses.add(pipeline.get(dataKey));
} }
}
pipeline.sync(); pipeline.sync();
@ -146,6 +155,7 @@ public class RedisServerRepository implements ServerRepository
@Override @Override
public void updataServerStatus(MinecraftServer serverData, int timeout) public void updataServerStatus(MinecraftServer serverData, int timeout)
{ {
long time = System.currentTimeMillis();
Jedis jedis = _writePool.getResource(); Jedis jedis = _writePool.getResource();
try try
@ -174,6 +184,8 @@ public class RedisServerRepository implements ServerRepository
_writePool.returnResource(jedis); _writePool.returnResource(jedis);
} }
} }
System.out.println("Finished update - " + (System.currentTimeMillis() - time) + "ms");
} }
@Override @Override

View File

@ -18,6 +18,8 @@ public interface ServerRepository
*/ */
public Collection<MinecraftServer> getServerStatuses(); public Collection<MinecraftServer> getServerStatuses();
public Collection<MinecraftServer> getServerStatusesByPrefix(String prefix);
public Collection<MinecraftServer> getServersByGroup(String serverGroup); public Collection<MinecraftServer> getServersByGroup(String serverGroup);
/** /**

View File

@ -30,7 +30,7 @@ public class GameGemManager implements Listener
{ {
ArcadeManager Manager; ArcadeManager Manager;
boolean DoubleGem = false; boolean DoubleGem = true;
public GameGemManager(ArcadeManager manager) public GameGemManager(ArcadeManager manager)
{ {