From 5fd4034c45007882968262831e20d81f84cd2355 Mon Sep 17 00:00:00 2001 From: Acrobot Date: Mon, 25 Jun 2012 17:16:57 +0200 Subject: [PATCH] Minor fixes --- com/Acrobot/ChestShop/DB/Queue.java | 5 +-- .../ChestShop/Listeners/Block/BlockPlace.java | 39 +++++++++++++------ plugin.yml | 2 +- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/com/Acrobot/ChestShop/DB/Queue.java b/com/Acrobot/ChestShop/DB/Queue.java index e00a9ab..9e753ea 100644 --- a/com/Acrobot/ChestShop/DB/Queue.java +++ b/com/Acrobot/ChestShop/DB/Queue.java @@ -5,15 +5,14 @@ import com.Acrobot.ChestShop.Config.Config; import com.Acrobot.ChestShop.Config.Property; import javax.persistence.OptimisticLockException; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; +import java.util.concurrent.ConcurrentLinkedQueue; /** * @author Acrobot */ public class Queue implements Runnable { - private static final List queue = Collections.synchronizedList(new ArrayList()); + private static final ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue(); public static void addToQueue(Transaction t) { queue.add(t); diff --git a/com/Acrobot/ChestShop/Listeners/Block/BlockPlace.java b/com/Acrobot/ChestShop/Listeners/Block/BlockPlace.java index ceaf592..1844a48 100644 --- a/com/Acrobot/ChestShop/Listeners/Block/BlockPlace.java +++ b/com/Acrobot/ChestShop/Listeners/Block/BlockPlace.java @@ -3,6 +3,7 @@ package com.Acrobot.ChestShop.Listeners.Block; import com.Acrobot.Breeze.Utils.BlockUtil; import com.Acrobot.ChestShop.Config.Config; import com.Acrobot.ChestShop.Config.Language; +import com.Acrobot.ChestShop.Permission; import com.Acrobot.ChestShop.Security; import com.Acrobot.ChestShop.Signs.ChestShopSign; import com.Acrobot.ChestShop.Utils.uBlock; @@ -10,6 +11,7 @@ import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.Chest; import org.bukkit.block.Sign; +import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; @@ -29,17 +31,32 @@ public class BlockPlace implements Listener { Block placed = event.getBlockPlaced(); - if (placed.getType() == Material.CHEST) { - Chest neighbor = uBlock.findNeighbor(placed); - if (neighbor == null) { - return; - } - - Block neighborBlock = neighbor.getBlock(); - if (!Security.canAccess(event.getPlayer(), neighborBlock)) { - event.getPlayer().sendMessage(Config.getLocal(Language.ACCESS_DENIED)); - event.setCancelled(true); - } + if (placed.getType() != Material.CHEST) { + return; } + + + Player player = event.getPlayer(); + + if (Permission.has(player, Permission.ADMIN)) { + return; + } + + if (!Security.canAccess(player, placed)) { + event.getPlayer().sendMessage(Config.getLocal(Language.ACCESS_DENIED)); + event.setCancelled(true); + } + + Chest neighbor = uBlock.findNeighbor(placed); + + if (neighbor == null) { + return; + } + + if (!Security.canAccess(event.getPlayer(), neighbor.getBlock())) { + event.getPlayer().sendMessage(Config.getLocal(Language.ACCESS_DENIED)); + event.setCancelled(true); + } + } } diff --git a/plugin.yml b/plugin.yml index 9070659..ec795e5 100644 --- a/plugin.yml +++ b/plugin.yml @@ -2,7 +2,7 @@ name: ChestShop main: com.Acrobot.ChestShop.ChestShop -version: 3.44 TEST BUILD +version: 3.45 TEST BUILD #for CButD dev-url: http://dev.bukkit.org/server-mods/chestshop/