diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-01-04 03:27:25 +0000 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-01-04 03:27:25 +0000 |
commit | 7b01bc894d9ad19ca65a2b53b966102220e161b4 (patch) | |
tree | 849a5b875edc3621a2de323369af3f2d795a4273 | |
parent | 2678be90e3a09b33dbd495772c89fb796793e36c (diff) | |
download | Essentials-7b01bc894d9ad19ca65a2b53b966102220e161b4.tar Essentials-7b01bc894d9ad19ca65a2b53b966102220e161b4.tar.gz Essentials-7b01bc894d9ad19ca65a2b53b966102220e161b4.tar.lz Essentials-7b01bc894d9ad19ca65a2b53b966102220e161b4.tar.xz Essentials-7b01bc894d9ad19ca65a2b53b966102220e161b4.zip |
Readlocks maybe...
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Kits.java | 9 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandeco.java | 3 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/user/User.java | 5 |
3 files changed, 11 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Kits.java b/Essentials/src/com/earth2me/essentials/Kits.java index 4e58cb786..5ba08d93e 100644 --- a/Essentials/src/com/earth2me/essentials/Kits.java +++ b/Essentials/src/com/earth2me/essentials/Kits.java @@ -33,6 +33,7 @@ public class Kits extends AsyncStorageObjectHolder<com.earth2me.essentials.setti @Override public Kit getKit(String kitName) throws Exception { + Kit kit; acquireReadLock(); try { @@ -41,18 +42,18 @@ public class Kits extends AsyncStorageObjectHolder<com.earth2me.essentials.setti { throw new Exception(_("kitError2")); } - Kit kit = getData().getKits().get(kitName.toLowerCase(Locale.ENGLISH)); + kit = getData().getKits().get(kitName.toLowerCase(Locale.ENGLISH)); if (kit == null) { throw new Exception(_("kitError2")); } - return kit; + } finally { unlock(); - } - + } + return kit; } @Override diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java index 299d23d2f..b9c47a29f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandeco.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandeco.java @@ -45,7 +45,8 @@ public class Commandeco extends EssentialsCommand break; case RESET: - @Cleanup ISettings settings = ess.getSettings(); + @Cleanup + ISettings settings = ess.getSettings(); settings.acquireReadLock(); player.setMoney(amount == 0 ? settings.getData().getEconomy().getStartingBalance() : amount); break; diff --git a/Essentials/src/com/earth2me/essentials/user/User.java b/Essentials/src/com/earth2me/essentials/user/User.java index 30b095657..aaebbf56e 100644 --- a/Essentials/src/com/earth2me/essentials/user/User.java +++ b/Essentials/src/com/earth2me/essentials/user/User.java @@ -676,7 +676,10 @@ public class User extends UserBase implements IUser final Map<Integer, ItemStack> overfilled; if (isAuthorized("essentials.oversizedstacks")) { - int oversizedStackSize = ess.getSettings().getData().getGeneral().getOversizedStacksize(); + @Cleanup + final ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + int oversizedStackSize = settings.getData().getGeneral().getOversizedStacksize(); overfilled = InventoryWorkaround.addItem(getInventory(), true, oversizedStackSize, itemStack); } |