No chat to show

This project's files are all here to explore.

Files
src
build.gradle
manifest.kod
Code
16 1,002
src/main/java/com/schematicviewer/SchematicViewerPlugin.java
package com.schematicviewer;

import com.schematicviewer.command.BuildCommand;
import com.schematicviewer.command.BuildDisableCommand;
import com.schematicviewer.listener.PlayerListener;
import com.schematicviewer.manager.ConfigManager;
import com.schematicviewer.manager.FakeBlockManager;
import com.schematicviewer.manager.SchematicManager;
import com.schematicviewer.manager.SessionManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class SchematicViewerPlugin extends JavaPlugin {
    private ConfigManager configManager;
    private SchematicManager schematicManager;
    private SessionManager sessionManager;
    private FakeBlockManager fakeBlockManager;

    @Override
    public void onEnable() {
        if (Bukkit.getPluginManager().getPlugin("WorldEdit") == null) {
            getLogger().severe("========================================");
            getLogger().severe("WORLDEDIT NAO ENCONTRADO!");
            getLogger().severe("Este plugin requer WorldEdit para funcionar.");
            getLogger().severe("Baixe em: https://dev.bukkit.org/projects/worldedit");
            getLogger().severe("========================================");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }

        if (Bukkit.getPluginManager().getPlugin("ProtocolLib") == null) {
            getLogger().severe("========================================");
            getLogger().severe("PROTOCOLLIB NAO ENCONTRADO!");
            getLogger().severe("Este plugin requer ProtocolLib para funcionar.");
            getLogger().severe("Baixe em: https://www.spigotmc.org/resources/protocollib.1997/");
            getLogger().severe("========================================");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }

        saveDefaultConfig();
        
        this.configManager = new ConfigManager(this);
        this.schematicManager = new SchematicManager(this);
        this.fakeBlockManager = new FakeBlockManager(this);
        this.sessionManager = new SessionManager(this);

        registerCommands();
        registerListeners();

        getLogger().info("SchematicViewer habilitado com sucesso!");
        getLogger().info("WorldEdit: " + Bukkit.getPluginManager().getPlugin("WorldEdit").getDescription().getVersion());
        getLogger().info("ProtocolLib: " + Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion());
    }

    @Override
    public void onDisable() {
        if (sessionManager != null) {
            sessionManager.clearAllSessions();
        }
        getLogger().info("SchematicViewer desabilitado!");
    }

    private void registerCommands() {
        BuildCommand buildCommand = new BuildCommand(this);
        getCommand("build").setExecutor(buildCommand);
        getCommand("build").setTabCompleter(buildCommand);
        getCommand("builddisable").setExecutor(new BuildDisableCommand(this));
    }

    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
    }

    public ConfigManager getConfigManager() {
        return configManager;
    }

    public SchematicManager getSchematicManager() {
        return schematicManager;
    }

    public SessionManager getSessionManager() {
        return sessionManager;
    }

    public FakeBlockManager getFakeBlockManager() {
        return fakeBlockManager;
    }
}