Modify unknown message using json

Discussion in 'Spigot Help' started by Fr33styler, Jun 7, 2015.

  1. Is there any way to modify the unknown message from spigot.yml using json?
  2. Here's some simple code for it:
    Code (Java):
        public void onUnknownCmd(PlayerCommandPreprocessEvent e) {
            Player p = e.getPlayer();
            if (!e.isCancelled()) {
            Command cmd = Bukkit.getPluginCommand(e.getMessage().replace("/",""));
            if (cmd == null) {
                TextComponent unk = new TextComponent(e.getMessage() + " is not a valid command!");
                    unk.setHoverEvent(new HoverEvent(
                            HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(
                                    ChatColor.AQUA + "View a list of commands by "
                                            + ChatColor.GREEN + "Clicking Here!")
                    unk.setClickEvent(new ClickEvent(
    So, if a player uses an unknown command, they will get "<command> is not a valid command!" in red. If they hover over this, they will get a message asking to click on the message. If they click on the message, they will run the /help command.
    #2 Arman, Jun 7, 2015
    Last edited: Jun 7, 2015
  3. I didn't want to code, i just want to know if i can modify the message from spigot.yml
  4. Can you modify it from spigot.yml? Yes. Can you modify it with from spigot.yml with JSON? No.
  5. Thats the answear i wanted from start, thanks :D