Solved Checking if a player has played before, but is offline.

Discussion in 'Plugin Development' started by AoH_Ruthless, Dec 8, 2013.

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

    AoH_Ruthless

    How do I check in a command if a player is offline but has played before?

    Code:java
    1. Player target = null;
    2.  
    3. if(target != null) {
    4. sender.sendMessage("debug1");
    5. } else {
    6. sender.sendMessage("debug2");
    7. return true;
    8. }
    9.  


    Checking if they have played before with hasPlayedBefore(); doesn't work because the target can't be null. If I nest it where it's checking if the target isn't null, then my purpose still isn't served.
     
  2. Offline

    The_Doctor_123

    Code:java
    1. OfflinePlayer oPlayer = Bukkit.getOfflinePlayer(String name);

    The hasPlayedBefore() method is inherited from OfflinePlayer.
     
    AoH_Ruthless likes this.
  3. Offline

    AoH_Ruthless

    The_Doctor_123
    *facepalm* I feel like an idiot.
    Thank you for your help :)
     
Thread Status:
Not open for further replies.

Share This Page