Plugin Help onCommand errors

Discussion in 'Plugin Help/Development/Requests' started by Rafay Siddiqui, Jun 3, 2017.

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

    Rafay Siddiqui

    Yo so im launching a server soon and decided to take some plugin classes. Everything was fine and all but then i experienced some issues.

    On the line public boolean onCommand(CommandSender sender, Command cmd, String Label, String[] args) {
    onCommand is underlined red, the comma after sender is underlined red, the comma after cmd is underlined red and the last square bracket of String[] is underlined red. Please help me!

    Heres the code, bro/sista!
    Code:
    https://pastebin.com/FCLpc4b3
     
  2. Online

    timtower Administrator Administrator Moderator

    Changed title to be descriptive.

    @Rafay Siddiqui Hover your mouse over it, what does it say?
     
  3. Offline

    Rafay Siddiqui

    Right hang on lemme check.

    Right so onCommand says illegal modifier for parameter onCommand, only final is permitted. The open bracket after onCommand says Syntax error on token "(" ; expected. The commas after cmd and sender says syntax error on token "," ; expected. On the last closing square bracket of String[] it says syntax error insert ";" to complete localvariabledeclerationstatement. I hope this helps as it took me ages to copy out the messages on a laptop! I'm gonna assume that I need a ";" after string[] to fix that, but I'm not clear on the rest!!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2017
  4. Online

    timtower Administrator Administrator Moderator

    @Rafay Siddiqui That will not fix it, rename your main class to start with please.
    Is there a quick fix option?
     
  5. Offline

    Rafay Siddiqui

    Aight ill rename my class to Nutella. O w8 there isnt an option ;/

    Commas on sender and cmd dont have a quick fix option neither does string. CommandSender does however. It is remove invalid modifiers

    I also found out how to rename the class, but it will not let me because of the "syntax errors." I think that these are the errors that we are trying to fix!

    @timtower

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2017
  6. Offline

    Zombie_Striker

    @Rafay Siddiqui @timtower
    You forgot to add a close bracket between the onDisable and onCommand. Add one and remove one close bracket from the bottom of the class.
     
  7. Offline

    Rafay Siddiqui

    Right OK. I fixed command sender, but oncommand and the commas and the string[] last square bracket are still red! please help me!
     
    Last edited: Jun 3, 2017
  8. Offline

    Zombie_Striker

  9. Offline

    Rafay Siddiqui

    @Zombie_Striker https://pastebin.com/nW5VWJKM ERRORS = On the line public boolean onCommand(CommandSender sender, Command cmd, String Label, String[] args) {
    onCommand is underlined red, the comma after sender is underlined red, the comma after cmd is underlined red and the last square bracket of String[] is underlined red. Please help me! The Open bracket after onCommand is underlined red too. CommandSender has been fixed this time though. The error messages are the same ones as last time!
     
  10. Offline

    Zombie_Striker

    @Rafay Siddiqui
    1. You still have not put a closed curly bracket between the onDisable and on command ( Put } on a new line after the logger)
    2. You have an extra parentheses ')' at the end of the on command. There should only be one. Remove one of them.
     
  11. Offline

    Rafay Siddiqui

    Last edited by a moderator: Jun 4, 2017
Thread Status:
Not open for further replies.

Share This Page