Reroute /server command to custom /server?

Discussion in 'Spigot Plugin Development' started by IronMan_59, Jun 9, 2017.

  1. So I'm looking to make a custom /server command but bungee's command is still run when I run the command. I've tried deleting the files for the server command in the modules folder and removing it from modules.yml but it still doesn't run my command, any idea of how to fix? (I coded the custom /server)
  2. ScarabCoder

    ScarabCoder Retired Resource Staff

    • Winner Winner x 1
  3. I have, and the solutions I've seen haven't worked?
  4. Could always check PlayerCommandPreProcessEvent, cancel if it's /server, then fire your own.

    Sent from my iPhone using Tapatalk
  5. bungee intercepts this command and its never sent to the server

    you need to delete cmd_server.jar and maybe remove it from the config file in order to implement it on a server, or overwrite it on the bungee level as a bungee plugin.

    To do this in the bukkit plugin would require using the Bungee<->Bukkit API
    #5 Aikar, Jun 9, 2017
    Last edited: Jun 9, 2017
  6. As pvprealm said, check PlayerCommandPreProcessEvent, setcancelled if its /server, then run your method.
  7. Mas


    As said by Aikar, you'll need to remove the command at the Bungee level. This is because all chat/commands get caught by the bungee proxy before being passed on to Spigot, so /server will have already been executed by the time you try and intercept it at the Spigot level.