Dispatch Commands.

Discussion in 'Plugin Development' started by adde, Jul 11, 2013.

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

    adde

    Hello. I am doing a command that will dispatch commands from the console, here's my code:
    Code:java
    1.  
    2. @EventHandler
    3. public boolean onCommand(CommandSender player, Command cmd, String commandLabel, String[] args){
    4.  
    5. if(cmd.getName().equalsIgnoreCase("zombie")){
    6. if(player.hasPermission("dkits.zombie")){
    7. plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "kit zombie " + player);
    8. plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "eco give " + player + " " + plugin.getConfig().getString("Zombie.MoneyAmount"));
    9. plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "exp give " + player + " " + plugin.getConfig().getString("Zombie.ExpAmount"));
    10. player.sendMessage(ChatColor.GREEN + "[NexusPvP] " + ChatColor.GOLD + "You have been given your Zombie kit.");
    11. }else{
    12. player.sendMessage(ChatColor.RED + "You're not allowed to use this donator kit.");
    13. }
    14. return true;
    15. }
    16.  
    17. return false;
    18. }
    19.  


    It will say "Player not found" from essentials when doing the kit zombie command, same with eco and exp too, why?
     
  2. Offline

    timtower Administrator Administrator Moderator

    adde Try player.getName()
     
    adde likes this.
  3. Offline

    adde

    Oh. -_-
    I had that problem like a year ago and I am stupid this time too, I completely forgot it. Thanks.
     
    timtower likes this.
  4. Offline

    timtower Administrator Administrator Moderator

    Glad that I could help ;) And everybody makes mistakes :p
     
    adde likes this.
Thread Status:
Not open for further replies.

Share This Page