Solved command small fix

Discussion in 'Plugin Development' started by noraver, Apr 6, 2013.

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

    noraver

    hey guys working target health and everything works fine beside 1 thing

    in-game when ever i do the command /pho it says /pho
    where it should just show Please specify player by doing /pho player
    and when you do /pho bless_
    it says /pho
    under it
    [​IMG]


    maybe im just not seeing it could someone show me

    Code:java
    1.  
    2. public boolean onCommand(CommandSender sender, Command cmd,
    3. String commandLabel, String[] args) {
    4. if ((sender instanceof Player)) {
    5. this.player = ((Player) sender);
    6. }
    7.  
    8. if (commandLabel.equalsIgnoreCase("pho")) {
    9. if (this.player.hasPermission("permissionshealth.pho")) {
    10. if (this.player == null) {
    11. sender.sendMessage("This command can only be run by a player. ");
    12. } else if (args.length == 0)
    13. player.sendMessage("Please specify a player by doing /pho <player]>");
    14. else if (args.length == 1) {
    15. if (player.getServer().getPlayer(args[0]) != null) {
    16. Player targetPlayer = player.getServer().getPlayer(
    17. args[0]);
    18. player.sendMessage(ChatColor.GREEN
    19. + targetPlayer.getDisplayName() + " has "
    20. + targetPlayer.getHealth() + " Health!");
    21. } else {
    22. player.sendMessage("You do not have permission to do that command!");
    23. }
    24. } else
    25. player.sendMessage(ChatColor.RED
    26. + "That player is not online!");
    27. }
    28.  
    29. return false;
    30. }
    31. return false;
    32. }
    33. }
    34. [syntax]
    35.  
    36. just noticed the <player]> ] in player will remove that lol[/syntax]
     
  2. Offline

    justcool393

    Change the return false; to return true;
     
  3. Offline

    noraver

    justcool393
    LOL thanks that fixed it something so small yet so evil =)
     
  4. Offline

    justcool393

    No problem :D
     
Thread Status:
Not open for further replies.

Share This Page