Files
src
build.gradle
Code
17 1,259
src/main/java/dev/kiro/antiexploit/AntiExploit.java
package dev.kiro.antiexploit;
import dev.kiro.antiexploit.listeners.*;
import dev.kiro.antiexploit.managers.*;
import org.bukkit.plugin.java.JavaPlugin;
public class AntiExploit extends JavaPlugin {
private static AntiExploit instance;
private CooldownManager cooldownManager;
private ViolationManager violationManager;
private ConfigManager configManager;
private ItemIDManager itemIDManager;
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
this.configManager = new ConfigManager(this);
this.cooldownManager = new CooldownManager();
this.violationManager = new ViolationManager(this);
this.itemIDManager = new ItemIDManager(this);
registerListeners();
startCleanupTask();
getLogger().info("AntiExploit v1.0.0 by kiro.java enabled!");
getLogger().info("Protecting against dupes, bugs & glitches...");
getLogger().info("Item tracking system initialized!");
}
@Override
public void onDisable() {
if (cooldownManager != null) {
cooldownManager.cleanup();
}
getLogger().info("AntiExploit disabled!");
}
private void registerListeners() {
getServer().getPluginManager().registerEvents(new DupePreventionListener(this), this);
getServer().getPluginManager().registerEvents(new ItemExploitListener(this), this);
getServer().getPluginManager().registerEvents(new BlockExploitListener(this), this);
getServer().getPluginManager().registerEvents(new EntityExploitListener(this), this);
getServer().getPluginManager().registerEvents(new PacketExploitListener(this), this);
getServer().getPluginManager().registerEvents(new ChunkExploitListener(this), this);
getServer().getPluginManager().registerEvents(new CombatExploitListener(this), this);
getServer().getPluginManager().registerEvents(new RedstoneExploitListener(this), this);
getServer().getPluginManager().registerEvents(new ItemTrackingListener(this), this);
}
private void startCleanupTask() {
getServer().getScheduler().runTaskTimerAsynchronously(this, () -> {
itemIDManager.cleanup();
}, 72000L, 72000L);
}
public static AntiExploit getInstance() {
return instance;
}
public CooldownManager getCooldownManager() {
return cooldownManager;
}
public ViolationManager getViolationManager() {
return violationManager;
}
public ConfigManager getConfigManager() {
return configManager;
}
public ItemIDManager getItemIDManager() {
return itemIDManager;
}
}