Support Trapped Chests!

This commit is contained in:
graywolf336 2013-12-11 17:26:07 -06:00
parent b706534b87
commit e21c2d87ad
2 changed files with 8 additions and 5 deletions

View File

@ -27,8 +27,6 @@ public class PlayerListener implements Listener {
Location loc = event.getClickedBlock() == null ? p.getLocation() : event.getClickedBlock().getLocation(); Location loc = event.getClickedBlock() == null ? p.getLocation() : event.getClickedBlock().getLocation();
JailManager jm = pl.getJailManager(); JailManager jm = pl.getJailManager();
p.sendMessage("The material of the clicked block is " + (event.getClickedBlock() == null ? "nothing." : event.getClickedBlock().getType().toString()));
if(p.getItemInHand().isSimilar(Util.getWand())) { if(p.getItemInHand().isSimilar(Util.getWand())) {
if(jm.isCreatingSomething(p.getName())) { if(jm.isCreatingSomething(p.getName())) {
if(jm.isCreatingAJail(p.getName())) { if(jm.isCreatingAJail(p.getName())) {

View File

@ -95,7 +95,7 @@ public class CellCreationSteps {
player.sendMessage(ChatColor.GREEN + "Sign added, if you want to select another go ahead otherwise right click on any non-sign block."); player.sendMessage(ChatColor.GREEN + "Sign added, if you want to select another go ahead otherwise right click on any non-sign block.");
}else { }else {
player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation ----------"); player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation ----------");
player.sendMessage(ChatColor.GREEN + "Sign selection completed. Now select a double chest associated with this cell. If there is no chest click on any non-chest block. (Please note that having no chest may result in players items being lost.)"); player.sendMessage(ChatColor.GREEN + (cp.getSigns().size() != 0 ? "Sign selection completed. " : "") + "Now select a double chest associated with this cell. If there is no chest click on any non-chest block. (Please note that having no chest may result in players items being lost.)");
player.sendMessage(ChatColor.AQUA + "----------------------------------------"); player.sendMessage(ChatColor.AQUA + "----------------------------------------");
cp.nextStep(); cp.nextStep();
} }
@ -108,8 +108,13 @@ public class CellCreationSteps {
Material bpos3 = block.getLocation().add(0, 0, -1).getBlock().getType(); Material bpos3 = block.getLocation().add(0, 0, -1).getBlock().getType();
Material bpos4 = block.getLocation().add(0, 0, +1).getBlock().getType(); Material bpos4 = block.getLocation().add(0, 0, +1).getBlock().getType();
if (block.getType() == Material.CHEST) { boolean pos1 = bpos1 == Material.CHEST || bpos1 == Material.TRAPPED_CHEST;
if(bpos1 == Material.CHEST || bpos2 == Material.CHEST || bpos3 == Material.CHEST || bpos4 == Material.CHEST) { boolean pos2 = bpos2 == Material.CHEST || bpos2 == Material.TRAPPED_CHEST;
boolean pos3 = bpos3 == Material.CHEST || bpos3 == Material.TRAPPED_CHEST;
boolean pos4 = bpos4 == Material.CHEST || bpos4 == Material.TRAPPED_CHEST;
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST) {
if(pos1 || pos2 || pos3 || pos4) {
cp.setChestLocation(block.getLocation()); cp.setChestLocation(block.getLocation());
player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation ----------"); player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation ----------");
player.sendMessage(ChatColor.GREEN + "Chest selected."); player.sendMessage(ChatColor.GREEN + "Chest selected.");