Files
src
build.gradle
Code
52 3,657
src/main/java/com/example/soulsystem/SoulSystem.java
package com.example.soulsystem;
import com.example.soulsystem.abilities.AbilityItemListener;
import com.example.soulsystem.abilities.AbilityItemManager;
import com.example.soulsystem.abilities.AbilityManager;
import com.example.soulsystem.commands.SoulAdminCommand;
import com.example.soulsystem.commands.SoulCommand;
import com.example.soulsystem.combat.CombatManager;
import com.example.soulsystem.cooldown.CooldownManager;
import com.example.soulsystem.darkness.MobKillTracker;
import com.example.soulsystem.darkness.MobTargetingListener;
import com.example.soulsystem.darkness.ShadowStateManager;
import com.example.soulsystem.darkness.WardenPenaltyListener;
import com.example.soulsystem.gui.GUIListener;
import com.example.soulsystem.gui.GUIManager;
import com.example.soulsystem.guardian.GuardianManager;
import com.example.soulsystem.keybind.KeybindListener;
import com.example.soulsystem.keybind.KeybindManager;
import com.example.soulsystem.playerdata.PlayerDataManager;
import com.example.soulsystem.souls.SoulRegistry;
import com.example.soulsystem.souls.impl.DarknessSoul;
import com.example.soulsystem.souls.impl.GuardianSoul;
import com.example.soulsystem.souls.impl.StormSoul;
import com.example.soulsystem.storm.StormManager;
import com.example.soulsystem.whitelist.WhitelistManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class SoulSystem extends JavaPlugin {
private SoulRegistry soulRegistry;
private PlayerDataManager playerDataManager;
private GUIManager guiManager;
private KeybindManager keybindManager;
private WhitelistManager whitelistManager;
private CooldownManager cooldownManager;
private AbilityManager abilityManager;
private AbilityItemManager abilityItemManager;
private CombatManager combatManager;
private ShadowStateManager shadowStateManager;
private MobKillTracker mobKillTracker;
private MobTargetingListener mobTargetingListener;
private GuardianManager guardianManager;
private StormManager stormManager;
private WardenPenaltyListener wardenPenaltyListener;
@Override
public void onEnable() {
saveDefaultConfig();
this.soulRegistry = new SoulRegistry();
this.playerDataManager = new PlayerDataManager(this);
this.guiManager = new GUIManager();
this.keybindManager = new KeybindManager(this);
this.whitelistManager = new WhitelistManager(this);
this.cooldownManager = new CooldownManager();
this.abilityManager = new AbilityManager(this);
this.abilityItemManager = new AbilityItemManager(this);
this.combatManager = new CombatManager(this);
this.shadowStateManager = new ShadowStateManager(this);
this.mobKillTracker = new MobKillTracker(this);
this.mobTargetingListener = new MobTargetingListener(this);
this.guardianManager = new GuardianManager(this);
this.stormManager = new StormManager(this);
this.wardenPenaltyListener = new WardenPenaltyListener(this);
registerSouls();
registerCommands();
registerListeners();
getLogger().info("SoulSystem enabled successfully!");
getLogger().info("Item-based ability system active!");
}
@Override
public void onDisable() {
if (shadowStateManager != null) {
shadowStateManager.cleanup();
}
if (playerDataManager != null) {
playerDataManager.saveAll();
}
if (whitelistManager != null) {
whitelistManager.saveAll();
}
if (keybindManager != null) {
keybindManager.saveKeybinds();
}
getLogger().info("SoulSystem disabled!");
}
private void registerSouls() {
DarknessSoul darknessSoul = new DarknessSoul();
darknessSoul.initialize(this);
soulRegistry.registerSoul(darknessSoul);
GuardianSoul guardianSoul = new GuardianSoul();
guardianSoul.initialize(this);
soulRegistry.registerSoul(guardianSoul);
StormSoul stormSoul = new StormSoul();
stormSoul.initialize(this);
soulRegistry.registerSoul(stormSoul);
}
private void registerCommands() {
getCommand("soul").setExecutor(new SoulCommand(this));
getCommand("souladmin").setExecutor(new SoulAdminCommand(this));
}
private void registerListeners() {
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
Bukkit.getPluginManager().registerEvents(new AbilityItemListener(this), this);
Bukkit.getPluginManager().registerEvents(new KeybindListener(this), this);
}
public void reload() {
reloadConfig();
playerDataManager.saveAll();
whitelistManager.saveAll();
keybindManager.saveKeybinds();
getLogger().info("Configuration reloaded!");
}
}