Cant open bridge chests until bridges are down.

This commit is contained in:
Chiss 2014-04-23 10:38:59 +10:00
parent 0325892e2a
commit 7ea601e94b

View File

@ -31,6 +31,7 @@ import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.Score; import org.bukkit.scoreboard.Score;
@ -40,6 +41,8 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
@ -298,6 +301,31 @@ public class Bridge extends TeamGame implements OreObsfucation
return ItemStackFactory.Instance.CreateStack(stack.getTypeId(), amount); return ItemStackFactory.Instance.CreateStack(stack.getTypeId(), amount);
} }
@EventHandler
public void ChestDeny(PlayerInteractEvent event)
{
if (_bridgesDown)
return;
if (event.getClickedBlock() == null)
return;
if (event.getClickedBlock().getType() != Material.CHEST)
return;
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
return;
for (Location loc : WorldData.GetCustomLocs("54"))
{
if (loc.getBlock().equals(event.getClickedBlock()))
{
event.setCancelled(true);
return;
}
}
}
private void ParseOre(ArrayList<Location> teamOre) private void ParseOre(ArrayList<Location> teamOre)
{ {
int coal = (int) ((teamOre.size() / 32d) * _oreDensity); int coal = (int) ((teamOre.size() / 32d) * _oreDensity);