Where are the default craftbukkit.jar commands registered?

Discussion in 'Spigot Plugin Development' started by Technerder, Sep 10, 2017.

  1. like the title suggests i am trying to compile my own fork of CraftBukkit. i have removed a couple of command classes, however i cant find where the commands such as /seed are registered in the CraftBukkit.jar, would someone be able to tell me where they are?

    i tried checking org.bukkit.command.defaults however i couldn't find it.
  2. ./seed is a default vanilla command
  3. ((CraftServer)Bukkit#getServer())#getCommandMap();

    If I am not mistaken.This article might help you if you want to register command to the commandMap
    • Agree Agree x 1
  4. try reading the NMS class called MinecraftServer and locate it's command manager
  5. I legit gave you the answer with my previous reply...
    • Agree Agree x 1
  6. Just cancel the PlayerCommandPreprocessEvent and ServerCommandEvent?
    • Optimistic Optimistic x 1
  7. 2008Choco

    Resource Staff

    That's not the question. Read the original post before replying with useless information / attempts.

    @_ItzMikeGR_ is correct in saying that they are stored within the SimpleCommandMap instance in CraftServer. Though it's worth noting that the CraftBukkit alternatives of commands were completely abolished as of 1.8, I believe, and now use vanilla implementation. In fact, said CraftBukkit command implementations are currently deprecated in 1.12 and set for removal.

    EDIT: My bad, they were actually already removed in commit a1cc4b769ca
  8. MiniDigger


    in the Simplecommandmap you have a map called knownCommands where you can just remove by key to unregister commands.
  9. MiniDigger


    the code your are looking it is over 3 years old...
    bukkit no longer registers vanilla commands like that. so the updated source here https://hub.spigotmc.org/stash/proj...java/org/bukkit/command/SimpleCommandMap.java
    vanilla commands are registered here https://hub.spigotmc.org/stash/proj...a/org/bukkit/craftbukkit/CraftServer.java#353
    you can either modify that part of the code or just remove the commands from the simplecommandmap using a plugin. (they will be registered into this map, you can just remove them from here https://hub.spigotmc.org/stash/proj...a/org/bukkit/command/SimpleCommandMap.java#22 )
  10. To save yourself a lot of work you can disable any command in the superperms permission.yml and then even console cant use them.
  11. MiniDigger


    oh wow, why bother with stupidly outdated versions?
    I don't remember how things worked back then, but I think bukkit did just override the vanilla commands so removing the fallback commands will not do anything, you will use the inbuild commands.
    but since you are stuck in stoneage you are on your own there.
    #11 MiniDigger, Sep 13, 2017
    Last edited: Sep 13, 2017
    • Agree Agree x 1
  12. I did read the post, the OP is trying to remove some commands, there's really no reason to do something so complicated, when one can just cancel the relevant events, emulating the same effect.
  13. 2008Choco

    Resource Staff

    I don't think you read it quite well enough...
    • Agree Agree x 2
  14. There are so many answers,did none of them work out for you?
    • Agree Agree x 1
  15. u wont get much help using outdated software.
    • Agree Agree x 1

Share This Page