Changed how we remove PlayerProfiles to reduce lag

This commit is contained in:
nossr50 2012-02-23 08:27:36 -08:00
parent 4acc0b63fd
commit a372ca34e6
3 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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))

View File

@ -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)