Solved how do i change the global 'unknown command' message

Discussion in 'Spigot Plugin Development' started by MrChickenSteve, Jul 11, 2018.

  1. so, i'm making a plugin quite big. mabye even just a little bit smaller in essentials, and i want to change the entire global message for when you enter an unknown command.
    not the 'error' message for my plugin but everything else aswell.
    i know its possible as they did it in essentials i just don't know how to do it.
  2. If you mean this message "Unknown command. Type "/help" for help." then that's not from essentials but you can change this message simply by going into the servers folder and into spigot.yml mainly this part

    Code (Text):
      whitelist: You are not whitelisted on this server!
      unknown-command: Unknown command. Type "/help" for help.
      server-full: The server is full!
      outdated-client: Outdated client! Please use {0}
      outdated-server: Outdated server! I'm still on {0}
    • Agree Agree x 1
  3. Yeah.... but i want to impliment it directly into my plugin. i know its possible because like i said before the plugin 'essentials' changed the vanilla one so..... why can't i?
  4. Since the messages are coming figurable, that means they are loaded and stored in memory somewhere in either nms or obc land. Just look at the server source code and find out where, then change it. Simple.
  5. okay, i found the command class in the bukkit source code i've just got to decompile it to edit it
  6. What? No. You misunderstand me.

    Look at the server source code so you know where it's storing that message. Then in your plugin you can use nms to access and modify that value.
  7. Ohhhhhhh ok i get it now
  8. No NMS needed
    Code (Java):
    SpigotConfig.unknownCommandMessage = "Your Message"
  9. eaaaaahhhhh! its so good when people actually come up with simple code threads
    • Agree Agree x 1
  10. wait. before i rush where do i put this line? like, what class. my listener, my main and in that class what place
    • Like Like x 1
  11. You can use it whereever you want
  12. :( Another good learning experience lost to spoon-feeding.
    • Agree Agree x 1
  13. i tried to paste it on onEnable, got an error.
    i pasted it underneath 'public class Main extends JavaPlugin { Didn't work.
    so i just decided to use NMS in the end
  14. NMS is good for understanding minecraft servers, but it's complicated, version dependent and very inperformant. You try to only use NMS when there is no other solution.

    What error did you have and what solution did you come up with?
  15. i had the error 'Syntax error on token "unknownCommandMessage", VariableDeclaratorId expected after this token'
  16. You have to put the line into a method like onEnable. You need to know Java if you want to code plugins.
  17. oh okay