package dev.trixinity.eventmanager; import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.flags.StateFlag; import com.sk89q.worldguard.protection.flags.registry.FlagRegistry; import dev.trixinity.eventmanager.commands.ClearEventerCommand; import dev.trixinity.eventmanager.commands.EventCommand; import dev.trixinity.eventmanager.commands.EventerCommand; import dev.trixinity.eventmanager.commands.TrixinityCommand; import dev.trixinity.eventmanager.placeholders.TrixinityPlaceholderExpansion; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; /** * Hlavní třída pluginu pro správu eventů na Minecraft serveru. */ public class TrixinityEventManager extends JavaPlugin { private static volatile TrixinityEventManager instance; @Override public void onEnable() { instance = this; // Vytvoření výchozí konfigurace saveDefaultConfig(); // Registrace příkazů getCommand("trixinity").setExecutor(new TrixinityCommand()); EventCommand eventCommand = new EventCommand(); getCommand("event").setExecutor(eventCommand); getCommand("event").setTabCompleter(eventCommand); // Přidání TabCompleter getCommand("eventer").setExecutor(new EventerCommand()); getCommand("cleareventer").setExecutor(new ClearEventerCommand()); // Registrace PlaceholderAPI expansion if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) { new TrixinityPlaceholderExpansion(this).register(); getLogger().info("PlaceholderAPI expansion byla úspěšně zaregistrována!"); } else { getLogger().warning("PlaceholderAPI není nainstalováno! Placeholders nebudou fungovat."); } getLogger().info("TrixinityEventManager byl úspěšně spuštěn!"); } @Override public void onDisable() { getLogger().info("TrixinityEventManager byl vypnut!"); } /** * Získá instanci pluginu. * * @return Instance pluginu * @throws IllegalStateException pokud plugin není inicializován */ public static TrixinityEventManager getInstance() { if (instance == null) { throw new IllegalStateException("Plugin není inicializován!"); } return instance; } }