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