Development Assistance unregistering commands

Discussion in 'Plugin Help/Development/Requests' started by Code01, May 19, 2015.

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

    Code01

    I'm looking how to unregister certain commands and then how to register again.
     
    Last edited: May 19, 2015
  2. Offline

    timtower Administrator Administrator Moderator

    Moved to Bukkit alternatives.
     
  3. Offline

    Code01

    @timtower I hereby request a move back as I edited to thread to match the rules for the bukkit-only development.
     
  4. Offline

    CoolGamerXD

    @Code01 First of all create your custom event class that will get player and will get enum.
    Your event will something like this.
    Code:
    Player p;
            Type t;
      
           public [This Class Name](Player p, Type t) {
                   this.p = p;
                   this.t = t;
           }
      
           public Player getPlayer() {
                   return p;
           }
      
           public Type getType() {
                   return t;
           }
      
           private static final HandlerList handlers = new HandlerList();
        
           public HandlerList getHandlers() {
               return handlers;
           }
        
           public static HandlerList getHandlerList() {
               return handlers;
           }
    And, Create one enum named "Type" KICK, BAN; Then in your command class when you kick the player and you send the message like you have been kicked...after that line you call the event.
    Code:
    Bukkit.getServer().getPluginManager().callEvent(new Your Event Class Name(targetplayer, Type.KICK));
     
  5. Offline

    sciolizer

    A couple options:

    • You can register only one command, and parse the second word as a subcommand. e.g. instead of creating the commands /north, /south, /east, and /west, you create one command /go, which is used like /go north, /go south, /go east, and /go west.
    • Intercept every command (including from other plugins!) with PlayerCommandPreprocessEvent. This is probably not what you want, but I don't know your intentions. Like it says in the docs:
     
  6. Offline

    timtower Administrator Administrator Moderator

    Yet I can see the history and know what you are using. Denied
    Don't forget the reflection.
     
  7. Offline

    sciolizer

    Reflection as in java.lang.reflect? I'm not sure I understand.
     
  8. Offline

    timtower Administrator Administrator Moderator

Thread Status:
Not open for further replies.

Share This Page