[1.12.1] Trouble with Scoreboards and Getting All Players

Discussion in 'Plugin Development' started by NightTerror6, Sep 23, 2017.

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

    NightTerror6

    Source: https://pastebin.com/xBuCEi0w
    I've been trying to make scoreboard teams and a test "kills" objective in the 1.12.1 API, but I am running into internal errors (NullPointerException, I believe), and even when these exceptions are not thrown, it doesn't work as intended.

    Also, I've commented out some code somewhere within onCommand that attempts to get all the players online; however, this is causing crashes. Preferably, I'd put it in an array or an ArrayList.
     
  2. Offline

    yPedx

    Could you show us the NPE error?
     
  3. Offline

    NightTerror6

    https://imgur.com/a/h4btb

    I posted an imgur link, but it's gotta get approved first.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Sep 23, 2017
  4. Offline

    Zombie_Striker

    @NightTerror6
    The issues is that you are always creating a new red team instead of trying to get the existing team. Use Scoreboard#getTeam instead of registering the teams over again.
     
  5. Offline

    NightTerror6

    But why get something that doesn't exist?
     
  6. Offline

    Zombie_Striker

    @NightTerror6
    Because it does exists; That's why you are getting the error.
     
  7. Offline

    NightTerror6

    ok, thanks, I'll try it
    NICE ITALICS

    EDIT: Actually, registering the teams wasn't the problem, it was setting the team prefix. Also, whenever I register the teams, either way that is suggested, it still seems that there are no teams.

    EDIT: nvm, screw this, I wrote my own Team class
     
    Last edited: Sep 24, 2017
Thread Status:
Not open for further replies.

Share This Page