Files
src
build.gradle
settings.gradle
Code
15 1,158
src/main/java/com/kodari/customsurvival/CustomSurvivalPlugin.java
package com.kodari.customsurvival;
import com.kodari.customsurvival.command.EventCommand;
import com.kodari.customsurvival.command.HomeCommand;
import com.kodari.customsurvival.command.MeteoriteCommand;
import com.kodari.customsurvival.command.SpawnCommand;
import com.kodari.customsurvival.listener.EventListener;
import com.kodari.customsurvival.listener.WelcomeListener;
import com.kodari.customsurvival.manager.EventManager;
import com.kodari.customsurvival.manager.HomeManager;
import com.kodari.customsurvival.manager.SpawnManager;
import org.bukkit.plugin.java.JavaPlugin;
public class CustomSurvivalPlugin extends JavaPlugin {
private EventManager eventManager;
@Override
public void onEnable() {
saveDefaultConfig();
HomeManager homeManager = new HomeManager(this);
SpawnManager spawnManager = new SpawnManager(this);
eventManager = new EventManager(this);
getCommand("sethome").setExecutor(new HomeCommand(this, homeManager, HomeCommand.Mode.SET));
getCommand("home").setExecutor(new HomeCommand(this, homeManager, HomeCommand.Mode.TELEPORT));
getCommand("delhome").setExecutor(new HomeCommand(this, homeManager, HomeCommand.Mode.DELETE));
getCommand("spawn").setExecutor(new SpawnCommand(this, spawnManager, false));
getCommand("setspawn").setExecutor(new SpawnCommand(this, spawnManager, true));
EventCommand eventCommand = new EventCommand(eventManager);
getCommand("event").setExecutor(eventCommand);
getCommand("event").setTabCompleter(eventCommand);
MeteoriteCommand meteoriteCommand = new MeteoriteCommand(eventManager);
getCommand("meteorit").setExecutor(meteoriteCommand);
getCommand("meteorit").setTabCompleter(meteoriteCommand);
getServer().getPluginManager().registerEvents(new WelcomeListener(this), this);
getServer().getPluginManager().registerEvents(new EventListener(eventManager), this);
eventManager.startAutomaticTasks();
getLogger().info("CustomSurvivalCore a fost activat pentru Minecraft 1.21.11.");
}
@Override
public void onDisable() {
if (eventManager != null) {
eventManager.shutdown();
}
getLogger().info("CustomSurvivalCore a fost dezactivat.");
}
}