Files
src
build.gradle
Code
17 984
src/main/java/com/godspear/GodSpearPlugin.java
package com.godspear;
import com.godspear.abilities.GodlyStormAbility;
import com.godspear.abilities.LightningCallAbility;
import com.godspear.abilities.SpearDashAbility;
import com.godspear.abilities.ThunderSlamAbility;
import com.godspear.commands.SpearCommand;
import com.godspear.listeners.SpearListener;
import com.godspear.util.CooldownManager;
import com.godspear.util.SpearItemBuilder;
import org.bukkit.NamespacedKey;
import org.bukkit.plugin.java.JavaPlugin;
public class GodSpearPlugin extends JavaPlugin {
private static GodSpearPlugin instance;
private NamespacedKey spearKey;
private CooldownManager cooldownManager;
private SpearItemBuilder spearItemBuilder;
private LightningCallAbility lightningCall;
private GodlyStormAbility godlyStorm;
private SpearDashAbility spearDash;
private ThunderSlamAbility thunderSlam;
// Active storm tasks keyed by player UUID
private final java.util.Map<java.util.UUID, Integer> stormTasks = new java.util.HashMap<>();
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
this.spearKey = new NamespacedKey(this, "god_spear");
this.cooldownManager = new CooldownManager();
// Build abilities
this.lightningCall = new LightningCallAbility(this);
this.godlyStorm = new GodlyStormAbility(this);
this.spearDash = new SpearDashAbility(this);
this.thunderSlam = new ThunderSlamAbility(this);
this.spearItemBuilder = new SpearItemBuilder(this);
// Register listener
getServer().getPluginManager().registerEvents(new SpearListener(this), this);
// Register command
getCommand("godspear").setExecutor(new SpearCommand(this));
getLogger().info("GodSpearPlugin enabled! Spear material: STICK (overridden by resource pack)");
}
@Override
public void onDisable() {
// Cancel all active storm tasks
stormTasks.values().forEach(id -> getServer().getScheduler().cancelTask(id));
stormTasks.clear();
getLogger().info("GodSpearPlugin disabled.");
}
public static GodSpearPlugin getInstance() { return instance; }
public NamespacedKey getSpearKey() { return spearKey; }
public CooldownManager getCooldownManager() { return cooldownManager; }
public SpearItemBuilder getSpearItemBuilder() { return spearItemBuilder; }
public LightningCallAbility getLightningCall() { return lightningCall; }
public GodlyStormAbility getGodlyStorm() { return godlyStorm; }
public SpearDashAbility getSpearDash() { return spearDash; }
public ThunderSlamAbility getThunderSlam() { return thunderSlam; }
public java.util.Map<java.util.UUID, Integer> getStormTasks() { return stormTasks; }
}