Files
src
build.gradle
FIXES_CHANGELOG.md
Code
24 2,655
src/main/java/com/netherdomin/plugin/NetherDominion.java
package com.netherdomin.plugin;
import com.netherdomin.plugin.boss.BossManager;
import com.netherdomin.plugin.command.DominionCommand;
import com.netherdomin.plugin.command.NRTPCommand;
import com.netherdomin.plugin.config.ConfigManager;
import com.netherdomin.plugin.fortress.FortressData;
import com.netherdomin.plugin.fortress.FortressGenerator;
import com.netherdomin.plugin.fortress.FortressGuardManager;
import com.netherdomin.plugin.listener.BossListener;
import com.netherdomin.plugin.listener.ProtectionListener;
import com.netherdomin.plugin.listener.SpawnerListener;
import com.netherdomin.plugin.rtp.CooldownManager;
import com.netherdomin.plugin.rtp.NetherRTP;
import com.netherdomin.plugin.spawner.CustomSpawnerManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class NetherDominion extends JavaPlugin {
private ConfigManager configManager;
private CooldownManager cooldownManager;
private NetherRTP netherRTP;
private FortressData fortressData;
private FortressGenerator fortressGenerator;
private FortressGuardManager fortressGuardManager;
private BossManager bossManager;
private CustomSpawnerManager spawnerManager;
@Override
public void onEnable() {
saveDefaultConfig();
this.configManager = new ConfigManager(this);
this.cooldownManager = new CooldownManager();
this.netherRTP = new NetherRTP(this);
this.fortressData = new FortressData(this);
this.fortressGenerator = new FortressGenerator(this);
this.fortressGuardManager = new FortressGuardManager(this);
this.bossManager = new BossManager(this);
this.spawnerManager = new CustomSpawnerManager(this);
registerCommands();
registerListeners();
Bukkit.getScheduler().runTaskLater(this, () -> {
if (getConfig().getBoolean("fortress.enabled")) {
fortressGenerator.generateFortress();
fortressGuardManager.startGuardSpawning();
}
}, 40L);
getLogger().info("Nether Dominion has been enabled!");
getLogger().info("Special player: " + getConfig().getString("special-player"));
}
@Override
public void onDisable() {
if (bossManager != null) {
bossManager.shutdown();
}
if (spawnerManager != null) {
spawnerManager.shutdown();
}
if (fortressGuardManager != null) {
fortressGuardManager.shutdown();
}
getLogger().info("Nether Dominion has been disabled!");
}
private void registerCommands() {
getCommand("nrpt").setExecutor(new NRTPCommand(this));
getCommand("dominion").setExecutor(new DominionCommand(this));
}
private void registerListeners() {
Bukkit.getPluginManager().registerEvents(new ProtectionListener(this), this);
Bukkit.getPluginManager().registerEvents(new BossListener(this), this);
Bukkit.getPluginManager().registerEvents(new SpawnerListener(this), this);
}
public boolean isSpecialPlayer(String playerName) {
String specialPlayer = getConfig().getString("special-player", "VyronKael45");
return playerName.equalsIgnoreCase(specialPlayer);
}
}