diff --git a/src/main/java/net/h31ix/anticheat/util/Configuration.java b/src/main/java/net/h31ix/anticheat/util/Configuration.java index 74f3069..1da612c 100644 --- a/src/main/java/net/h31ix/anticheat/util/Configuration.java +++ b/src/main/java/net/h31ix/anticheat/util/Configuration.java @@ -49,6 +49,7 @@ public class Configuration private boolean commandSpam; private boolean silentMode; private boolean opExempt; + private boolean trackCreativeXRay; private int fileLogLevel = 0; private int medThreshold = 0; private int highThreshold = 0; @@ -117,22 +118,27 @@ public class Configuration { return updateFolder; } - + public boolean silentMode() { return silentMode; - } - + } + public boolean opExempt() { return opExempt; - } - + } + + public boolean trackCreativeXRay() + { + return trackCreativeXRay; + } + public int medThreshold() { return medThreshold; } - + public int highThreshold() { return highThreshold; @@ -157,7 +163,7 @@ public class Configuration magic = CommentedConfiguration.loadConfig(magicFile); language = new Language(lang); updateFolder = Bukkit.getUpdateFolder(); - + // Begin pulling values from config. logConsole = getBoolean("System.Log to console", false); logXRay = getBoolean ("XRay.Log xray stats", true); @@ -171,7 +177,8 @@ public class Configuration medThreshold = getInt("Events.Medium threshold", 20); highThreshold = getInt("Events.High threshold", 50); opExempt = getBoolean("System.Exempt op", false); - + trackCreativeXRay = getBoolean("XRay.Track creative", true); + if (config.getList("Enable in") == null) { List w = new ArrayList(); @@ -182,11 +189,11 @@ public class Configuration config.set("Enable in", w); save(); } - worlds = config.getStringList("Enable in"); + worlds = config.getStringList("Enable in"); // End pulling values from config save(); } - + private boolean getBoolean(String entry, boolean d) { if (config.getString(entry) == null) @@ -196,10 +203,10 @@ public class Configuration } else { - return config.getBoolean(entry); + return config.getBoolean(entry); } } - + private int getInt(String entry, int d) { if (config.getString(entry) == null) @@ -209,7 +216,7 @@ public class Configuration } else { - return config.getInt(entry); + return config.getInt(entry); } } @@ -246,7 +253,7 @@ public class Configuration { return levelFile; } - + public CommentedConfiguration getMagic() { return magic; @@ -283,7 +290,7 @@ public class Configuration Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); } } - + public void saveMagic(CommentedConfiguration newMagic) { try @@ -293,6 +300,6 @@ public class Configuration catch (IOException ex) { Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); - } + } } } diff --git a/src/main/java/net/h31ix/anticheat/xray/XRayListener.java b/src/main/java/net/h31ix/anticheat/xray/XRayListener.java index f46810c..0b2ae49 100644 --- a/src/main/java/net/h31ix/anticheat/xray/XRayListener.java +++ b/src/main/java/net/h31ix/anticheat/xray/XRayListener.java @@ -22,6 +22,7 @@ import net.h31ix.anticheat.Anticheat; import net.h31ix.anticheat.manage.CheckManager; import net.h31ix.anticheat.manage.CheckType; import net.h31ix.anticheat.util.Configuration; +import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -40,6 +41,13 @@ public class XRayListener implements Listener if (config.logXRay()) { Player p = event.getPlayer(); + if(p.getGameMode() == GameMode.CREATIVE) + { + if(!config.trackCreativeXRay()) + { + return; + } + } String player = p.getName(); if (checkManager.willCheck(p, CheckType.XRAY)) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 3d6867c..7a44dee 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -2,12 +2,15 @@ # Please report any bugs: http://dev.bukkit.org/server-mods/anticheat/ XRay: Log xray stats: true + # Should a warning be sent to admins when a person is found that could be xraying? Alert when xray is found: false + # Should players in creative mode be tracked for possible xray usage? + Track creative: true # Events occur when a player's hack level changes. You may configure reactions to these events here. # Valid events = NONE,WARN,KICK,BAN,COMMAND[command] # Use commands like so: COMMAND[ban &player 30] or COMMAND[kick &player hacking] or COMMAND[jail &player 10] # &player will be replaced with player's name, and any command on your server can be used. -Events: +Events: Level Medium: WARN Level High: KICK # How many warnings should the player get before entering medium?