Minor fixes

This commit is contained in:
Acrobot 2012-06-25 17:16:57 +02:00
parent 9ef6305a0a
commit 5fd4034c45
3 changed files with 31 additions and 15 deletions

View File

@ -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<Transaction> queue = Collections.synchronizedList(new ArrayList<Transaction>());
private static final ConcurrentLinkedQueue<Transaction> queue = new ConcurrentLinkedQueue<Transaction>();
public static void addToQueue(Transaction t) {
queue.add(t);

View File

@ -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);
}
}
}

View File

@ -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/