getting the Location where a player logged out

Discussion in 'Plugin Development' started by dibujaron, Feb 10, 2013.

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

    dibujaron

    Hello guys. I believe this is a very simple request. I need a way, given the name of a player who is known to be offline, to find the location where he logged out. I know this must exist, but I can't find it. I would have thought that it would be included in the OfflinePlayer class, but it isn't. This leads me to believe that the solution is obvious and I am just being dumb.

    Thanks for any help you can offer!
     
  2. Offline

    RealDope

    Seems like you'll have to store the locations yourself on logout, you're right, there's nothing in OfflinePlayer.

    That doesn't seem right though, because Minecraft and/or Bukkit stores these locations somewhere for when they log in. Maybe you can like fake a loginevent and get the login location?
     
  3. Offline

    dibujaron

    hmm... that might work. But I still think there has to be an easier way than that. It's ridiculous to think that there's this whole HUGE api and not a method for this, when it would be so easy?...
     
  4. Offline

    Sagacious_Zed Bukkit Docs

    Its not safe for bukkit to save because worlds can come and go at will.
     
  5. Offline

    RainoBoy97

    PlayerQuitEvent -> event.getPlayer().getLocation()
     
  6. Offline

    polo2673

    Code:
    @EventHandler
    onPlayerLeave(PlayerQuitEvent event){
    Player player = event.getPlayer();
    player.getLocation();
    
    Try that it will probably work :) or something along those lines
     
  7. Offline

    chasechocolate

    Cleaning things up:
    Code:java
    1. @EventHandler
    2. public void onPlayerQuit(PlayerQuitEvent event){
    3. Player player = event.getPlayer();
    4. Location loc = player.getLocation();
    5. }
     
  8. Offline

    Cirno

    If those don't work, you may be able to access the .dat files. Not sure how they're read though.
     
Thread Status:
Not open for further replies.

Share This Page