fixed chatslow not working + filter not working for players not in clan

This commit is contained in:
NewGarbo 2016-01-28 13:24:30 +00:00
parent ceeeb3bc45
commit b5f04011e5
2 changed files with 38 additions and 11 deletions

View File

@ -232,9 +232,13 @@ public class Chat extends MiniPlugin
}
}
@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.NORMAL)
public void filterChat(AsyncPlayerChatEvent event)
{
// Dirty hack
if (getPlugin().getName().contains("Clans"))
return;
if (event.isCancelled())
return;
@ -296,7 +300,7 @@ public class Chat extends MiniPlugin
}
}
@EventHandler(priority = EventPriority.LOW)
@EventHandler(priority = EventPriority.NORMAL)
public void HandleChat(AsyncPlayerChatEvent event)
{
if (event.isCancelled())

View File

@ -39,6 +39,7 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
import mineplex.core.chat.MessageData;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -700,7 +701,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
{
if (clan == null)
{
UtilServer.broadcast(String.format(rank + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), event.getMessage()));
UtilServer.broadcast(String.format(rank + C.cYellow + "%s " + C.cWhite + "%s", event.getPlayer().getName(), _chat.getFilteredMessage(event.getPlayer(), event.getMessage())));
return;
}
@ -742,22 +743,44 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
}
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.HIGHEST)
public void handlePlayerChat(AsyncPlayerChatEvent event)
{
event.setCancelled(false);
_chat.HandleChat(event);
if (event.isCancelled())
{
return;
}
else
{
event.setCancelled(true);
PunishClient punishclient = _punish.GetClient(event.getPlayer().getName());
if (punishclient != null && punishclient.IsMuted())
{
return;
}
if (_chat.SilenceCheck(event.getPlayer()))
{
return;
}
// PunishClient punishclient = _punish.GetClient(event.getPlayer().getName());
//
// if (punishclient != null && punishclient.IsMuted())
// {
// return;
// }
//
// if (_chat.SilenceCheck(event.getPlayer()))
// {
// return;
// }
// MessageData lastMessage = _chat.lastMessage(event.getPlayer());
// long chatSlowTime = 1000L * _chat.getChatSlow();
// long timeDiff = System.currentTimeMillis() - lastMessage.getTimeSent();
// if (timeDiff < chatSlowTime && !_clientManager.Get(event.getPlayer()).GetRank().has(Rank.HELPER))
// {
//
// }
ClientClan client = Get(event.getPlayer());