Bukkit Reload Command

Discussion in 'Plugin Development' started by fireboyev, Aug 17, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    fireboyev

    Hey all, I would like to know how to test when the Bukkit Reload Command completes (aka the message that says "Server Reloaded."

    I would also like to know how I could change what the reload command does so I could make a plugin that warns players that a reload is about to happen, then it will do the reload.

    or somehow disable the bukkit reload command and create my own, I was looking at the source code of the bukkit api and all reload command does is just bukkit.reload then says "Server Reloaded" right after.

    Thanks.
     
    Last edited: Aug 17, 2016
  2. Offline

    Zombie_Striker

    @fireboyev
    For that, you will need to override the /reload command. Since the reload happens almost instantaneously after the command is sent, there is no way to warn the players before it happens. Try using "CommandPreprocessEvent" to check if the command sent was "/reload", and if it is, cancel the command and issue your own reload command.
     
  3. Offline

    fireboyev

    Yeah, Like you said, the reload event gets triggered too fast, oh well.

    Thanks for your help.
     
  4. Offline

    mythbusterma

    @Zombie_Striker @fireboyev

    Listen for the PlayerCommandPreProcessEvent, cancel it and warn the player in the event handler, then schedule the server to run the command "reload" directly, as this will not trigger the event (this doesn't work with the console, but it's a halfway solution).
     
    MCMastery likes this.
Thread Status:
Not open for further replies.

Share This Page