How to handle errors with dispatchCommand()

Discussion in 'Spigot Plugin Development' started by CyberDrain, May 20, 2016.

  1. I am working on a small plugin which resets a certain world to a previous state. The plugin mostly works, besides a few errors I am having right now.

    In order to reset the world, I need to do the following steps:
    - Unload the world from Multiverse
    - Delete the given folder
    - Copy the backup world to the server folder
    - Load the world back in with Multiverse
    - Reload all worlds from Multiverse

    All the loading/unloading/reloading, is done with the dispatchCommand() method. The commands get sent to the console and all get executed succesfully.
    The only thing which keeps frustrating me.. I cannot see if the given command with dispatchCommand(), is returning an error. The method should return a boolean, but it returns a true every single time (the boolean might only work for valid/invalid commands). I could do some double checks with if-statements, like if(worldIsUnloaded){ deleteWorld(world); }
    , but there must be an easier way to obtain possible errors... right...?