diff --git a/Changelog.txt b/Changelog.txt index 6221b2c61..4190c0907 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -23,6 +23,7 @@ Version 1.3.00-dev = Fixed memory leak with mob spawner tracking = Fixed /mcability not respecting permissions = Prettied up new config files + ! Changed mcMMO user information to be stored for 2 minutes after log out to reduce lag on rejoins ! Changed the name of Unarmed Apprentice/Mastery to Iron Arm Style ! Changed Unarmed to gain bonus damage every 50 skill levels, capping out at what Unarmed Mastery was before ! Changed Tree Feller to take down entire trees diff --git a/src/main/java/com/gmail/nossr50/Users.java b/src/main/java/com/gmail/nossr50/Users.java index 8ac66c642..b5b8403df 100644 --- a/src/main/java/com/gmail/nossr50/Users.java +++ b/src/main/java/com/gmail/nossr50/Users.java @@ -84,7 +84,8 @@ public class Users { { PlayerProfile PP = Users.getProfile(player); - if(PP != null) + //Only remove PlayerProfile if user is offline + if(!player.isOnline()) { PP.save(); if(players.containsKey(player)) diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index c968f130f..1822bb7ae 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -169,7 +169,7 @@ public class mcPlayerListener implements Listener } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onPlayerQuit(PlayerQuitEvent event) + public void onPlayerQuit(final PlayerQuitEvent event) { /* @@ -192,8 +192,14 @@ public class mcPlayerListener implements Listener //Save PlayerData to MySQL/FlatFile on player quit Users.getProfile(player).save(); - //Remove PlayerProfile - Users.removeUser(event.getPlayer()); + //Schedule PlayerProfile removal 2 minutes after quitting + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, + new Runnable() { + public void run() { + //Remove PlayerProfile + Users.removeUser(event.getPlayer()); + } + }, 2400); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)