Files
src
build.gradle
manifest.kod
README.md
Code
54 2,561
src/main/java/com/altarsmp/AltarSMP.java
package com.altarsmp;
import com.altarsmp.commands.*;
import com.altarsmp.faction.FactionManager;
import com.altarsmp.listeners.*;
import com.altarsmp.managers.*;
import com.altarsmp.weapons.WeaponRegistry;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class AltarSMP extends JavaPlugin {
private WeaponRegistry weaponRegistry;
private CooldownManager cooldownManager;
private FactionManager factionManager;
private TrustManager trustManager;
private AltarManager altarManager;
private CopperArmorManager copperArmorManager;
@Override
public void onEnable() {
saveDefaultConfig();
// Initialize managers
this.weaponRegistry = new WeaponRegistry(this);
this.cooldownManager = new CooldownManager();
this.factionManager = new FactionManager(this);
this.trustManager = new TrustManager(this);
this.altarManager = new AltarManager(this);
this.copperArmorManager = new CopperArmorManager(this);
// Register weapons
weaponRegistry.registerAllWeapons();
// Register listeners
registerListeners();
// Register commands
registerCommands();
// Start faction effects task
factionManager.startEffectsTask();
getLogger().info("AltarSMP has been enabled!");
}
@Override
public void onDisable() {
if (factionManager != null) {
factionManager.stopEffectsTask();
}
if (altarManager != null) {
altarManager.destroyAllAltars();
}
getLogger().info("AltarSMP has been disabled!");
}
private void registerListeners() {
getServer().getPluginManager().registerEvents(new WeaponUseListener(this), this);
getServer().getPluginManager().registerEvents(new WeaponProtectionListener(this), this);
getServer().getPluginManager().registerEvents(new FactionListener(this), this);
getServer().getPluginManager().registerEvents(new CopperArmorListener(this), this);
getServer().getPluginManager().registerEvents(new AbilityKeyListener(this), this);
getServer().getPluginManager().registerEvents(new AltarInteractListener(this), this);
getServer().getPluginManager().registerEvents(new PlayerDeathConversionListener(this), this);
}
private void registerCommands() {
getCommand("altarsmp").setExecutor(new AltarSMPCommand(this));
getCommand("altar").setExecutor(new AltarCommand(this));
getCommand("legendaries").setExecutor(new LegendariesCommand(this));
getCommand("cooldown").setExecutor(new CooldownCommand(this));
getCommand("controls").setExecutor(new ControlsCommand());
getCommand("trust").setExecutor(new TrustCommand(this));
getCommand("pvp").setExecutor(new PvPCommand(this));
getCommand("destroyaltars").setExecutor(new DestroyAltarsCommand(this));
getCommand("setkills").setExecutor(new SetKillsCommand(this));
getCommand("coppertrial").setExecutor(new CopperTrialCommand(this));
getCommand("copperdiamondarmor").setExecutor(new CopperDiamondArmorCommand(this));
// Faction commands
FactionCommandRegistry.register(this);
}
}