Solved How to replace "Unknown command" message?

Discussion in 'Plugin Development' started by Quaro, Oct 5, 2013.

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

    Quaro

    How to replace "Unknown command" message?
     
  2. Offline

    Axe2760

    judging on the question, I'd say you need to register the command in your plugin.yml?
     
  3. Offline

    Quaro

    I want to replace default "Unknown command" message. Thats it.
     
  4. Offline

    Axe2760

    Ah, oops, haha. This would be the wrong section, I have no idea how. Perhaps server.properties?
     
  5. Offline

    Necrodoom

    Moved to correct section (?)
     
  6. Offline

    Wurlshkins

    There are a number of different plugins which allow this without the hassle of doing it manually. They allow you to set colour codes as well as change the default message. However, sometimes essentials will actually prevent the plugin from working, although this is not always the case.
     
  7. Offline

    PolarCraft

  8. Offline

    Necrodoom

    Info please? that is quite improbable since essentials has nothing to do with it.
     
  9. Offline

    Quaro

    I'm beginner java programmer, so i want to make it on my own plugin, not to use others.
     
    Axe2760 likes this.
  10. Offline

    Necrodoom

    ...And moved back to "plugin development".
    Micius Try be more clear next time on what you want exactly.
     
    Axe2760 and Minecrell like this.
  11. Offline

    Minecrell

  12. Offline

    Goblom

  13. Offline

    Wurlshkins

    It seems I was wrong in my earlier statement. I don't use Essentials and thought Essentials actually added a custom unknown command. meaning, Essentials has a higher priority feature which can be disabled/enabled.
     
  14. Offline

    Alex3543

    Code:
    @EventHandler(priority = EventPriority.NORMAL)
        public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
            if (!event.isCancelled()) {
                Player player = event.getPlayer();
                String cmd = event.getMessage().split(" ")[0];
                HelpTopic topic = Bukkit.getServer().getHelpMap().getHelpTopic(cmd);
                if (topic == null) {
                    player.sendMessage("§cThe command " + ChatColor.GOLD + cmd + " §cdoes not excist");
                    event.setCancelled(true);
                }
            }
        }
     
    x8b likes this.
  15. Offline

    Quaro

    Thanks Alex!
     
Thread Status:
Not open for further replies.

Share This Page