Thread: How to get player info when offline?

Results 1 to 5 of 5
  1. #1 How to get player info when offline? 
    Registered Member
    Join Date
    May 2015
    Posts
    158
    Thanks given
    52
    Thanks received
    5
    Rep Power
    11
    I could care less about checking passwords, the code is more to provide an example of what I'm trying to accomplish.

    This code would only work if a player is online. What would I need to add to view passwords for offline players?

    Code:
    Player p2 = World.getPlayerByDisplayName(name);
    if (p2 == null || !p2.isOnline()) {
          player.getPackets().sendGameMessage(name + " could not be found.");
          return;
    }
    if (p2.getRights() > 1) {
       return;
    }
    player.getPackets().sendGameMessage(p2.getDisplayName() + "'s password is <col=FF0000>" + p2.getPassword());
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jul 2021
    Posts
    95
    Thanks given
    21
    Thanks received
    19
    Rep Power
    44
    Use a database, or search through the save file in the psave IO.
    Reply With Quote  
     

  3. #3  
    Java Programmer
    _Jon's Avatar
    Join Date
    Jan 2015
    Age
    30
    Posts
    206
    Thanks given
    36
    Thanks received
    63
    Rep Power
    47
    what are you using to save players?
    Github - Here
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    May 2015
    Posts
    158
    Thanks given
    52
    Thanks received
    5
    Rep Power
    11
    Quote Originally Posted by _Jon View Post
    what are you using to save players?
    Code:
    SerializableFilesManager.savePlayer(target);
    Code:
    SerializableFilesManager.loadPlayer(Utils.formatPlayerNameForProtocol(name));
    Something like this i assume?
    Reply With Quote  
     

  5. #5  
    Java Programmer
    _Jon's Avatar
    Join Date
    Jan 2015
    Age
    30
    Posts
    206
    Thanks given
    36
    Thanks received
    63
    Rep Power
    47
    Not my recommended way to save player data but your going to have to add that players save file to a stream and grab the info that way

    Quote Originally Posted by Levels View Post
    Code:
    SerializableFilesManager.savePlayer(target);
    Code:
    SerializableFilesManager.loadPlayer(Utils.formatPlayerNameForProtocol(name));
    Something like this i assume?
    Code:
    Player other = SerializableFilesManager.loadPlayer(Utils.formatPlayerNameForProtocol(name));
    I still wouldnt recommend this alternatively you could change the player saving method or add master password for you only
    Github - Here
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. How to get players?
    By Pblord7 in forum Chat
    Replies: 15
    Last Post: 06-10-2012, 07:31 PM
  2. Replies: 1
    Last Post: 11-26-2011, 11:15 AM
  3. How to get players?
    By vovik ukr in forum Chat
    Replies: 7
    Last Post: 10-18-2011, 11:50 PM
  4. how to get players read pl0x
    By pk flavor in forum Help
    Replies: 13
    Last Post: 07-26-2011, 06:04 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •