Rewrote how hackusations are detected.
Signed-off-by: Aaron Brock <TheMineBench@gmail.com>
This commit is contained in:
parent
1f0accd2a1
commit
9cedb3b742
@ -19,13 +19,9 @@ import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.chat.command.ChatSlowCommand;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.chat.command.BroadcastCommand;
|
||||
import mineplex.core.chat.command.ChatSlowCommand;
|
||||
import mineplex.core.chat.command.SilenceCommand;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -33,6 +29,10 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -50,7 +50,9 @@ public class Chat extends MiniPlugin
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
private PreferencesManager _preferences;
|
||||
|
||||
|
||||
private String[] _hackusations = {"hack", "hax", "hacker", "hacking", "cheat", "cheater", "cheating", "forcefield", "flyhack", "flyhacking", "autoclick", "aimbot"};
|
||||
|
||||
private String _filterUrl = "https://10.33.53.5:8003/content/item/moderate";
|
||||
private String _appId = "34018d65-466d-4a91-8e92-29ca49f022c4";
|
||||
private String _apiKey = "oUywMpwZcIzZO5AWnfDx";
|
||||
@ -273,7 +275,7 @@ public class Chat extends MiniPlugin
|
||||
*/
|
||||
|
||||
String filteredMsg = "";
|
||||
|
||||
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(response)).get("content").toString();
|
||||
if (filteredMsg.contains("parts"))
|
||||
{
|
||||
@ -289,19 +291,20 @@ public class Chat extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void HandleChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
Player sender = event.getPlayer();
|
||||
|
||||
//Bukkit.broadcastMessage("AsyncChat" + !_clientManager.Get(sender).GetRank().Has(Rank.HELPER));
|
||||
|
||||
if (SilenceCheck(sender))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
else if (_clientManager.Get(sender).GetRank() == Rank.ALL &&
|
||||
!Recharge.Instance.use(sender, "All Chat Message", 3000, false, false))
|
||||
{
|
||||
@ -315,11 +318,11 @@ 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) &&
|
||||
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."
|
||||
"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);
|
||||
@ -341,28 +344,21 @@ public class Chat extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!event.isCancelled())
|
||||
_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 "));
|
||||
msg = " " + msg.toLowerCase().replaceAll("[^a-z ]", "") + " ";
|
||||
for (String s : _hackusations) {
|
||||
if (msg.contains(" " + s + " ")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String hasher(JSONArray hasharray, String message)
|
||||
|
Loading…
Reference in New Issue
Block a user