Files
src
build.gradle
manifest.kod
Code
15 903
src/main/java/com/lucifer/pmcguard/PMCGuard.java
package com.lucifer.pmcguard;
import com.lucifer.pmcguard.listener.BlockListener;
import com.lucifer.pmcguard.listener.ChatCommandListener;
import com.lucifer.pmcguard.listener.CommandProtectionListener;
import com.lucifer.pmcguard.listener.InventoryListener;
import com.lucifer.pmcguard.listener.PotionListener;
import com.lucifer.pmcguard.manager.IntegrationManager;
import com.lucifer.pmcguard.manager.ItemTracker;
import com.lucifer.pmcguard.manager.LogManager;
import com.lucifer.pmcguard.manager.ProtectionManager;
import com.lucifer.pmcguard.manager.ScanManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class PMCGuard extends JavaPlugin {
private LogManager logManager;
private ItemTracker itemTracker;
private ScanManager scanManager;
private ProtectionManager protectionManager;
private IntegrationManager integrationManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.logManager = new LogManager(this);
this.itemTracker = new ItemTracker(this);
this.scanManager = new ScanManager(this);
this.protectionManager = new ProtectionManager(this);
this.integrationManager = new IntegrationManager(this);
Bukkit.getPluginManager().registerEvents(new InventoryListener(this), this);
Bukkit.getPluginManager().registerEvents(new PotionListener(this), this);
Bukkit.getPluginManager().registerEvents(new BlockListener(this), this);
Bukkit.getPluginManager().registerEvents(new CommandProtectionListener(this), this);
Bukkit.getPluginManager().registerEvents(new ChatCommandListener(this), this);
integrationManager.initialize();
getLogger().info("PMC-GUARD has been enabled!");
getLogger().info("Protection system active for " + protectionManager.getProtectedPlayers().size() + " players.");
}
public boolean hasBypass(Player player) {
if (player.hasPermission("pmcguard.bypass")) {
return true;
}
if (getConfig().getBoolean("bypass.allow-op", false) && player.isOp()) {
return true;
}
return false;
}
@Override
public void onDisable() {
getLogger().info("PMC-GUARD has been disabled!");
}
}