Solved Need help adding more commands!

Discussion in 'Plugin Development' started by TechAttax, Jul 8, 2014.

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

    TechAttax

    Hello, I am very new to bukkit coding and need help with my plugin "FastLeave" (http://dev.bukkit.org/bukkit-plugins/fast-leave/).

    I would like to add a new command to my plugin that dose the same as the command stated in the code bellow.

    Code:java
    1. package me.tomatogeek;
    2.  
    3. import org.bukkit.command.Command;
    4. import org.bukkit.command.CommandSender;
    5. import org.bukkit.entity.Player;
    6. import org.bukkit.plugin.java.JavaPlugin;
    7.  
    8. public class FastLeaveCommand extends JavaPlugin {
    9.  
    10. @Override
    11. public void onEnable() {
    12. getLogger().info("Leave Enable!");
    13. }
    14.  
    15. @Override
    16. public void onDisable() {
    17. getLogger().info("Leave Disbaled!");
    18.  
    19. }
    20.  
    21. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    22.  
    23. if (cmd.getName().equalsIgnoreCase("leave") && sender instanceof Player) {
    24.  
    25. Player player = (Player) sender;
    26.  
    27. player.kickPlayer("Fast Leave");
    28.  
    29. return true;
    30.  
    31. }
    32.  
    33. return false;
    34.  
    35.  
    36. }
    37.  
    38. }
    39.  
     
  2. Offline

    Heirteir

    TechAttax
    So I imagine your trying to create an alias.
    in your plugin.yml in your commands section where your registering the command put this.
    Code:java
    1. commands:
    2. leave:
    3. aliases: [l]
    4. description: Leave :D

    or if you want multiple aliases
    Code:
    commands:
      leave:
        aliases: [l,le,lea,leav]
        description: Leave ;D
    More can be read here
    http://wiki.bukkit.org/Plugin_YAML
     
  3. Offline

    TechAttax

    Thanks!
     
  4. Offline

    Heirteir

  5. Offline

    TechAttax

    But how would I add a new command to my code?
     
  6. Offline

    Heirteir

Thread Status:
Not open for further replies.

Share This Page