These are chat archives for netherrack/netherrack

5th
May 2016
mhsjlw
@mhsjlw
May 05 2016 00:10
ok so i'm going to continue work on netherrack
we need to do some refactoring to make things cleaner
and i've also got an idea for how im going to do configuration
also i've found some great examples for a plugin loading system and emitting events
so i'll start work on refactoring and configuration and plugin loading with bukkit this weekend
also note though, bukkit is blocking
so we can take a serious hit on performance if we use bukkit
109C
@109C
May 05 2016 15:24
Doesn't bukkit have plugin loading built in?
mhsjlw
@mhsjlw
May 05 2016 15:48
yeah it does
but you still need to implement it
you know what i mean ;)
im also going to improve logging
and make messages similar to the output of minecraft
and add some more commands and a command api too
public void loadPlugins() {
        pluginManager.registerInterface(JavaPluginLoader.class);

        File pluginFolder = (File) console.options.valueOf("plugins");

        if (pluginFolder.exists()) {
            Plugin[] plugins = pluginManager.loadPlugins(pluginFolder);
            for (Plugin plugin : plugins) {
                try {
                    String message = String.format("Loading %s", plugin.getDescription().getFullName());
                    plugin.getLogger().info(message);
                    plugin.onLoad();
                } catch (Throwable ex) {
                    Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE, ex.getMessage() + " initializing " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
                }
            }
        } else {
            pluginFolder.mkdir();
        }
    }
that's how bukkit does it
ez pz
then
public void enablePlugins(PluginLoadOrder type) {
        if (type == PluginLoadOrder.STARTUP) {
            helpMap.clear();
            helpMap.initializeGeneralTopics();
        }

        Plugin[] plugins = pluginManager.getPlugins();

        for (Plugin plugin : plugins) {
            if ((!plugin.isEnabled()) && (plugin.getDescription().getLoad() == type)) {
                loadPlugin(plugin);
            }
        }

        if (type == PluginLoadOrder.POSTWORLD) {
            commandMap.setFallbackCommands();
            setVanillaCommands();
            commandMap.registerServerAliases();
            loadCustomPermissions();
            DefaultPermissions.registerCorePermissions();
            CraftDefaultPermissions.registerCorePermissions();
            helpMap.initializeCommands();
        }
    }

    public void disablePlugins() {
        pluginManager.disablePlugins();
    }