Plugin doesn't work

Discussion in 'Plugin Development' started by LucyUwU_, May 3, 2021.

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

    LucyUwU_

    I wrote a plugin for fly, when I give it to another player it works, but when I give it to myself it gives me an error, does anyone know how to fix it? Video of the error and the plugin:
     
  2. Online

    timtower Administrator Administrator Moderator

    @LucyUwU_ Please post the code using pastebin or [code] < code here > [/code]
     
    LucyUwU_ likes this.
  3. Offline

    LucyUwU_

  4. Online

    timtower Administrator Administrator Moderator

    @LucyUwU_ Is that a stacktrace in the video? If so: post it as well.
     
  5. Offline

    davidclue

    @timtower the error is an array out of bounds exception and it's on this line
    Code:
    Player cel = Bukkit.getPlayer(args[0]);
    Your problem is that you have no return statements in your code so when a player types /fly there are no args and that's why it's throwing that error.
     
  6. Online

    timtower Administrator Administrator Moderator

    @davidclue Do a length check before using args[0]
     
  7. Offline

    davidclue

    That too, the code has a lot more issues than just the problems we mentioned though...
     
  8. Online

    timtower Administrator Administrator Moderator

    Whoops, thought you was the thread poster
     
    davidclue likes this.
Thread Status:
Not open for further replies.

Share This Page