diff options
author | ementalo <ementalodev@gmx.co.uk> | 2012-06-06 01:53:34 +0100 |
---|---|---|
committer | ementalo <ementalodev@gmx.co.uk> | 2012-06-06 01:53:34 +0100 |
commit | ff5a82a14cbffbbd65e9baefb09d2c95305124c1 (patch) | |
tree | 85876a5615a9b2e630b0673bdb1a85ecffb54f0d /EssentialsSigns | |
parent | 9b7a40736e54c6a692d3f5ceda72d11b638e728f (diff) | |
download | Essentials-ff5a82a14cbffbbd65e9baefb09d2c95305124c1.tar Essentials-ff5a82a14cbffbbd65e9baefb09d2c95305124c1.tar.gz Essentials-ff5a82a14cbffbbd65e9baefb09d2c95305124c1.tar.lz Essentials-ff5a82a14cbffbbd65e9baefb09d2c95305124c1.tar.xz Essentials-ff5a82a14cbffbbd65e9baefb09d2c95305124c1.zip |
2.9 -> 3.0 merge
Diffstat (limited to 'EssentialsSigns')
6 files changed, 43 insertions, 26 deletions
diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBalance.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignBalance.java index 77f82bdb5..cb8e568aa 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBalance.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignBalance.java @@ -3,7 +3,7 @@ package com.earth2me.essentials.signs; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.IUser; -import com.earth2me.essentials.Util; +import com.earth2me.essentials.utils.Util; public class SignBalance extends EssentialsSign diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBlockListener.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignBlockListener.java index c678c2efa..a2465c76d 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBlockListener.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignBlockListener.java @@ -1,8 +1,9 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.api.IEssentials; +import com.earth2me.essentials.api.ISettings; import com.earth2me.essentials.api.IUser; -import com.earth2me.essentials.Util; +import com.earth2me.essentials.utils.Util; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Material; @@ -32,7 +33,9 @@ public class SignBlockListener implements Listener @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent event) { - if (ess.getSettings().areSignsDisabled()) + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + if (plugin.getSettings().areSignsDisabled()) { return; } @@ -65,15 +68,7 @@ public class SignBlockListener implements Listener LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign."); return true; } - for (EssentialsSign sign : ess.getSettings().enabledSigns()) - { - if (sign.getBlocks().contains(block.getType()) - && !sign.onBlockBreak(block, player, ess)) - { - LOGGER.log(Level.INFO, "A block was protected by a sign."); - return true; - } - for (EssentialsSign sign : plugin.getSettings().getEnabledSigns()) + for (EssentialsSign sign : plugin.getSettings().getEnabledSigns()) { if (sign.getBlocks().contains(block.getType()) && !sign.onBlockBreak(block, player, ess)) @@ -81,19 +76,18 @@ public class SignBlockListener implements Listener LOGGER.log(Level.INFO, "A block was protected by a sign."); return true; } - } - } + } return false; } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onSignChange(final SignChangeEvent event) { - if (ess.getSettings().areSignsDisabled()) + if (plugin.getSettings().areSignsDisabled()) { return; } - User user = ess.getUser(event.getPlayer()); + IUser user = ess.getUser(event.getPlayer()); for (int i = 0; i < 4; i++) { @@ -120,7 +114,7 @@ public class SignBlockListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockPlace(final BlockPlaceEvent event) { - if (ess.getSettings().areSignsDisabled()) + if (plugin.getSettings().areSignsDisabled()) { return; } @@ -154,7 +148,7 @@ public class SignBlockListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockBurn(final BlockBurnEvent event) { - if (ess.getSettings().areSignsDisabled()) + if (plugin.getSettings().areSignsDisabled()) { return; } @@ -182,7 +176,7 @@ public class SignBlockListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockIgnite(final BlockIgniteEvent event) { - if (ess.getSettings().areSignsDisabled()) + if (plugin.getSettings().areSignsDisabled()) { return; } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignEntityListener.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignEntityListener.java index 00ebc60d0..213b0e125 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignEntityListener.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignEntityListener.java @@ -48,7 +48,7 @@ public class SignEntityListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onEntityChangeBlock(final EntityChangeBlockEvent event) { - if (ess.getSettings().areSignsDisabled()) + if (plugin.getSettings().areSignsDisabled()) { return; } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java index 46bbb65db..b33e05a35 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.signs; +import com.earth2me.essentials.Kits; import com.earth2me.essentials.api.ChargeException; import com.earth2me.essentials.economy.Trade; import com.earth2me.essentials.api.IEssentials; @@ -58,11 +59,10 @@ public class SignKit extends EssentialsSign final Trade charge = getTrade(sign, 3, ess); charge.isAffordableFor(player); try - { - final Kit kit = ess.getKits().getKit(kitName); - Kit.checkTime(player, kitName, kit); - final List<String> items = Kit.getItems(player, kit); - Kit.expandItems(ess, player, items); + {; + final Kit kit = ess.getKits().getKit(kitName); + ess.getKits().checkTime(player, kit); + ess.getKits().sendKit(player,kit); charge.charge(player); } catch (Exception ex) diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignPlayerListener.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignPlayerListener.java index 1a401ce64..9d597820f 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignPlayerListener.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignPlayerListener.java @@ -25,7 +25,7 @@ public class SignPlayerListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerInteract(final PlayerInteractEvent event) { - if (ess.getSettings().areSignsDisabled() || event.getAction() != Action.RIGHT_CLICK_BLOCK) + if (plugin.getSettings().areSignsDisabled() || event.getAction() != Action.RIGHT_CLICK_BLOCK) { return; } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignsConfigHolder.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignsConfigHolder.java index dcf436b03..d5ece9f69 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignsConfigHolder.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignsConfigHolder.java @@ -12,6 +12,7 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig> { private final Plugin plugin; private Set<EssentialsSign> enabledSigns = new HashSet<EssentialsSign>(); + private boolean signsEnabled = false; public SignsConfigHolder(final IEssentials ess, final Plugin plugin) { @@ -24,6 +25,11 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig> Map<String, Boolean> signs = getData().getSigns(); for (Map.Entry<String, Boolean> entry : signs.entrySet()) { + if(entry.getKey().trim().toUpperCase(Locale.ENGLISH).equals("COLOR") || entry.getKey().trim().toUpperCase(Locale.ENGLISH).equals("COLOUR")) + { + signsEnabled = true; + continue; + } Signs sign = Signs.valueOf(entry.getKey().toUpperCase(Locale.ENGLISH)); if (sign != null && entry.getValue()) { @@ -61,4 +67,21 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig> { return enabledSigns; } + + public boolean areSignsDisabled() + { + return !signsEnabled; + } + + @Override + public void finishRead() + { + + } + + @Override + public void finishWrite() + { + + } } |