disallow people from talking about hacks in chat.

This commit is contained in:
Mini-Chiss 2015-02-15 09:01:55 +13:00
parent 0071d6220d
commit e33fd3f249

View File

@ -305,6 +305,15 @@ public class Chat extends MiniPlugin
UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast."));
event.setCancelled(true);
}
else if (!_clientManager.Get(sender).GetRank().Has(Rank.HELPER) &&
msgContainsHack(event.getMessage()))
{
UtilPlayer.message(sender, F.main("Chat",
"Accusing players of cheating in-game is against the rules."
+ "If you think someone is cheating, please gather evidence and report it at "
+ F.link("www.mineplex.com/supporthub/")));
event.setCancelled(true);
}
else if (_playerLastMessage.containsKey(sender.getUniqueId()))
{
MessageData lastMessage = _playerLastMessage.get(sender.getUniqueId());
@ -327,6 +336,25 @@ public class Chat extends MiniPlugin
_playerLastMessage.put(sender.getUniqueId(), new MessageData(event.getMessage()));
}
private boolean msgContainsHack(String msg)
{
msg = msg.toLowerCase();
return (msg.contains(" hack ") ||
msg.contains(" hacker ") ||
msg.contains(" hacking ") ||
msg.contains(" cheat ") ||
msg.contains(" cheater ") ||
msg.contains(" cheating ") ||
msg.contains(" forcefield ") ||
msg.contains(" flyhack ") ||
msg.contains(" flyhacker ") ||
msg.contains(" flyhacking ") ||
msg.contains(" autoclick ") ||
msg.contains(" flyhacking ") ||
msg.contains(" aimbot "));
}
public String hasher(JSONArray hasharray, String message)
{
StringBuilder newmsg = new StringBuilder(message);