saving the player location when disconnecting for the next server join

master
alex 2022-04-10 18:46:04 +02:00
parent 49c40a87bb
commit ba44cc3bc0
1 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.redisson.api.RMap;
import java.util.Map;
import java.util.Objects;
@ -26,11 +27,18 @@ public class PlayerQuitListener implements Listener {
if (!CloudNetDriver.getInstance().getComponentName().startsWith("Lobby")) {
Map<Object, Object> map = KrakatoaAPI.getInstance().getRedisManager().getPlayer(uuid);
KrakatoaAPI.getInstance().getLogger().info("quit " + map.keySet());
if (!map.isEmpty()) {
map.put("lastLocation", round(player.getLocation().getX()) + " " + round(player.getLocation().getY()) + " " + round(player.getLocation().getZ()));
}
RMap<String, String> map2 = KrakatoaAPI.getInstance().getRedisManager()
.getRedissonClient()
.getMap("player:" + uuid);
KrakatoaAPI.getInstance().getLogger().info("quit2 " + map2.keySet());
}
}