Missed an unlock condition, lets use a finally. Should Fix #2180

This commit is contained in:
t00thpick1 2014-08-05 18:57:13 -04:00
parent 79a17b0c1c
commit c156f0c346

View File

@ -33,6 +33,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
public void run() { public void run() {
lock.lock(); lock.lock();
try {
if (this.cancelled) { if (this.cancelled) {
return; return;
} }
@ -42,7 +43,6 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
mcMMO.p.getLogger().info("Aborting profile loading recovery for " + player.getName() + " - player logged out"); mcMMO.p.getLogger().info("Aborting profile loading recovery for " + player.getName() + " - player logged out");
this.cancel(); this.cancel();
cancelled = true; cancelled = true;
lock.unlock();
return; return;
} }
@ -55,7 +55,6 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
new ApplySuccessfulProfile(profile).runTask(mcMMO.p); new ApplySuccessfulProfile(profile).runTask(mcMMO.p);
this.cancel(); this.cancel();
cancelled = true; cancelled = true;
lock.unlock();
return; return;
} }
@ -66,11 +65,12 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
player.sendMessage(LocaleLoader.getString("Profile.Loading.Failure").split("\n")); player.sendMessage(LocaleLoader.getString("Profile.Loading.Failure").split("\n"));
this.cancel(); this.cancel();
cancelled = true; cancelled = true;
lock.unlock();
return; return;
} }
} finally {
lock.unlock(); lock.unlock();
} }
}
private class ApplySuccessfulProfile extends BukkitRunnable { private class ApplySuccessfulProfile extends BukkitRunnable {
private final PlayerProfile profile; private final PlayerProfile profile;
@ -104,5 +104,3 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
} }
} }
} }