Solved Commands not operating

Discussion in 'Plugin Development' started by benolian, Oct 26, 2013.

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

    benolian

    Hey,
    I am creating (for practice sake) a VERY simple player to player teleportation plugin. I am simply making this as a basis to work on with more complex stuff. Its as simple as /ptp [name] [name]. For an unknown reason the commands will not work with the server. When a command is typed nothing happens, upon looking at the console all I see is:
    2013-10-26 04:57:07 [INFO] benolian issued server command: /ptp
    There are never any errors within the console, and nothing ever happens. The server is registering the plugin in things like /plugins, and displaying in /help. Below is the code then plugin.yml
    Code:java
    1. package me.benolian.benhelp;
    2.  
    3. import java.util.logging.Logger;
    4.  
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.Location;
    7. import org.bukkit.command.Command;
    8. import org.bukkit.command.CommandSender;
    9. import org.bukkit.entity.Player;
    10. import org.bukkit.plugin.PluginDescriptionFile;
    11. import org.bukkit.plugin.java.JavaPlugin;
    12.  
    13. public class Benhelp extends JavaPlugin {
    14. public final Logger logger = Logger.getLogger("Minecraft");
    15. public static Benhelp plugin;
    16.  
    17. @Override
    18. public void onDisable() {
    19. PluginDescriptionFile pdfFile = this.getDescription();
    20. this.logger.info(pdfFile.getName() + "Has Been Disabled");
    21. }
    22.  
    23. @Override
    24. public void onEnable() {
    25. PluginDescriptionFile pdfFile = this.getDescription();
    26. this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + "Has Been Enabled");
    27. }
    28.  
    29. public boolean onCommad(CommandSender sender, Command cmd, String commandLabel, String[] args){
    30. Player player = (Player) sender;
    31.  
    32. if(commandLabel.equalsIgnoreCase("ptp") || commandLabel.equalsIgnoreCase("playertp")){
    33. if(args.length == 0){
    34. player.sendMessage(ChatColor.DARK_RED + "Too little arguments");
    35.  
    36. }else if(args.length == 1){
    37. Player targetPlayer = player.getServer().getPlayer(args[0]);
    38. Location targetPlayerLocation = targetPlayer.getLocation();
    39. player.teleport(targetPlayerLocation);
    40.  
    41. }else if(args.length == 2){
    42. Player targetplayer1 = player.getServer().getPlayer(args[0]);
    43. Player targetplayer2 = player.getServer().getPlayer(args[1]);
    44. Location targetlocation = targetplayer2.getLocation();
    45. targetplayer1.teleport(targetlocation);
    46.  
    47. }else{
    48. player.sendMessage(ChatColor.RED + "Player not online");
    49. }
    50. }
    51.  
    52. return false;
    53. }
    54. }
    55.  


    Code:
    name: benhelp
    main: me.benolian.benhelp.Benhelp
    version: 1.0
    description: >
                testplugin for teleporting
    commands:
      ptp:
        description: teleports the sender to specified player or specified player to another specified player.
    
    I can't see what is causing the problem here, to me everything seems to look/work normally. Ideas?
    Thanks
     
  2. You misspelled onCommand.
     
  3. Offline

    TomTheDeveloper

    Please mark this thread as solved.
     
Thread Status:
Not open for further replies.

Share This Page