Files
src
pom.xml
Code
32 3,795
src/main/java/com/antistealth/AntiStealth.java
package com.antistealth;
import com.antistealth.command.AntiStealthCommand;
import com.antistealth.config.ConfigManager;
import com.antistealth.config.MessageManager;
import com.antistealth.detection.DetectionManager;
import com.antistealth.detection.modules.*;
import com.antistealth.listener.PlayerListener;
import com.antistealth.listener.PacketListener;
import com.antistealth.punishment.PunishmentManager;
import com.antistealth.util.ViolationTracker;
import org.bukkit.plugin.java.JavaPlugin;
public class AntiStealth extends JavaPlugin {
private static AntiStealth instance;
private ConfigManager configManager;
private MessageManager messageManager;
private DetectionManager detectionManager;
private PunishmentManager punishmentManager;
private ViolationTracker violationTracker;
@Override
public void onEnable() {
instance = this;
// Save default configs
saveDefaultConfig();
saveResource("messages.yml", false);
// Initialize managers
this.configManager = new ConfigManager(this);
this.messageManager = new MessageManager(this);
this.violationTracker = new ViolationTracker(this);
this.punishmentManager = new PunishmentManager(this);
this.detectionManager = new DetectionManager(this);
// Register detection modules
registerModules();
// Register commands
getCommand("antistealth").setExecutor(new AntiStealthCommand(this));
// Register packet listener (uses Paper API)
getServer().getPluginManager().registerEvents(new PacketListener(this), this);
// Register player listener
getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
getLogger().info("AntiStealth v" + getDescription().getVersion() + " enabled.");
}
@Override
public void onDisable() {
if (detectionManager != null) {
detectionManager.disableAll();
}
getLogger().info("AntiStealth disabled.");
}
private void registerModules() {
detectionManager.registerModule(new ClientBrandModule(this));
detectionManager.registerModule(new PluginChannelModule(this));
detectionManager.registerModule(new ConfigHandshakeModule(this));
detectionManager.registerModule(new KnownPackModule(this));
detectionManager.registerModule(new ResourcePackModule(this));
detectionManager.registerModule(new PacketTimingModule(this));
detectionManager.registerModule(new MovementModule(this));
detectionManager.registerModule(new InvalidPacketModule(this));
detectionManager.registerModule(new ProtocolConsistencyModule(this));
detectionManager.registerModule(new BrandSpoofingModule(this));
detectionManager.registerModule(new HiddenModBehaviorModule(this));
detectionManager.registerModule(new ClientFingerprintModule(this));
detectionManager.enableAll();
}
public void reload() {
reloadConfig();
configManager.reload();
messageManager.reload();
detectionManager.reload();
punishmentManager.reload();
}
public static AntiStealth getInstance() {
return instance;
}
public ConfigManager getConfigManager() {
return configManager;
}
public MessageManager getMessageManager() {
return messageManager;
}
public DetectionManager getDetectionManager() {
return detectionManager;
}
public PunishmentManager getPunishmentManager() {
return punishmentManager;
}
public ViolationTracker getViolationTracker() {
return violationTracker;
}
}