Files
src
pom.xml
Code
66 3,292
src/main/java/com/totemsmp/TotemSMP.java
package com.totemsmp;
import com.totemsmp.command.AbilityCommand;
import com.totemsmp.command.TotemCommand;
import com.totemsmp.command.TotemTabCompleter;
import com.totemsmp.listener.InventoryListener;
import com.totemsmp.listener.PlayerDeathListener;
import com.totemsmp.listener.PlayerInteractListener;
import com.totemsmp.listener.PlayerJoinListener;
import com.totemsmp.manager.AbilityManager;
import com.totemsmp.manager.CooldownManager;
import com.totemsmp.manager.PassiveManager;
import com.totemsmp.manager.PlayerDataManager;
import com.totemsmp.manager.SMPStartManager;
import com.totemsmp.manager.TotemManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class TotemSMP extends JavaPlugin {
private TotemManager totemManager;
private PlayerDataManager playerDataManager;
private CooldownManager cooldownManager;
private PassiveManager passiveManager;
private AbilityManager abilityManager;
private SMPStartManager smpStartManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.totemManager = new TotemManager(this);
this.playerDataManager = new PlayerDataManager(this);
this.cooldownManager = new CooldownManager(this);
this.abilityManager = new AbilityManager(this);
this.passiveManager = new PassiveManager(this);
this.smpStartManager = new SMPStartManager(this);
registerCommands();
registerListeners();
this.passiveManager.start();
getLogger().info("TotemSMP has been enabled!");
}
@Override
public void onDisable() {
if (this.passiveManager != null) {
this.passiveManager.stop();
}
getLogger().info("TotemSMP has been disabled!");
}
private void registerCommands() {
TotemTabCompleter tabCompleter = new TotemTabCompleter(this);
getCommand("totem").setExecutor(new TotemCommand(this));
getCommand("totem").setTabCompleter(tabCompleter);
getCommand("ability").setExecutor(new AbilityCommand(this));
getCommand("ability").setTabCompleter(tabCompleter);
}
private void registerListeners() {
PluginManager pm = Bukkit.getPluginManager();
pm.registerEvents(new PlayerJoinListener(this), this);
pm.registerEvents(new PlayerInteractListener(this), this);
pm.registerEvents(new PlayerDeathListener(this), this);
pm.registerEvents(new InventoryListener(this), this);
}
}