Commands on Reload

Forum intended for those developing plugins for or integration with MineTweaker. (Help with scripts is for Scripting Help)

Commands on Reload

Postby joshie » Fri Aug 01, 2014 10:15 pm

I am adding a bunch of commands such as

/mt seeds (prints a list of all seeds registered to tall grass).

However these commands are being removed when I do /mt reload
I assume I'm not registering the commands correctly. I am doing it like so right now. Could you please tell me where/how I am supposed to be adding these? Sorry for my stupidity. I had tried other locations but the commands were being removed before the server even started.
: [Select all] [/] [] ()
@EventHandler
    public void onServerStart(FMLServerStartingEvent event) {
        MineTweakerAPI.server.addMineTweakerCommand("loot", new String[] { "/minetweaker loot",
                "    Outputs a list of all dungeon loot in the game to the minetweaker log" }, new LootLogger());
        MineTweakerAPI.server.addMineTweakerCommand("seeds", new String[] { "/minetweaker seeds",
                "    Outputs a list of all grass drops in the game to the minetweaker log" }, new SeedLogger());

        if (TweakerPlugin.isLoaded("Mekanism")) {
            MineTweakerAPI.server.addMineTweakerCommand("gases", new String[] { "/minetweaker gases",
                    "    Outputs a list of all gas names in the game to the minetweaker log" }, new GasLogger());
        }

        if (TweakerPlugin.isLoaded("Thaumcraft")) {
            MineTweakerAPI.server.addMineTweakerCommand("research", new String[] { "/minetweaker research",  "/minetweaker research [CATEGORY]",
                    "    Outputs a list of all category names in the game to the minetweaker log," +
                    " or outputs a list of all research keys in a category to the log." }, new ResearchLogger());
        }
       
        if (TweakerPlugin.isLoaded("TConstruct")) {
            MineTweakerAPI.server.addMineTweakerCommand("materials", new String[] { "/minetweaker materials",
                    "    Outputs a list of all Tinker's Construct material names in the game to the minetweaker log" }, new MaterialLogger());
        }
    }
GeSHi © Codebox Plus
User avatar
joshie
 
Posts: 59
Joined: Sat Jul 12, 2014 1:10 pm

Re: Commands on Reload

Postby Stan » Sat Aug 02, 2014 5:55 am

They have to be re-registered when scripts reload. Now, I don't seem to have any event handler for that... since I didn't think of mod support needing those functions too.

I will have to add that when I'm back.
User avatar
Stan
Site Admin
 
Posts: 258
Joined: Fri Jul 11, 2014 9:04 pm


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron