diff --git a/pom.xml b/pom.xml
index 9216d3a..7f07dd3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
net.h31ix.anticheat
AntiCheat
- 1.3-DEV
+ 1.3.2-DEV
AntiCheat
http://H31IX.NET/
@@ -42,21 +42,21 @@
org.bukkit
craftbukkit
- 1.2.5-R3.0
+ 1.2.5-R4.0
jar
compile
org.bukkit
bukkit
- 1.2.5-R3.0
+ 1.2.5-R4.0
jar
compile
com.gmail.nossr50
mcMMO
- 1.3.08
+ 1.3.09-dev
jar
compile
diff --git a/src/main/java/net/h31ix/anticheat/Anticheat.java b/src/main/java/net/h31ix/anticheat/Anticheat.java
index 02b00e3..9fc1f32 100644
--- a/src/main/java/net/h31ix/anticheat/Anticheat.java
+++ b/src/main/java/net/h31ix/anticheat/Anticheat.java
@@ -30,9 +30,9 @@ import java.util.logging.Logger;
import net.h31ix.anticheat.event.*;
import net.h31ix.anticheat.manage.AnticheatManager;
import net.h31ix.anticheat.manage.CheckType;
-import net.h31ix.anticheat.util.Utilities;
import net.h31ix.anticheat.metrics.Metrics;
import net.h31ix.anticheat.metrics.Metrics.Graph;
+import net.h31ix.anticheat.util.Utilities;
import net.h31ix.anticheat.xray.XRayListener;
import net.h31ix.anticheat.xray.XRayTracker;
import org.bukkit.ChatColor;
@@ -56,6 +56,7 @@ public class Anticheat extends JavaPlugin
@Override
public void onDisable()
{
+ AnticheatManager.close();
Map map = manager.getPlayerManager().getLevels();
Iterator set = map.keySet().iterator();
while (set.hasNext())
@@ -206,10 +207,10 @@ public class Anticheat extends JavaPlugin
logger.log(Level.INFO, "Data for "+player.getName()+" re-applied from flatfile");
}
}
- if (verbose)
- {
- logger.log(Level.INFO, "Finished loading.");
- }
+ if (verbose)
+ {
+ logger.log(Level.INFO, "Finished loading.");
+ }
}
private void saveFile(String file, String url)
@@ -249,7 +250,7 @@ public class Anticheat extends JavaPlugin
}
if (verbose)
{
- logger.log(Level.INFO,"[AC] AntiCheat update has been downloaded and will be installed on next launch.");
+ logger.log(Level.INFO,"AntiCheat update has been downloaded and will be installed on next launch.");
}
}
}
@@ -306,9 +307,9 @@ public class Anticheat extends JavaPlugin
catch (Exception ex)
{
}
- if (!this.getDescription().getVersion().equalsIgnoreCase(v))
+ String version = this.getDescription().getVersion().split("-b")[0];
+ if (!version.equalsIgnoreCase(v))
{
- String version = this.getDescription().getVersion();
if (version.endsWith("-PRE") || version.endsWith("-DEV"))
{
if (version.replaceAll("-PRE", "").replaceAll("-DEV", "").equalsIgnoreCase(v))
diff --git a/src/main/java/net/h31ix/anticheat/CommandHandler.java b/src/main/java/net/h31ix/anticheat/CommandHandler.java
index 7931a93..2ed9cdf 100644
--- a/src/main/java/net/h31ix/anticheat/CommandHandler.java
+++ b/src/main/java/net/h31ix/anticheat/CommandHandler.java
@@ -52,13 +52,11 @@ public class CommandHandler implements CommandExecutor
private static final Server SERVER = Bukkit.getServer();
private static final int MED_THRESHOLD = 20;
private static final int HIGH_THRESHOLD = 50;
- private static final String ADMIN_PERM = "anticheat.admin";
- private static final String MOD_PERM = "anticheat.mod";
private static final String PERMISSIONS_ERROR = RED+"Insufficient Permissions.";
public void handleLog(CommandSender cs, String [] args)
{
- if(hasPermission(cs,"system.log") || hasPermission(cs,ADMIN_PERM))
+ if(Permission.SYSTEM_LOG.get(cs))
{
if(args[1].equalsIgnoreCase("enable"))
{
@@ -97,7 +95,7 @@ public class CommandHandler implements CommandExecutor
public void handleXRay(CommandSender cs, String [] args)
{
- if(hasPermission(cs,"system.xray") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
+ if(Permission.SYSTEM_XRAY.get(cs))
{
if(config.logXRay())
{
@@ -142,7 +140,7 @@ public class CommandHandler implements CommandExecutor
public void handleReset(CommandSender cs, String [] args)
{
- if(hasPermission(cs,"system.reset") || hasPermission(cs,ADMIN_PERM))
+ if(Permission.SYSTEM_RESET.get(cs))
{
List list = SERVER.matchPlayer(args[1]);
if(list.size() == 1)
@@ -180,7 +178,7 @@ public class CommandHandler implements CommandExecutor
if(cs instanceof Player)
{
Player sender = (Player)cs;
- if(hasPermission(cs,"system.spy") || hasPermission(cs,MOD_PERM))
+ if(Permission.SYSTEM_SPY.get(cs))
{
if(!args[1].equalsIgnoreCase("off"))
{
@@ -236,7 +234,7 @@ public class CommandHandler implements CommandExecutor
public void handleHelp(CommandSender cs)
{
- if(hasPermission(cs,"system.help") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
+ if(Permission.SYSTEM_HELP.get(cs))
{
String base = "/AntiCheat ";
cs.sendMessage("----------------------["+GREEN+"AntiCheat"+WHITE+"]----------------------");
@@ -259,7 +257,7 @@ public class CommandHandler implements CommandExecutor
public void handleUpdate(CommandSender cs)
{
- if(hasPermission(cs,"system.update") || hasPermission(cs,ADMIN_PERM))
+ if(Permission.SYSTEM_UPDATE.get(cs))
{
cs.sendMessage("Running "+GREEN+"AntiCheat "+WHITE+"v"+GREEN+Anticheat.getVersion());
cs.sendMessage("-----------------------------------------------------");
@@ -289,7 +287,7 @@ public class CommandHandler implements CommandExecutor
public void handleReport(CommandSender cs)
{
- if(hasPermission(cs,"system.report") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
+ if(Permission.SYSTEM_REPORT.get(cs))
{
getPlayers();
if(!low.isEmpty())
@@ -325,7 +323,7 @@ public class CommandHandler implements CommandExecutor
public void handlePlayerReport(CommandSender cs,String [] args)
{
- if(hasPermission(cs,"system.report") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
+ if(Permission.SYSTEM_REPORT.get(cs))
{
List list = SERVER.matchPlayer(args[1]);
if(list.size() == 1)
@@ -439,7 +437,7 @@ public class CommandHandler implements CommandExecutor
public void handleReload(CommandSender cs)
{
- if(hasPermission(cs,"system.reload") || hasPermission(cs,ADMIN_PERM))
+ if(Permission.SYSTEM_RELOAD.get(cs))
{
config.load();
cs.sendMessage(GREEN+"AntiCheat configuration reloaded.");
@@ -517,17 +515,6 @@ public class CommandHandler implements CommandExecutor
return true;
}
- public boolean hasPermission(CommandSender cs, String permission)
- {
- if(cs instanceof Player)
- {
- return ((Player)cs).hasPermission("anticheat."+permission);
- }
- else
- {
- return true;
- }
- }
public void getPlayers()
{
high.clear();
diff --git a/src/main/java/net/h31ix/anticheat/Configuration.java b/src/main/java/net/h31ix/anticheat/Configuration.java
index cfae76d..db3708c 100644
--- a/src/main/java/net/h31ix/anticheat/Configuration.java
+++ b/src/main/java/net/h31ix/anticheat/Configuration.java
@@ -45,6 +45,8 @@ public class Configuration
private boolean alertXRay;
private boolean autoUpdate;
private boolean verboseStartup;
+ private boolean chatSpam;
+ private boolean commandSpam;
private int fileLogLevel = 0;
private String updateFolder;
private static Language language;
@@ -97,6 +99,16 @@ public class Configuration
return verboseStartup;
}
+ public boolean chatSpam()
+ {
+ return chatSpam;
+ }
+
+ public boolean commandSpam()
+ {
+ return commandSpam;
+ }
+
public String updateFolder()
{
return updateFolder;
@@ -140,7 +152,7 @@ public class Configuration
config.set("Enable in", w);
save();
}
- worlds = (List)(config.getList("Enable in"));
+ worlds = config.getStringList("Enable in");
if(config.getString("XRay.Log xray stats") == null)
{
config.set("XRay.Log xray stats", true);
@@ -170,7 +182,19 @@ public class Configuration
config.set("System.File log level", 1);
save();
}
- fileLogLevel = config.getInt("System.File log level");
+ fileLogLevel = config.getInt("System.File log level");
+ if(config.getString("System.Block chat spam") == null)
+ {
+ config.set("System.Block chat spam", true);
+ save();
+ }
+ chatSpam = config.getBoolean("System.Block chat spam");
+ if(config.getString("System.Block command spam") == null)
+ {
+ config.set("System.Block command spam", true);
+ save();
+ }
+ commandSpam = config.getBoolean("System.Block command spam");
}
public String getResult(String event)
diff --git a/src/main/java/net/h31ix/anticheat/Language.java b/src/main/java/net/h31ix/anticheat/Language.java
index ef6637d..6edc9c7 100644
--- a/src/main/java/net/h31ix/anticheat/Language.java
+++ b/src/main/java/net/h31ix/anticheat/Language.java
@@ -1,6 +1,23 @@
+/*
+ * AntiCheat for Bukkit.
+ * Copyright (C) 2012 H31IX http://h31ix.net
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package net.h31ix.anticheat;
-import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
public class Language
diff --git a/src/main/java/net/h31ix/anticheat/Permission.java b/src/main/java/net/h31ix/anticheat/Permission.java
new file mode 100644
index 0000000..cf94dbc
--- /dev/null
+++ b/src/main/java/net/h31ix/anticheat/Permission.java
@@ -0,0 +1,70 @@
+/*
+ * AntiCheat for Bukkit.
+ * Copyright (C) 2012 H31IX http://h31ix.net
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package net.h31ix.anticheat;
+
+import org.bukkit.command.CommandSender;
+
+public enum Permission
+{
+ /* Check Nodes */
+ CHECK_ZOMBE_FLY,
+ CHECK_ZOMBE_NOCLIP,
+ CHECK_ZOMBE_CHEAT,
+ CHECK_FLY,
+ CHECK_WATERWALK,
+ CHECK_NOSWING,
+ CHECK_FASTBREAK,
+ CHECK_FASTPLACE,
+ CHECK_SPAM,
+ CHECK_SPRINT,
+ CHECK_SNEAK,
+ CHECK_SPEED,
+ CHECK_SPIDER,
+ CHECK_NOFALL,
+ CHECK_FASTBOW,
+ CHECK_FASTEAT,
+ CHECK_FASTHEAL,
+ CHECK_FORCEFIELD,
+ CHECK_XRAY,
+ CHECK_LONGREACH,
+ CHECK_FASTPROJECTILE,
+ CHECK_ITEMSPAM,
+
+ /* System Nodes */
+ SYSTEM_LOG,
+ SYSTEM_XRAY,
+ SYSTEM_RESET,
+ SYSTEM_SPY,
+ SYSTEM_HELP,
+ SYSTEM_UPDATE,
+ SYSTEM_REPORT,
+ SYSTEM_RELOAD;
+
+ public boolean get(CommandSender cs)
+ {
+ return cs.hasPermission(toString());
+ }
+
+ @Override
+ public String toString()
+ {
+ return "anticheat." + this.name().toLowerCase().replace("_", ".");
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/net/h31ix/anticheat/api/AnticheatAPI.java b/src/main/java/net/h31ix/anticheat/api/AnticheatAPI.java
index e351b4e..323b00b 100644
--- a/src/main/java/net/h31ix/anticheat/api/AnticheatAPI.java
+++ b/src/main/java/net/h31ix/anticheat/api/AnticheatAPI.java
@@ -114,7 +114,7 @@ public class AnticheatAPI
*/
public boolean willCheck(Player player, CheckType type)
{
- return chk.willCheck(player, type);
+ return chk.willCheck(player, type);
}
//PlayerManager API
diff --git a/src/main/java/net/h31ix/anticheat/event/EventListener.java b/src/main/java/net/h31ix/anticheat/event/EventListener.java
index 9a1a40f..0ed408e 100644
--- a/src/main/java/net/h31ix/anticheat/event/EventListener.java
+++ b/src/main/java/net/h31ix/anticheat/event/EventListener.java
@@ -47,9 +47,9 @@ public class EventListener implements Listener
{
USAGE_LIST.put(type, getCheats(type)+1);
type.logUse(player);
- if(PLUGIN.getManager().getConfiguration().getFileLogLevel() == 2 && type.getUses(player) % 10 == 0)
+ if(Anticheat.getManager().getConfiguration().getFileLogLevel() == 2 && type.getUses(player) % 10 == 0)
{
- PLUGIN.getManager().fileLog(player.getName()+" has triggered multiple "+type+" checks.");
+ Anticheat.getManager().fileLog(player.getName()+" has triggered multiple "+type+" checks.");
}
}
@@ -104,7 +104,8 @@ public class EventListener implements Listener
return CHECK_MANAGER;
}
- public static AnticheatManager getManager() {
+ public static AnticheatManager getManager()
+ {
return Anticheat.getManager();
}
diff --git a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java
index fa28537..6b27a39 100644
--- a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java
+++ b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java
@@ -18,6 +18,8 @@
package net.h31ix.anticheat.event;
+import net.h31ix.anticheat.Anticheat;
+import net.h31ix.anticheat.Configuration;
import net.h31ix.anticheat.manage.Backend;
import net.h31ix.anticheat.manage.CheckManager;
import net.h31ix.anticheat.manage.CheckType;
@@ -40,15 +42,21 @@ import org.bukkit.inventory.PlayerInventory;
public class PlayerListener extends EventListener
{
private final Backend backend = getBackend();
- private final CheckManager checkManager = getCheckManager();
+ private final CheckManager checkManager = getCheckManager();
+ private final Configuration config = Anticheat.getManager().getConfiguration();
- @EventHandler
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event)
{
Player player = event.getPlayer();
- if(checkManager.willCheck(player, CheckType.SPAM))
+ if(checkManager.willCheck(player, CheckType.SPAM) && config.commandSpam())
{
backend.logChat(player);
+ if(backend.checkSpam(player, event.getMessage()))
+ {
+ event.setCancelled(true);
+ player.sendMessage(ChatColor.RED+"Please do not spam.");
+ }
}
}
@@ -90,11 +98,29 @@ public class PlayerListener extends EventListener
}
}
- @EventHandler(ignoreCancelled = true)
+ @EventHandler
+ public void onPlayerVelocity(PlayerVelocityEvent event)
+ {
+ Player player = event.getPlayer();
+ if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY)) //@h31ix: Change if necessary. I'm not sure what perms should go here :3
+ {
+ if(backend.justVelocity(player))
+ {
+ if(backend.extendVelocityTime(player))
+ {
+ event.setCancelled(true);
+ return; // don't log it lol.
+ }
+ }
+ backend.logVelocity(player);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerChat(PlayerChatEvent event)
{
Player player = event.getPlayer();
- if(checkManager.willCheck(player, CheckType.SPAM))
+ if(checkManager.willCheck(player, CheckType.SPAM) && config.chatSpam())
{
backend.logChat(player);
if(backend.checkSpam(player, event.getMessage()))
@@ -237,48 +263,21 @@ public class PlayerListener extends EventListener
double x = distance.getXDifference();
double y = distance.getYDifference();
double z = distance.getZDifference();
- backend.checkAscension(player,from.getY(),to.getY());
+ backend.logAscension(player,from.getY(),to.getY());
if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && backend.checkFlight(player, distance))
{
from.setX(from.getX()-1);
from.setY(from.getY()-1);
from.setZ(from.getZ()-1);
event.setTo(from);
- //Lets really give this flyer a real pushdown.
- Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-2, player.getLocation().getZ());
- Block newBlock = newLocation.getBlock();
- if(newBlock.getTypeId() != 0)
- {
- event.setTo(newLocation);
- }
+ Block lower = player.getWorld().getHighestBlockAt(from);
+ player.teleport(new Location(lower.getWorld(), lower.getLocation().getX(),lower.getLocation().getY()+2,lower.getLocation().getZ()));
log("tried to fly.",player,CheckType.FLY);
}
- if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && backend.checkYAxis(player, distance))
+ if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && (backend.checkYAxis(player, distance) || backend.checkAscension(player,from.getY(),to.getY())))
{
- from.setX(from.getX()-1);
- from.setY(from.getY()-1);
- from.setZ(from.getZ()-1);
- if(from.getBlock().getTypeId() == 0)
- {
- event.setTo(from);
- }
- for(int i= 5;i>0;i--)
- {
- Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-i, player.getLocation().getZ());
- Block lower = newLocation.getBlock();
- if(lower.getTypeId() == 0)
- {
- player.teleport(newLocation);
- break;
- }
- }
- //Lets really give this flyer a real pushdown.
- Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-2, player.getLocation().getZ());
- Block newBlock = newLocation.getBlock();
- if(newBlock.getTypeId() != 0)
- {
- event.setTo(newLocation);
- }
+ Block lower = player.getWorld().getHighestBlockAt(player.getLocation());
+ player.teleport(new Location(lower.getWorld(), lower.getLocation().getX(),lower.getLocation().getY()+2,lower.getLocation().getZ()));
log("tried to fly on y-axis", player, CheckType.FLY);
}
if(checkManager.willCheck(player, CheckType.SPEED) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && checkManager.willCheck(player, CheckType.FLY))
@@ -286,7 +285,7 @@ public class PlayerListener extends EventListener
if(event.getFrom().getY() < event.getTo().getY() && backend.checkYSpeed(player, y))
{
event.setTo(from);
- log("tried to ascend to fast.",player,CheckType.SPEED);
+ log("tried to ascend too fast.",player,CheckType.SPEED);
}
if(backend.checkXZSpeed(player,x,z))
{
@@ -300,31 +299,34 @@ public class PlayerListener extends EventListener
log("tried avoid fall damage.",player,CheckType.NOFALL);
}
}
- @EventHandler(ignoreCancelled = true)
+ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void checkSpeed(PlayerMoveEvent event)
{
Player player = event.getPlayer();
Location from = event.getFrom();
- Location to = event.getTo();
- Distance distance = new Distance(from, to);
- double x = distance.getXDifference();
- double y = distance.getYDifference();
- double z = distance.getZDifference();
- if(checkManager.willCheck(player, CheckType.WATER_WALK) && backend.checkWaterWalk(player,x,z))
+ Location to = event.getTo();
+ if(event.getTo() != event.getFrom())
{
- event.setTo(from);
- log("tried to walk on water.",player,CheckType.WATER_WALK);
- }
- if(checkManager.willCheck(player, CheckType.SNEAK) && backend.checkSneak(player,x,z))
- {
- event.setTo(from);
- player.setSneaking(false);
- log("tried to sneak too fast.",player,CheckType.SNEAK);
- }
- if(checkManager.willCheck(player, CheckType.SPIDER) && backend.checkSpider(player, y))
- {
- event.setTo(from);
- log("tried to climb a wall.",player,CheckType.SPIDER);
- }
+ Distance distance = new Distance(from, to);
+ double x = distance.getXDifference();
+ double y = distance.getYDifference();
+ double z = distance.getZDifference();
+ if(checkManager.willCheck(player, CheckType.WATER_WALK) && backend.checkWaterWalk(player,x,z))
+ {
+ event.setTo(from);
+ log("tried to walk on water.",player,CheckType.WATER_WALK);
+ }
+ if(checkManager.willCheck(player, CheckType.SNEAK) && backend.checkSneak(player,x,z))
+ {
+ event.setTo(from);
+ player.setSneaking(false);
+ log("tried to sneak too fast.",player,CheckType.SNEAK);
+ }
+ if(checkManager.willCheck(player, CheckType.SPIDER) && backend.checkSpider(player, y))
+ {
+ event.setTo(from);
+ log("tried to climb a wall.",player,CheckType.SPIDER);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/main/java/net/h31ix/anticheat/manage/AnticheatManager.java b/src/main/java/net/h31ix/anticheat/manage/AnticheatManager.java
index 98e3fcb..570c321 100644
--- a/src/main/java/net/h31ix/anticheat/manage/AnticheatManager.java
+++ b/src/main/java/net/h31ix/anticheat/manage/AnticheatManager.java
@@ -19,11 +19,9 @@
package net.h31ix.anticheat.manage;
import java.io.File;
-import java.io.IOException;
import java.util.logging.*;
import net.h31ix.anticheat.Anticheat;
import net.h31ix.anticheat.Configuration;
-import net.h31ix.anticheat.util.ConsoleFormatter;
import net.h31ix.anticheat.util.FileFormatter;
import net.h31ix.anticheat.xray.XRayTracker;
import org.bukkit.ChatColor;
@@ -42,15 +40,15 @@ public class AnticheatManager
private CheckManager checkManager = null;
private Backend backend = null;
private static Logger LOGGER, FILE_LOGGER;
- private static Handler handler;
+ private static Handler fileHandler;
private static final int LOG_LEVEL_HIGH = 3;
public AnticheatManager(Anticheat instance)
{
plugin = instance;
// now load all the others!!!!!
- LOGGER = plugin.getAnticheatLogger();
- FILE_LOGGER = LOGGER;
+ LOGGER = Logger.getLogger("Minecraft");
+ FILE_LOGGER = Logger.getLogger("Minecraft");
configuration = new Configuration(this);
xrayTracker = new XRayTracker();
playerManager = new PlayerManager(this);
@@ -63,27 +61,20 @@ public class AnticheatManager
{
file.mkdir();
}
- handler = new FileHandler(plugin.getDataFolder()+"/log/anticheat.log.%u.txt",true);
- handler.setFormatter(new FileFormatter());
- handler.setLevel(Level.INFO);
- } catch (IOException ex) {
- LOGGER.log(Level.SEVERE, null, ex);
- } catch (SecurityException ex) {
+ fileHandler = new FileHandler(plugin.getDataFolder()+"/log/anticheat.log",true);
+ fileHandler.setFormatter(new FileFormatter());
+ } catch (Exception ex) {
LOGGER.log(Level.SEVERE, null, ex);
}
FILE_LOGGER.setUseParentHandlers(false);
- FILE_LOGGER.addHandler(handler);
- LOGGER.setUseParentHandlers(false);
- Handler chandler = new ConsoleHandler();
- chandler.setFormatter(new ConsoleFormatter());
- LOGGER.addHandler(chandler);
+ FILE_LOGGER.addHandler(fileHandler);
}
public void log(String message)
{
if(getConfiguration().logConsole())
{
- LOGGER.log(Level.WARNING, ChatColor.stripColor(message)); //This is temporary. Is something wrong with jline?
+ LOGGER.info("[AntiCheat] "+ChatColor.stripColor(message)); //This is temporary. Is something wrong with jline?
}
if(getConfiguration().getFileLogLevel() == LOG_LEVEL_HIGH)
{
@@ -93,7 +84,7 @@ public class AnticheatManager
public void fileLog(String message)
{
- FILE_LOGGER.log(Level.WARNING, message);
+ FILE_LOGGER.info(message);
}
public Anticheat getPlugin()
@@ -125,4 +116,8 @@ public class AnticheatManager
{
return backend;
}
+ public static void close()
+ {
+ fileHandler.close();
+ }
}
diff --git a/src/main/java/net/h31ix/anticheat/manage/Backend.java b/src/main/java/net/h31ix/anticheat/manage/Backend.java
index 2cf2466..4b0683e 100644
--- a/src/main/java/net/h31ix/anticheat/manage/Backend.java
+++ b/src/main/java/net/h31ix/anticheat/manage/Backend.java
@@ -70,8 +70,14 @@ public class Backend
private static final int FLIGHT_LIMIT = 4;
private static final int Y_MAXVIOLATIONS = 1;
private static final int Y_MAXVIOTIME = 5000;
+ private static final int VELOCITY_TIME = 60;
+ private static final long VELOCITY_SCHETIME = 2;
+ private static final long VELOCITY_CHECKTIME = 2100;
+ private static final long VELOCITY_PREVENT = 5000;
+ private static final int VELOCITY_MAXTIMES = 2;
private static final int NOFALL_LIMIT = 5;
+ private static final int ASCENSION_COUNT_MAX = 8;
private static final int WATER_ASCENSION_VIOLATION_MAX = 13;
private static final int WATER_SPEED_VIOLATION_MAX = 4;
@@ -80,6 +86,7 @@ public class Backend
private static final int HEAL_MIN = 35;
private static final int ANIMATION_MIN = 60;
private static final int CHAT_MIN = 100;
+ private static final int CHAT_REPEAT_MIN = 260;
private static final int BOW_MIN = 2;
private static final int SPRINT_MIN = 2;
private static final int BLOCK_BREAK_MIN = 1;
@@ -106,7 +113,6 @@ public class Backend
private AnticheatManager micromanage = null;
private List droppedItem = new ArrayList();
- private List animated = new ArrayList();
private List movingExempt = new ArrayList();
private List brokenBlock = new ArrayList();
private List placedBlock = new ArrayList();
@@ -119,6 +125,8 @@ public class Backend
private List instantBreakExempt = new ArrayList();
private List isAscending = new ArrayList();
private List trackingProjectiles = new ArrayList();
+ private List velocitizing = new ArrayList();
+ private Map ascensionCount = new HashMap();
private Map oldMessage = new HashMap();
private Map lastMessage = new HashMap();
private Map flightViolation = new HashMap();
@@ -140,6 +148,9 @@ public class Backend
private Map waterAscensionViolation = new HashMap();
private Map waterSpeedViolation = new HashMap();
private Map projectilesShot = new HashMap();
+ private Map velocitized = new HashMap();
+ private Map velocitytrack = new HashMap();
+ private Map animated = new HashMap();
public Backend(AnticheatManager instance)
{
@@ -158,7 +169,7 @@ public class Backend
public boolean checkSpider(Player player,double y)
{
- if(y <= LADDER_Y_MAX && y >= LADDER_Y_MIN && player.getLocation().getBlock().getType() != Material.VINE && player.getLocation().getBlock().getType() != Material.LADDER)
+ if(y <= LADDER_Y_MAX && y >= LADDER_Y_MIN && !Utilities.isOnLadder(player))
{
return true;
}
@@ -167,7 +178,7 @@ public class Backend
public boolean checkYSpeed(Player player,double y)
{
- if(/*!player.isFlying() &&*/ player.getVehicle() == null && y > Y_SPEED_MAX)
+ if(!player.isInsideVehicle() && y > Y_SPEED_MAX && !isVelocity(player) && !player.hasPotionEffect(PotionEffectType.JUMP))
{
return true;
}
@@ -217,17 +228,17 @@ public class Backend
{
return x > XZ_SPEED_MAX_FLY || z > XZ_SPEED_MAX_FLY;
}
- if(!player.isSprinting())
- {
- return x > XZ_SPEED_MAX || z > XZ_SPEED_MAX;
- }
else if (player.hasPotionEffect(PotionEffectType.SPEED))
{
return x > XZ_SPEED_MAX_POTION || z > XZ_SPEED_MAX_POTION;
}
+ else if(player.isSprinting())
+ {
+ return x > XZ_SPEED_MAX_SPRINT || z > XZ_SPEED_MAX_SPRINT;
+ }
else
{
- return x > XZ_SPEED_MAX_SPRINT || z > XZ_SPEED_MAX_SPRINT;
+ return x > XZ_SPEED_MAX || z > XZ_SPEED_MAX;
}
}
else
@@ -377,7 +388,7 @@ public class Backend
{
return false;
}
- if(!isMovingExempt(player))
+ if(!isMovingExempt(player) && !Utilities.isOnLadder(player) && !player.isInsideVehicle() && !Utilities.isInWater(player))
{
double y1 = player.getLocation().getY();
String name = player.getName();
@@ -400,7 +411,7 @@ public class Backend
yAxisLastViolation.put(name, System.currentTimeMillis());
if(g.getBlock().getTypeId() == 0)
{
- player.teleport(g);
+ player.teleport(g);
}
return true;
}
@@ -420,7 +431,7 @@ public class Backend
yAxisLastViolation.put(name, System.currentTimeMillis());
if(g.getBlock().getTypeId() == 0)
{
- player.teleport(g);
+ player.teleport(g);
}
return true;
}
@@ -448,10 +459,10 @@ public class Backend
double y1 = distance.fromY();
double y2 = distance.toY();
Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);
- if(y1 == y2 && !isMovingExempt(player) && player.getVehicle() == null && player.getFallDistance() == 0 && !Utilities.isOnLilyPad(player))
+ if(y1 == y2 && !isMovingExempt(player) && !player.isInsideVehicle() && player.getFallDistance() == 0 && !Utilities.isOnLilyPad(player))
{
String name = player.getName();
- if(Utilities.cantStandAt(block) && !Utilities.isOnLilyPad(player) && !Utilities.canStand(player.getLocation().getBlock()) && !Utilities.isSubmersed(player))
+ if(Utilities.cantStandAt(block) && !Utilities.isOnLilyPad(player) && Utilities.cantStandAt(player.getLocation().getBlock()) && !Utilities.isInWater(player))
{
int violation = 1;
if(!flightViolation.containsKey(name))
@@ -488,16 +499,47 @@ public class Backend
return false;
}
- public void checkAscension(Player player, double y1, double y2)
+ public void logAscension(Player player, double y1, double y2)
{
+ String name = player.getName();
if(y1 < y2)
{
- isAscending.add(player.getName());
+ isAscending.add(name);
}
else
{
isAscending.remove(player.getName());
+ }
+ }
+
+ public boolean checkAscension(Player player, double y1, double y2)
+ {
+ int max = ASCENSION_COUNT_MAX;
+ if(player.hasPotionEffect(PotionEffectType.JUMP))
+ {
+ max+=12;
}
+ Block block = player.getLocation().getBlock();
+ if(!isMovingExempt(player) && !Utilities.isInWater(player) && !Utilities.isOnLadder(player) && !player.isInsideVehicle())
+ {
+ String name = player.getName();
+ if(y1 < y2)
+ {
+ if(!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() && !block.getRelative(BlockFace.EAST).isLiquid() && !block.getRelative(BlockFace.WEST).isLiquid())
+ {
+ increment(player, ascensionCount, max);
+ if(ascensionCount.get(name) >= max)
+ {
+ return true;
+ }
+ }
+ }
+ else
+ {
+ ascensionCount.put(name,0);
+ }
+ }
+ return false;
}
public boolean checkSwing(Player player, Block block)
@@ -679,7 +721,7 @@ public class Backend
else
{
int amount = chatLevel.get(name)+1;
- chatLevel.put(name, amount);
+ logEvent(chatLevel,player,amount,CHAT_MIN);
checkChatLevel(player, amount);
}
}
@@ -689,7 +731,8 @@ public class Backend
String name = player.getName();
if(lastMessage.get(name) == null)
{
- lastMessage.put(name, msg);
+ logEvent(lastMessage,player,msg,CHAT_REPEAT_MIN);
+ //lastMessage.put(name, msg);
}
else
{
@@ -699,8 +742,10 @@ public class Backend
}
else
{
- oldMessage.put(name, lastMessage.get(name));
- lastMessage.put(name, msg);
+ logEvent(oldMessage,player,lastMessage.get(name),CHAT_REPEAT_MIN);
+ //oldMessage.put(name, lastMessage.get(name));
+ logEvent(oldMessage,player,msg,CHAT_REPEAT_MIN);
+ //lastMessage.put(name, msg);
return false;
}
}
@@ -741,7 +786,49 @@ public class Backend
public boolean justBroke(Player player)
{
return brokenBlock.contains(player.getName());
- }
+ }
+
+ public void logVelocity(final Player player)
+ {
+ logEvent(velocitizing,player,VELOCITY_TIME);
+ velocitized.put(player.getName(), System.currentTimeMillis());
+ }
+
+ public boolean justVelocity(Player player)
+ {
+ return isVelocity(player) || (velocitized.containsKey(player.getName()) ? (System.currentTimeMillis() - velocitized.get(player.getName())) < VELOCITY_CHECKTIME : false);
+ }
+
+ public boolean isVelocity(Player player)
+ {
+ return velocitizing.contains(player.getName());
+ }
+
+ public boolean extendVelocityTime(final Player player)
+ {
+ if(velocitytrack.containsKey(player.getName()))
+ {
+ velocitytrack.put(player.getName(), velocitytrack.get(player.getName()) + 1);
+ if(velocitytrack.get(player.getName()) > VELOCITY_MAXTIMES) {
+ velocitized.put(player.getName(), System.currentTimeMillis() + VELOCITY_PREVENT);
+ micromanage.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(micromanage.getPlugin(), new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ velocitytrack.put(player.getName(), 0);
+ }
+ }, VELOCITY_SCHETIME * 20L);
+ return true;
+ }
+ }
+ else
+ {
+ velocitytrack.put(player.getName(), 0);
+ }
+
+ return false;
+ }
public void logBlockPlace(final Player player)
{
@@ -755,7 +842,7 @@ public class Backend
public void logAnimation(final Player player)
{
- logEvent(animated,player,ANIMATION_MIN);
+ logEvent(animated,player,player.getLocation(),ANIMATION_MIN);
increment(player,blockPunches,BLOCK_PUNCH_MIN);
}
@@ -767,7 +854,7 @@ public class Backend
public boolean justAnimated(Player player)
{
- return animated.contains(player.getName());
+ return animated.containsKey(player.getName());
}
public void logProjectile(final Player player, final EventListener e)
@@ -837,7 +924,7 @@ public class Backend
public boolean isMovingExempt(Player player)
{
- return movingExempt.contains(player.getName()) || player.isFlying();
+ return movingExempt.contains(player.getName()) || player.isFlying() || isVelocity(player);
}
public boolean isAscending(Player player)
@@ -845,8 +932,9 @@ public class Backend
return isAscending.contains(player.getName());
}
- public boolean isSpeedExempt(Player player) {
- return movingExempt.contains(player.getName());
+ public boolean isSpeedExempt(Player player)
+ {
+ return movingExempt.contains(player.getName()) || isVelocity(player);
}
public void logDroppedItem(final Player player)
@@ -876,16 +964,23 @@ public class Backend
@SuppressWarnings("unchecked")
private void logEvent(@SuppressWarnings("rawtypes") final Map map, final Player player, final Object obj, long time)
{
- map.put(player,obj);
+ map.put(player.getName(),obj);
micromanage.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(micromanage.getPlugin(), new Runnable()
{
@Override
public void run()
{
- map.remove(player);
+ if(map.get(player.getName()) == obj)
+ {
+ map.remove(player.getName());
+ }
+ else
+ {
+ //Don't remove this, for some reason it's fixing chat bugs.
+ }
}
}, time);
- }
+ }
private void checkChatLevel(Player player, int amount)
{
if(amount >= CHAT_WARN_LEVEL)
diff --git a/src/main/java/net/h31ix/anticheat/manage/CheckManager.java b/src/main/java/net/h31ix/anticheat/manage/CheckManager.java
index 4c6d41b..0c61949 100644
--- a/src/main/java/net/h31ix/anticheat/manage/CheckManager.java
+++ b/src/main/java/net/h31ix/anticheat/manage/CheckManager.java
@@ -84,17 +84,12 @@ public class CheckManager
return exemptList.containsEntry(player.getName(), type);
}
- private boolean hasPermission(Player player, String permission)
- {
- return player.hasPermission(permission) || player.hasPermission("anticheat.exempt");
- }
-
public boolean willCheck(Player player, CheckType type)
{
return isActive(type)
&& manager.getConfiguration().checkInWorld(player.getWorld())
&& !isExempt(player, type)
- && !hasPermission(player, type.getPermission());
+ && !type.checkPermission(player);
}
public int getExempt()
diff --git a/src/main/java/net/h31ix/anticheat/manage/CheckType.java b/src/main/java/net/h31ix/anticheat/manage/CheckType.java
index 3c5a259..77e8fe0 100644
--- a/src/main/java/net/h31ix/anticheat/manage/CheckType.java
+++ b/src/main/java/net/h31ix/anticheat/manage/CheckType.java
@@ -20,6 +20,7 @@ package net.h31ix.anticheat.manage;
import java.util.HashMap;
import java.util.Map;
+import net.h31ix.anticheat.Permission;
import org.bukkit.entity.Player;
@@ -31,41 +32,40 @@ import org.bukkit.entity.Player;
public enum CheckType
{
- ZOMBE_FLY("anticheat.zombe.fly"),
- ZOMBE_NOCLIP("anticheat.zombe.noclip"),
- ZOMBE_CHEAT("anticheat.zombe.cheat"),
- FLY("anticheat.fly"),
- WATER_WALK("anticheat.waterwalk"),
- NO_SWING("anticheat.noswing"),
- FAST_BREAK("anticheat.fastbreak"),
- INTERACTION("anticheat.interaction"),
- FAST_PLACE("anticheat.fastplace"),
- SPAM("anticheat.spam"),
- SPRINT("anticheat.sprint"),
- SNEAK("anticheat.sneak"),
- SPEED("anticheat.speed"),
- SPIDER("anticheat.spider"),
- NOFALL("anticheat.nofall"),
- FAST_BOW("anticheat.fastbow"),
- FAST_EAT("anticheat.fasteat"),
- FAST_HEAL("anticheat.fastheal"),
- FORCEFIELD("anticheat.forcefield"),
- XRAY("anticheat.xray"),
- LONG_REACH("anticheat.longreach"),
- FAST_PROJECTILE("anticheat.projectile"),
- ITEM_SPAM("anticheat.itemspam");
+ ZOMBE_FLY(Permission.CHECK_ZOMBE_FLY),
+ ZOMBE_NOCLIP(Permission.CHECK_ZOMBE_NOCLIP),
+ ZOMBE_CHEAT(Permission.CHECK_ZOMBE_CHEAT),
+ FLY(Permission.CHECK_FLY),
+ WATER_WALK(Permission.CHECK_WATERWALK),
+ NO_SWING(Permission.CHECK_NOSWING),
+ FAST_BREAK(Permission.CHECK_FASTBREAK),
+ FAST_PLACE(Permission.CHECK_FASTPLACE),
+ SPAM(Permission.CHECK_SPAM),
+ SPRINT(Permission.CHECK_SPRINT),
+ SNEAK(Permission.CHECK_SNEAK),
+ SPEED(Permission.CHECK_SPEED),
+ SPIDER(Permission.CHECK_SPIDER),
+ NOFALL(Permission.CHECK_NOFALL),
+ FAST_BOW(Permission.CHECK_FASTBOW),
+ FAST_EAT(Permission.CHECK_FASTEAT),
+ FAST_HEAL(Permission.CHECK_FASTHEAL),
+ FORCEFIELD(Permission.CHECK_FORCEFIELD),
+ XRAY(Permission.CHECK_XRAY),
+ LONG_REACH(Permission.CHECK_LONGREACH),
+ FAST_PROJECTILE(Permission.CHECK_FASTPROJECTILE),
+ ITEM_SPAM(Permission.CHECK_ITEMSPAM);
- private final String permission;
+ private final Permission permission;
private final Map level = new HashMap();
- private CheckType(String permission)
+ private CheckType(Permission perm)
{
- this.permission = permission;
+ this.permission = perm;
}
- public String getPermission()
+ public boolean checkPermission(Player player)
{
- return this.permission;
+ return permission.get(player);
}
public void logUse(Player player)
diff --git a/src/main/java/net/h31ix/anticheat/metrics/Metrics.java b/src/main/java/net/h31ix/anticheat/metrics/Metrics.java
index ab6d044..48ce4df 100644
--- a/src/main/java/net/h31ix/anticheat/metrics/Metrics.java
+++ b/src/main/java/net/h31ix/anticheat/metrics/Metrics.java
@@ -213,10 +213,10 @@ public class Metrics {
private void postPlugin(boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
PluginDescriptionFile description = plugin.getDescription();
-
+
// Construct the post data
String data = encode("guid") + '=' + encode(guid)
- + encodeDataPair("version", description.getVersion())
+ + encodeDataPair("version", description.getVersion().split("-b")[0])
+ encodeDataPair("server", Bukkit.getVersion())
+ encodeDataPair("players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length))
+ encodeDataPair("revision", String.valueOf(REVISION));
diff --git a/src/main/java/net/h31ix/anticheat/util/ConsoleFormatter.java b/src/main/java/net/h31ix/anticheat/util/ConsoleFormatter.java
index 8a6d309..cb7dfd5 100644
--- a/src/main/java/net/h31ix/anticheat/util/ConsoleFormatter.java
+++ b/src/main/java/net/h31ix/anticheat/util/ConsoleFormatter.java
@@ -1,3 +1,21 @@
+/*
+ * AntiCheat for Bukkit.
+ * Copyright (C) 2012 H31IX http://h31ix.net
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package net.h31ix.anticheat.util;
import java.util.logging.Formatter;
@@ -6,10 +24,9 @@ import java.util.logging.LogRecord;
public class ConsoleFormatter extends Formatter {
@Override
- public String format(LogRecord record) {
- StringBuilder output = new StringBuilder()
- .append(record.getMessage()).append(' ');
+ public String format(LogRecord record)
+ {
+ StringBuilder output = new StringBuilder().append(record.getMessage()).append(' ');
return output.toString();
}
-
}
\ No newline at end of file
diff --git a/src/main/java/net/h31ix/anticheat/util/FileFormatter.java b/src/main/java/net/h31ix/anticheat/util/FileFormatter.java
index 54cf362..6b77e3d 100644
--- a/src/main/java/net/h31ix/anticheat/util/FileFormatter.java
+++ b/src/main/java/net/h31ix/anticheat/util/FileFormatter.java
@@ -1,3 +1,21 @@
+/*
+ * AntiCheat for Bukkit.
+ * Copyright (C) 2012 H31IX http://h31ix.net
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
package net.h31ix.anticheat.util;
import java.text.DateFormat;
@@ -13,14 +31,20 @@ public class FileFormatter extends Formatter {
@Override
public String format(LogRecord record) {
- StringBuilder output = new StringBuilder()
- .append("[")
- .append(record.getLevel()).append('|')
- .append(format.format(new Date(record.getMillis())))
- .append("]: ")
- .append(record.getMessage()).append(' ')
- .append(lineSep);
- return output.toString();
+ if(record.getMessage().startsWith("[AntiCheat]"))
+ {
+ StringBuilder output = new StringBuilder()
+ .append("[")
+ .append(record.getLevel()).append('|')
+ .append(format.format(new Date(record.getMillis())))
+ .append("]: ")
+ .append(record.getMessage()).append(' ')
+ .append(lineSep);
+ return output.toString();
+ }
+ else
+ {
+ return "";
+ }
}
-
}
\ No newline at end of file
diff --git a/src/main/java/net/h31ix/anticheat/util/Utilities.java b/src/main/java/net/h31ix/anticheat/util/Utilities.java
index 44085a5..8646317 100644
--- a/src/main/java/net/h31ix/anticheat/util/Utilities.java
+++ b/src/main/java/net/h31ix/anticheat/util/Utilities.java
@@ -42,16 +42,10 @@ public final class Utilities
}
public static void alert(String [] message)
{
- for(Player p : Bukkit.getServer().getOnlinePlayers())
+ for(String msg : message)
{
- if(p.hasPermission("anticheat.alert") || p.hasPermission("anticheat.admin") || p.hasPermission("anticheat.mod") || p.isOp())
- {
- for(String msg : message)
- {
- p.sendMessage(msg);
- }
- }
- }
+ Bukkit.broadcast(msg, "anticheat.alert");
+ }
if(Anticheat.getManager().getConfiguration().logConsole())
{
for(String msg : message)
@@ -103,7 +97,7 @@ public final class Utilities
boolean b = false;
if(player.getServer().getPluginManager().getPlugin("mcMMO") != null)
{
- if(mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BERSERK))
+ if(mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BERSERK) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BLAST_MINING))
{
b = true;
}
@@ -181,6 +175,14 @@ public final class Utilities
{
return player.getLocation().getBlock().isLiquid() && player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
}
+ public static boolean isInWater(Player player)
+ {
+ return player.getLocation().getBlock().isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
+ }
+ public static boolean isOnLadder(Player player)
+ {
+ return player.getLocation().getBlock().getType() == Material.VINE || player.getLocation().getBlock().getType() == Material.LADDER;
+ }
public static boolean isInt(String string)
{
boolean x = false;
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 3806b1c..986bdab 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -19,4 +19,8 @@ System:
#Should AntiCheat log to files?
#0 = off, 1 = log when an event takes place, 2 = more detailed logs, 3 = most detailed logs
File log level: 1
- Verbose startup: false
\ No newline at end of file
+ Verbose startup: false
+ #Should AntiCheat block when players spam messages in chat?
+ Block chat spam: true
+ #Should AntiCheat block when players spam commands in chat?
+ Block command spam: true
\ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index df87b1c..6a72a7f 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -6,9 +6,136 @@ name: AntiCheat
softdepend: [AntiCheat]
startup: postworld
url: http://H31IX.NET/
-version: '1.3-DEV'
+version: ${project.version}-b${BUILD_NUMBER}
commands:
anticheat:
description: Control and view info about AntiCheat
usage: /anticheat help
- aliases: anti
\ No newline at end of file
+ aliases: anti
+permissions:
+ anticheat.alert:
+ description: Get alerts
+ anticheat.system.help:
+ description: Help access
+ anticheat.system.report:
+ description: Reports access
+ anticheat.system.spy:
+ description: Spy system access
+ anticheat.system.xray:
+ description: XRay info access
+ anticheat.mod:
+ description: Mod helper perm
+ children:
+ anticheat.alert: true
+ anticheat.system.help: true
+ anticheat.system.report: true
+ anticheat.system.spy: true
+ anticheat.system.xray: true
+ anticheat.system.log:
+ description: Log access
+ anticheat.system.reload:
+ description: Reload access
+ anticheat.system.reset:
+ description: Reset access
+ anticheat.system.update:
+ description: Update access
+ anticheat.admin:
+ description: Admin helper perm
+ children:
+ anticheat.mod: true
+ anticheat.system.log: true
+ anticheat.system.reload: true
+ anticheat.system.reset: true
+ anticheat.system.update: true
+ anticheat.check.zombe.fly:
+ description: Allow players to use zombe flymod
+ default: false
+ anticheat.check.zombe.noclip:
+ description: Allow players to use zombe noclip hack
+ default: false
+ anticheat.check.zombe.cheat:
+ description: Allow players to use zombe cheat hack
+ default: false
+ anticheat.check.fly:
+ description: Allow players to fly
+ default: false
+ anticheat.check.waterwalk:
+ description: Allow players to walk on water
+ default: false
+ anticheat.check.noswing:
+ description: Allow players to not ever swing their arm
+ default: false
+ anticheat.check.fastbreak:
+ description: Allow players to quickly break blocks
+ default: false
+ anticheat.check.fastplace:
+ description: Allow players to use build hacks and fastplace
+ default: false
+ anticheat.check.spam:
+ description: Allow players to spam the server
+ default: false
+ anticheat.check.sprint:
+ description: Allow players to sprint when hungry
+ default: false
+ anticheat.check.sneak:
+ description: Allow players to use auto-sneak
+ default: false
+ anticheat.check.speed:
+ description: Use this with anticheat.check.flyhack to allow more speed
+ default: false
+ anticheat.check.spider:
+ description: Allow players to climb non-climbable surfaces
+ default: false
+ anticheat.check.nofall:
+ description: Allow players to avoid fall damage
+ default: false
+ anticheat.check.fastbow:
+ description: Allow players to quickly fire bows
+ default: false
+ anticheat.check.fasteat:
+ description: Allow players to eat food instantly
+ default: false
+ anticheat.check.fastheal:
+ description: Allow players to heal up instantly
+ default: false
+ anticheat.check.forcefield:
+ description: Allow players to use a forcefield
+ default: false
+ anticheat.check.xray:
+ description: Allow players to bypass xray stats
+ default: false
+ anticheat.check.longreach:
+ description: Allow players to use longreaching hacks
+ default: false
+ anticheat.check.projectile:
+ description: Allow players to quickly launch projectiles
+ default: false
+ anticheat.check.itemspam:
+ description: Allow players to use inventory drop spam hacks
+ default: false
+ anticheat.check.exempt:
+ description: Total exemption from checks
+ default: false
+ children:
+ anticheat.check.zombe.fly: true
+ anticheat.check.zombe.noclip: true
+ anticheat.check.zombe.cheat: true
+ anticheat.check.fly: true
+ anticheat.check.waterwalk: true
+ anticheat.check.noswing: true
+ anticheat.check.fastbreak: true
+ anticheat.check.fastplace: true
+ anticheat.check.spam: true
+ anticheat.check.sprint: true
+ anticheat.check.sneak: true
+ anticheat.check.speed: true
+ anticheat.check.spider: true
+ anticheat.check.nofall: true
+ anticheat.check.fastbow: true
+ anticheat.check.fasteat: true
+ anticheat.check.fastheal: true
+ anticheat.check.forcefield: true
+ anticheat.check.xray: true
+ anticheat.check.longreach: true
+ anticheat.check.projectile: true
+ anticheat.check.itemspam: true
\ No newline at end of file