mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
Add configuration value for exempting players in creative mode from xray checks
This commit is contained in:
1 parent
bde77cff98
commit
ad690d6976
3 files changed
+35
-17
No files matched your search
@@ -49,6 +49,7 @@ public class Configuration
|
|||||||
private boolean commandSpam;
|
private boolean commandSpam;
|
||||||
private boolean silentMode;
|
private boolean silentMode;
|
||||||
private boolean opExempt;
|
private boolean opExempt;
|
||||||
|
private boolean trackCreativeXRay;
|
||||||
private int fileLogLevel = 0;
|
private int fileLogLevel = 0;
|
||||||
private int medThreshold = 0;
|
private int medThreshold = 0;
|
||||||
private int highThreshold = 0;
|
private int highThreshold = 0;
|
||||||
@@ -117,22 +118,27 @@ public class Configuration
|
|||||||
{
|
{
|
||||||
return updateFolder;
|
return updateFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean silentMode()
|
public boolean silentMode()
|
||||||
{
|
{
|
||||||
return silentMode;
|
return silentMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean opExempt()
|
public boolean opExempt()
|
||||||
{
|
{
|
||||||
return opExempt;
|
return opExempt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean trackCreativeXRay()
|
||||||
|
{
|
||||||
|
return trackCreativeXRay;
|
||||||
|
}
|
||||||
|
|
||||||
public int medThreshold()
|
public int medThreshold()
|
||||||
{
|
{
|
||||||
return medThreshold;
|
return medThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int highThreshold()
|
public int highThreshold()
|
||||||
{
|
{
|
||||||
return highThreshold;
|
return highThreshold;
|
||||||
@@ -157,7 +163,7 @@ public class Configuration
|
|||||||
magic = CommentedConfiguration.loadConfig(magicFile);
|
magic = CommentedConfiguration.loadConfig(magicFile);
|
||||||
language = new Language(lang);
|
language = new Language(lang);
|
||||||
updateFolder = Bukkit.getUpdateFolder();
|
updateFolder = Bukkit.getUpdateFolder();
|
||||||
|
|
||||||
// Begin pulling values from config.
|
// Begin pulling values from config.
|
||||||
logConsole = getBoolean("System.Log to console", false);
|
logConsole = getBoolean("System.Log to console", false);
|
||||||
logXRay = getBoolean ("XRay.Log xray stats", true);
|
logXRay = getBoolean ("XRay.Log xray stats", true);
|
||||||
@@ -171,7 +177,8 @@ public class Configuration
|
|||||||
medThreshold = getInt("Events.Medium threshold", 20);
|
medThreshold = getInt("Events.Medium threshold", 20);
|
||||||
highThreshold = getInt("Events.High threshold", 50);
|
highThreshold = getInt("Events.High threshold", 50);
|
||||||
opExempt = getBoolean("System.Exempt op", false);
|
opExempt = getBoolean("System.Exempt op", false);
|
||||||
|
trackCreativeXRay = getBoolean("XRay.Track creative", true);
|
||||||
|
|
||||||
if (config.getList("Enable in") == null)
|
if (config.getList("Enable in") == null)
|
||||||
{
|
{
|
||||||
List<String> w = new ArrayList<String>();
|
List<String> w = new ArrayList<String>();
|
||||||
@@ -182,11 +189,11 @@ public class Configuration
|
|||||||
config.set("Enable in", w);
|
config.set("Enable in", w);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
worlds = config.getStringList("Enable in");
|
worlds = config.getStringList("Enable in");
|
||||||
// End pulling values from config
|
// End pulling values from config
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getBoolean(String entry, boolean d)
|
private boolean getBoolean(String entry, boolean d)
|
||||||
{
|
{
|
||||||
if (config.getString(entry) == null)
|
if (config.getString(entry) == null)
|
||||||
@@ -196,10 +203,10 @@ public class Configuration
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return config.getBoolean(entry);
|
return config.getBoolean(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getInt(String entry, int d)
|
private int getInt(String entry, int d)
|
||||||
{
|
{
|
||||||
if (config.getString(entry) == null)
|
if (config.getString(entry) == null)
|
||||||
@@ -209,7 +216,7 @@ public class Configuration
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return config.getInt(entry);
|
return config.getInt(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +253,7 @@ public class Configuration
|
|||||||
{
|
{
|
||||||
return levelFile;
|
return levelFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommentedConfiguration getMagic()
|
public CommentedConfiguration getMagic()
|
||||||
{
|
{
|
||||||
return magic;
|
return magic;
|
||||||
@@ -283,7 +290,7 @@ public class Configuration
|
|||||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveMagic(CommentedConfiguration newMagic)
|
public void saveMagic(CommentedConfiguration newMagic)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -293,6 +300,6 @@ public class Configuration
|
|||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,7 @@ import net.h31ix.anticheat.Anticheat;
|
|||||||
import net.h31ix.anticheat.manage.CheckManager;
|
import net.h31ix.anticheat.manage.CheckManager;
|
||||||
import net.h31ix.anticheat.manage.CheckType;
|
import net.h31ix.anticheat.manage.CheckType;
|
||||||
import net.h31ix.anticheat.util.Configuration;
|
import net.h31ix.anticheat.util.Configuration;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -40,6 +41,13 @@ public class XRayListener implements Listener
|
|||||||
if (config.logXRay())
|
if (config.logXRay())
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
|
if(p.getGameMode() == GameMode.CREATIVE)
|
||||||
|
{
|
||||||
|
if(!config.trackCreativeXRay())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
String player = p.getName();
|
String player = p.getName();
|
||||||
if (checkManager.willCheck(p, CheckType.XRAY))
|
if (checkManager.willCheck(p, CheckType.XRAY))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,12 +2,15 @@
|
|||||||
# Please report any bugs: http://dev.bukkit.org/server-mods/anticheat/
|
# Please report any bugs: http://dev.bukkit.org/server-mods/anticheat/
|
||||||
XRay:
|
XRay:
|
||||||
Log xray stats: true
|
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
|
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.
|
# 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]
|
# 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]
|
# 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.
|
# &player will be replaced with player's name, and any command on your server can be used.
|
||||||
Events:
|
Events:
|
||||||
Level Medium: WARN
|
Level Medium: WARN
|
||||||
Level High: KICK
|
Level High: KICK
|
||||||
# How many warnings should the player get before entering medium?
|
# How many warnings should the player get before entering medium?
|
||||||
|
|||||||
Reference in new issue
Block a user