Player Wrapper class

Discussion in 'Plugin Development' started by Gosintary, Dec 27, 2023.

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

    Gosintary

    So I'm making this plugin where I wanna store some variables for every player.
    My plan right now is to create a user class, and when a player joins I'll make an instance of it and store it in an arraylist for later use. assuming this works, is this the best way to do this? Tryna learn to do things right! Thanks.
     
  2. Offline

    timtower Administrator Administrator Moderator

    @Gosintary I would save a map<uuid, custom info class>
    Without storing the player object itself
     
  3. Offline

    Gosintary

    Thanks! Yeah I realized pretty quickly that ArrayList was the incorrect storage method but that I was looking for a map, and I just onPlayerJoin map.put(UUID, PlayerWrapper) and when I need to access the PlayerWrapper I just PlayerWrap pW = wrapMap.get(UUID);
     
    timtower likes this.
Thread Status:
Not open for further replies.

Share This Page