Solved How do I deal with a OfflinePlayer?

Discussion in 'Plugin Development' started by Shadow_tingBRO, Apr 12, 2019.

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

    Shadow_tingBRO

    So I am making a plugin and I am getting stuck at one point. Im creating a MiniGame plugin and i want to add a /rejoin command. This command is used when the player leaves the server and comes back on and wants to rejoin the game they were in. That part is not going well. It keeps sending the message to the player that i coded that says they were not in a game when they left. I created a HashMap like this to store the players once they left: ... = new HashMap<Player, (mygameclassinstance)>();
    I realize now I should have used OfflinePlayer as they are put into this Map when they leave the server. Does anybody know how i would deal with it if i were to do ... = new HashMap<OfflinePlayer, (gameinstance)>(); ? I mean as in then when a player joins back on the server and rejoins, they can do /rejoin and then it will somehow make a offline player go to a player. Also this vice versa from a Player to OfflinePlayer, I think its something like p.getPlayer() which returns their offlineplayer variable, im not sure about that tho!

    Im not sure i have tried this from looking at the methods in the player and offlineplayer:
    Code:
     
    
    //Creating a offline from a online
    OfflinePlayer off = someonlineplayer.getPlayer();
    //Creating a online from a offline
    Player on = someofflineplayer.getPlayer();
    
    That does not work. Any idea around this?
     
  2. Offline

    timtower Ninja on the waves Moderator

  3. Offline

    Shadow_tingBRO

    Goooooooood point wow thanks @timtower yet again lol
     
Thread Status:
Not open for further replies.

Share This Page