Solved Removing unknown command message

Discussion in 'Plugin Development' started by lifebearups, Feb 3, 2013.

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

    lifebearups

    How can I remove the message "Unknown comand. Type "help" for help" when i use this code:

    Code:
    public void comando(PlayerCommandPreprocessEvent e){
    String comando = e.getMessage().replace("/", "");
    String nome = ChatColor.BLUE + "[RedSky] " + ChatColor.AQUA;
    Player player = (Player) e.getPlayer();
    if(plugin.getConfig().get("rportes." + comando) != null){
    int x = plugin.getConfig().getInt("rportes."+ comando +".x"),y = plugin.getConfig().getInt("rportes."+ comando +".y"),z = plugin.getConfig().getInt("rportes."+ comando +".z");
     String mundos = plugin.getConfig().getString("rportes."+ comando +".mundo");
     World mundo = Bukkit.getWorld(mundos);
     player.teleport(new Location(mundo, x, y, z));
     player.sendMessage(nome + "Ok! Good game");
    }
    }
    
    The code is working, but when used give me that error .-.
     
  2. Offline

    Tog

    Cancel the event.
    Like this
    Code:
    e.setCancelled(true);
     
  3. Offline

    lifebearups

    Tog Thanks ;D
     
Thread Status:
Not open for further replies.

Share This Page