mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +00:00
Compliance with Java standards via Sonar plus a few xray fixes.
This commit is contained in:
1 parent
46ec0d736d
commit
55eb3738f7
23 files changed
+463
-483
No files matched your search
@@ -8,14 +8,13 @@ import java.util.logging.Logger;
|
||||
import net.h31ix.anticheat.command.CommandManager;
|
||||
import net.h31ix.anticheat.event.*;
|
||||
import net.h31ix.anticheat.xray.*;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Anticheat extends JavaPlugin {
|
||||
//Define and initialize managers, used for various checks and tasks in the listeners.
|
||||
public ChatManager cm = new ChatManager(this);
|
||||
public AnimationManager am = new AnimationManager(this);
|
||||
public AnimationManager am = new AnimationManager();
|
||||
public ExemptManager ex = new ExemptManager(this);
|
||||
public ItemManager im = new ItemManager(this);
|
||||
public BowManager bm = new BowManager(this);
|
||||
@@ -26,31 +25,42 @@ public class Anticheat extends JavaPlugin {
|
||||
public BlockManager blm = new BlockManager(this);
|
||||
//End Managers
|
||||
|
||||
public Configuration config;
|
||||
public PlayerTracker tracker; //PlayerTracker for monitoring levels
|
||||
public XRayTracker xtracker; //XRay tracker for monitoring ores
|
||||
private static final Logger l = Logger.getLogger("Minecraft");
|
||||
private long lastTime = System.currentTimeMillis();
|
||||
private long time = 0;
|
||||
public boolean lagged = false;
|
||||
public boolean logConsole;
|
||||
public FileConfiguration log;
|
||||
private Configuration config;
|
||||
private PlayerTracker tracker; //PlayerTracker for monitoring levels
|
||||
private XRayTracker xtracker; //XRay tracker for monitoring ores
|
||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||
private List<String> worlds;
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
public Configuration getConfiguration()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
public PlayerTracker getPlayerTracker()
|
||||
{
|
||||
return tracker;
|
||||
}
|
||||
|
||||
public XRayTracker getXRayTracker()
|
||||
{
|
||||
return xtracker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if(!new File(this.getDataFolder()+"\\config.yml").exists())
|
||||
{
|
||||
this.saveDefaultConfig();
|
||||
}
|
||||
config = new Configuration(this);
|
||||
config = new Configuration();
|
||||
tracker = new PlayerTracker(this);
|
||||
xtracker = new XRayTracker();
|
||||
logConsole = config.logConsole;
|
||||
worlds = config.getWorlds();
|
||||
getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new BlockListener(this), this);
|
||||
@@ -59,27 +69,15 @@ public class Anticheat extends JavaPlugin {
|
||||
|
||||
getCommand("anticheat").setExecutor(new CommandManager(this));
|
||||
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
long l = System.currentTimeMillis();
|
||||
time = l-lastTime;
|
||||
lastTime = l;
|
||||
time = time/10;
|
||||
lagged = time > 1500;
|
||||
}
|
||||
}, 200L, 200L);
|
||||
l.log(Level.INFO,"--[Thanks for using a DEV build of AntiCheat!]--");
|
||||
l.log(Level.INFO,"If you notice any bugs, PLEASE report them on BukkitDev!");
|
||||
logger.log(Level.INFO,"--[Thanks for using a DEV build of AntiCheat!]--");
|
||||
logger.log(Level.INFO,"If you notice any bugs, PLEASE report them on BukkitDev!");
|
||||
}
|
||||
|
||||
public void log(String s)
|
||||
{
|
||||
if(this.logConsole)
|
||||
if(config.logConsole())
|
||||
{
|
||||
l.log(Level.WARNING,"[AntiCheat] "+s);
|
||||
logger.log(Level.WARNING, (new StringBuilder("[AntiCheat]")).append(s).toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,11 +95,5 @@ public class Anticheat extends JavaPlugin {
|
||||
}
|
||||
return check;
|
||||
}
|
||||
|
||||
//Avoid catching our own teleportations
|
||||
public void logTeleport()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user