Files
src
Code
16 1,376
src/main/java/com/kodari/lives/LivesPlugin.java
package com.kodari.lives;
import com.kodari.lives.commands.LivesCommand;
import com.kodari.lives.commands.WithdrawCommand;
import com.kodari.lives.listeners.BossListener;
import com.kodari.lives.listeners.BrewingStandListener;
import com.kodari.lives.listeners.PlayerListener;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
public class LivesPlugin extends JavaPlugin {
@Getter private static LivesPlugin instance;
@Getter private ConfigManager configManager;
@Getter private LivesManager livesManager;
@Getter private LifeItemManager lifeItemManager;
@Getter private BossManager bossManager;
@Getter private BossSpawnItemManager bossSpawnItemManager;
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
configManager = new ConfigManager(this);
livesManager = new LivesManager(this);
lifeItemManager = new LifeItemManager(this);
bossManager = new BossManager(this);
bossSpawnItemManager = new BossSpawnItemManager(this);
getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
getServer().getPluginManager().registerEvents(new BossListener(this), this);
getServer().getPluginManager().registerEvents(new BrewingStandListener(this), this);
LivesCommand livesCommand = new LivesCommand(this);
getCommand("lives").setExecutor(livesCommand);
getCommand("lives").setTabCompleter(livesCommand);
WithdrawCommand withdrawCommand = new WithdrawCommand(this);
getCommand("wl").setExecutor(withdrawCommand);
getCommand("wl").setTabCompleter(withdrawCommand);
getLogger().info("LivesPlugin enabled. Max lives: " + configManager.getMaxLives()
+ ", Starting lives: " + configManager.getStartingLives());
}
@Override
public void onDisable() {
if (livesManager != null) {
livesManager.saveAll();
}
getLogger().info("LivesPlugin disabled. All player data saved.");
}
}