Solved Entered with no arguments it returns as internal error.

Discussion in 'Plugin Development' started by DarkLord_MC, Jul 19, 2016.

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

    DarkLord_MC

    When I type the first arg it will come up with an error and I put the right args in it

    What I'm I doing wrong?
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      375.7 KB
      Views:
      11
    • 2.jpg
      2.jpg
      File size:
      278.3 KB
      Views:
      7
    • Console.jpg
      Console.jpg
      File size:
      269.5 KB
      Views:
      7
  2. Offline

    ipodtouch0218

    The error isn't on the lines that you sent us (ln90), so we can't tell what's wrong.
    Post the whole class using www.pastebin.com
     
  3. Offline

    DarkLord_MC

  4. @DarkLord_MC
    On line 90 you try to access a variabel insida the args array, but the entry doesn't exist and therefor throws an ArrayIndexOutOfBoundsException.
     
  5. Offline

    DarkLord_MC

  6. @DarkLord_MC Where did you learn Bukkit?

    1. Don't use Java's Logger, Bukkit has one for a reason
    2. Stop the static abuse.
    3. Why are you replacing the string like that? ChatColor.translateAlternateColorCodes or just use ChatColor
    4. Remove all the reload and addDefault, it is not needed. Just use saveDefaultConfig
    5. Why do you have so many commands in one class?
    6. No need for the enable message Bukkit does it for you
    7. Print using logger rather than sending to ConsoleCommandSender
    8. Don't use saveDefaultConfig on disable, just save.
    9. No need for disable message
    10. Check before casting
    11. You are using arg 0 and not checking the length. Checks are good!!
    12. command.getName not label.
    13. Why not just use ChatColor rather than changing them with ChatColor.translateAlternateColorCodes
    14. You use arg 1 without checking the length.

    Please fix these issues before continuing with Bukkit. I also highly recommend learning Java before using any API. You will keep running into these basic issues if you don't know Java.
     
  7. Offline

    DarkLord_MC

    Ok ill fix most the thing thxs for the advice. :)
     
Thread Status:
Not open for further replies.

Share This Page