Merge remote-tracking branch 'origin/clans/beta' into clans/beta

This commit is contained in:
Shaun Bennett 2016-04-02 14:55:14 +11:00
commit 758004f207

View File

@ -466,7 +466,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
if (!adminMessage)
{
for (FriendStatus friendInfo : friends.getFriends())
{
@ -549,51 +548,60 @@ 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))
{
if (IncognitoManager.Instance.getRepository().GetStatus(playerTarget))
{
UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "]."));
return;
}
// Construct the command to send to redis
RedisMessage globalMessage = new RedisMessage(_serverName,
sender.getName(),
adminMessage ? null : friend.ServerName,
playerTarget,
message,
// Include the sender's rank if this is a admin message. So we can format the receivers chat.
adminMessage ? F.rank(_clientManager.Get(sender).GetRank()) : null);
final UUID uuid = globalMessage.getUUID();
// A backup for the rare case where the message fails to deliver. Server doesn't respond
BukkitRunnable runnable = new BukkitRunnable()
{
public void run()
runAsync(new Runnable()
{
_messageTimeouts.remove(uuid);
// Inform the player that the message failed to deliver
UtilPlayer.message(
sender,
F.main((adminMessage ? "Admin " : "") + "Message", C.mBody + " Failed to send message to ["
+ C.mElem + playerTarget + C.mBody + "]."));
@Override
public void run()
{
if (IncognitoManager.Instance.getRepository().GetStatus(playerTarget))
{
UtilPlayer.message(sender, F.main("Online Player Search", F.elem("0") + " matches for [" + F.elem(target) + "]."));
return;
}
runSync(new Runnable()
{
public void run()
{
// Construct the command to send to redis
RedisMessage globalMessage = new RedisMessage(_serverName,
sender.getName(),
adminMessage ? null : friend.ServerName,
playerTarget,
message,
// Include the sender's rank if this is a admin message. So we can format the receivers chat.
adminMessage ? F.rank(_clientManager.Get(sender).GetRank()) : null);
final UUID uuid = globalMessage.getUUID();
// A backup for the rare case where the message fails to deliver. Server doesn't respond
BukkitRunnable runnable = new BukkitRunnable()
{
public void run()
{
_messageTimeouts.remove(uuid);
// Inform the player that the message failed to deliver
UtilPlayer.message(
sender,
F.main((adminMessage ? "Admin " : "") + "Message", C.mBody + " Failed to send message to ["
+ C.mElem + playerTarget + C.mBody + "]."));
}
};
// This will activate in 2 seconds
runnable.runTaskLater(getPlugin(), 40);
// The key is the UUID its trading between servers
_messageTimeouts.put(uuid, runnable);
// Time to send the message!
globalMessage.publish();
}
});
}
}
};
// This will activate in 2 seconds
runnable.runTaskLater(getPlugin(), 40);
// The key is the UUID its trading between servers
_messageTimeouts.put(uuid, runnable);
// Time to send the message!
globalMessage.publish();
);
}
}
}