Re-enabled cross-server functionality.

RedisPartyHandler execution is now run on Bukkit main thread.
This commit is contained in:
Jonathan Williams 2015-03-12 04:10:15 -07:00
parent ca9ebbb1bd
commit 6394b588ab
5 changed files with 17 additions and 20 deletions

View File

@ -66,9 +66,9 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
ServerCommandManager.getInstance().registerCommandType("AnnouncementCommand", AnnouncementCommand.class,
new AnnouncementHandler());
//ServerCommandManager.getInstance().registerCommandType("RedisMessage", RedisMessage.class, messageHandler);
//ServerCommandManager.getInstance()
// .registerCommandType("RedisMessageCallback", RedisMessageCallback.class, messageHandler);
ServerCommandManager.getInstance().registerCommandType("RedisMessage", RedisMessage.class, messageHandler);
ServerCommandManager.getInstance()
.registerCommandType("RedisMessageCallback", RedisMessageCallback.class, messageHandler);
}
public void addCommands()
@ -113,7 +113,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
public String canReceiverMessageThem(String sender, Player target)
{
// If the receiver has turned off private messaging and the sender isn't a mod
if (!_preferences.Get(target).PrivateMessaging)
{
@ -311,7 +310,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
public void receiveMessage(Player to, RedisMessage globalMessage)
{
if (globalMessage.isStaffMessage())
{
// Message the receiver
@ -490,7 +488,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
// If this is a admin message, or the sender isn't muted/ignoring the target
if (adminMessage || canSenderMessageThem(sender, playerTarget))
{
/*
// Construct the command to send to redis
RedisMessage globalMessage = new RedisMessage(_serverName,
@ -530,7 +527,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
// Time to send the message!
globalMessage.publish();
*/
}
}
}

View File

@ -40,8 +40,8 @@ public class PartyManager extends MiniPlugin
_preferenceManager = preferenceManager;
_serverName = getPlugin().getConfig().getString("serverstatus.name");
//ServerCommandManager.getInstance().registerCommandType("RedisPartyData", RedisPartyData.class,
// new RedisPartyHandler(this));
ServerCommandManager.getInstance().registerCommandType("RedisPartyData", RedisPartyData.class,
new RedisPartyHandler(this));
}
@Override
@ -92,7 +92,6 @@ public class PartyManager extends MiniPlugin
@EventHandler
public void serverTransfer(ServerTransferEvent event)
{
/*
for (Party party : _parties)
{
if (party.GetLeader().equals(event.getPlayer().getName()))
@ -124,7 +123,6 @@ public class PartyManager extends MiniPlugin
break;
}
}
*/
}
@EventHandler(priority = EventPriority.MONITOR)

View File

@ -17,9 +17,14 @@ public class RedisPartyHandler implements CommandCallback
@Override
public void run(ServerCommand command)
{
RedisPartyData data = (RedisPartyData) command;
final RedisPartyData data = (RedisPartyData) command;
_partyManager.addParty(new Party(_partyManager, data));
_partyManager.getPlugin().getServer().getScheduler().runTask(_partyManager.getPlugin(), new Runnable()
{
public void run()
{
_partyManager.addParty(new Party(_partyManager, data));
}
});
}
}

View File

@ -167,7 +167,7 @@ public class Punish extends MiniPlugin
if (target != null)
target.kickPlayer(kickReason);
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);
}
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>()
{

View File

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