|
24 | 24 | import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; |
25 | 25 | import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItem; |
26 | 26 | import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItemUtils; |
27 | | -import me.eccentric_nz.TARDIS.customblocks.TARDISMushroomBlockData; |
28 | 27 | import me.eccentric_nz.TARDIS.database.resultset.ResultSetFarming; |
29 | 28 | import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisTimeLordName; |
30 | 29 | import me.eccentric_nz.TARDIS.enumeration.Room; |
@@ -88,6 +87,7 @@ public class TARDISRoomRunnable implements Runnable { |
88 | 87 | private final HashMap<Block, BlockData> redstoneTorchblocks = new HashMap<>(); |
89 | 88 | private final HashMap<Block, BlockData> seagrass = new HashMap<>(); |
90 | 89 | private final HashMap<Block, BlockData> torchblocks = new HashMap<>(); |
| 90 | + private final HashMap<Block, BlockData> trapdoorblocks = new HashMap<>(); |
91 | 91 | private final HashMap<Block, BlockFace> mushroomblocks = new HashMap<>(); |
92 | 92 | private final HashMap<Block, TARDISBannerData> bannerblocks = new HashMap<>(); |
93 | 93 | private final BlockFace[] repeaterData = new BlockFace[6]; |
@@ -134,6 +134,7 @@ public TARDISRoomRunnable(TARDIS plugin, TARDISRoomData roomData, UUID uuid, boo |
134 | 134 | notThese.add(Material.CARROTS); |
135 | 135 | notThese.add(Material.COCOA); |
136 | 136 | notThese.add(Material.DARK_OAK_DOOR); |
| 137 | + notThese.add(Material.IRON_TRAPDOOR); |
137 | 138 | notThese.add(Material.JUNGLE_DOOR); |
138 | 139 | notThese.add(Material.LEVER); |
139 | 140 | notThese.add(Material.MANGROVE_PROPAGULE); |
@@ -208,6 +209,7 @@ public void run() { |
208 | 209 | case SPRUCE_SIGN -> signblocks.add(postBlock); |
209 | 210 | case OAK_DOOR -> doorblocks.put(postBlock, postData); |
210 | 211 | case LEVER -> leverblocks.put(postBlock, postData); |
| 212 | + case IRON_TRAPDOOR -> trapdoorblocks.put(postBlock, postData); |
211 | 213 | default -> { |
212 | 214 | } |
213 | 215 | } |
@@ -258,6 +260,11 @@ public void run() { |
258 | 260 | prop.getKey().setBlockData(prop.getValue()); |
259 | 261 | } |
260 | 262 | } |
| 263 | + if (trapdoorblocks.size() > 0) { |
| 264 | + for (Map.Entry<Block, BlockData> trap : trapdoorblocks.entrySet()) { |
| 265 | + trap.getKey().setBlockData(trap.getValue()); |
| 266 | + } |
| 267 | + } |
261 | 268 | if (seagrass.size() > 0) { |
262 | 269 | for (Map.Entry<Block, BlockData> grass : seagrass.entrySet()) { |
263 | 270 | grass.getKey().setBlockData(grass.getValue()); |
@@ -624,19 +631,21 @@ public void run() { |
624 | 631 | sets.put(room.toLowerCase(Locale.ENGLISH), world.getName() + ":" + startx + ":" + starty + ":" + startz); |
625 | 632 | HashMap<String, Object> wheres = new HashMap<>(); |
626 | 633 | wheres.put("tardis_id", tardis_id); |
627 | | - if (room.equals("RENDERER") || room.equals("ZERO")) { |
628 | | - plugin.getQueryFactory().doUpdate("tardis", sets, wheres); |
629 | | - } else if (room.equals("MAZE")) { |
630 | | - String loc_str = TARDISStaticLocationGetters.makeLocationStr(world, startx, starty + 1, startz); |
631 | | - plugin.getQueryFactory().insertControl(tardis_id, 44, loc_str, 0); |
632 | | - } else { |
633 | | - ResultSetFarming rsf = new ResultSetFarming(plugin, tardis_id); |
634 | | - if (rsf.resultSet()) { |
635 | | - // update |
636 | | - plugin.getQueryFactory().doUpdate("farming", sets, wheres); |
637 | | - } else { |
638 | | - sets.put("tardis_id", tardis_id); |
639 | | - plugin.getQueryFactory().doInsert("farming", sets); |
| 634 | + switch (room) { |
| 635 | + case "RENDERER", "ZERO" -> plugin.getQueryFactory().doUpdate("tardis", sets, wheres); |
| 636 | + case "MAZE" -> { |
| 637 | + String loc_str = TARDISStaticLocationGetters.makeLocationStr(world, startx, starty + 1, startz); |
| 638 | + plugin.getQueryFactory().insertControl(tardis_id, 44, loc_str, 0); |
| 639 | + } |
| 640 | + default -> { |
| 641 | + ResultSetFarming rsf = new ResultSetFarming(plugin, tardis_id); |
| 642 | + if (rsf.resultSet()) { |
| 643 | + // update |
| 644 | + plugin.getQueryFactory().doUpdate("farming", sets, wheres); |
| 645 | + } else { |
| 646 | + sets.put("tardis_id", tardis_id); |
| 647 | + plugin.getQueryFactory().doInsert("farming", sets); |
| 648 | + } |
640 | 649 | } |
641 | 650 | } |
642 | 651 | // replace with correct block |
@@ -726,6 +735,12 @@ public void run() { |
726 | 735 | Block lever = world.getBlockAt(startx, starty, startz); |
727 | 736 | leverblocks.put(lever, data); |
728 | 737 | } |
| 738 | + // remember iron trap doors if SURGERY room |
| 739 | + if (type.equals(Material.IRON_TRAPDOOR) && room.equals("SURGERY")) { |
| 740 | + Block trap = world.getBlockAt(startx, starty, startz); |
| 741 | + trapdoorblocks.put(trap, data); |
| 742 | + rd.getPostBlocks().add(world.getName() + ":" + startx + ":" + starty + ":" + startz + "~" + data.getAsString()); |
| 743 | + } |
729 | 744 | // remember redstone torches |
730 | 745 | if (type.equals(Material.REDSTONE_TORCH)) { |
731 | 746 | Block torch = world.getBlockAt(startx, starty, startz); |
@@ -817,8 +832,13 @@ public void run() { |
817 | 832 | if (checkRoomNextDoor(world.getBlockAt(startx, starty, startz))) { |
818 | 833 | data = TARDISConstants.AIR; |
819 | 834 | } else { |
820 | | - BlockData wall = (ow.equals(Material.ORANGE_WOOL)) ? plugin.getServer().createBlockData(TARDISMushroomBlockData.MUSHROOM_STEM_DATA.get(46)) : ow.createBlockData(); |
821 | | - data = (wall_type.equals(Material.ORANGE_WOOL)) ? wall : wall_type.createBlockData(); |
| 835 | + if (ow.equals(Material.ORANGE_WOOL) && wall_type.equals(Material.ORANGE_WOOL)) { |
| 836 | + data = TARDISConstants.BARRIER; |
| 837 | + // set hexagon item display |
| 838 | + TARDISDisplayItemUtils.set(TARDISDisplayItem.HEXAGON, world, startx, starty, startz); |
| 839 | + } else { |
| 840 | + data = (wall_type.equals(Material.ORANGE_WOOL)) ? ow.createBlockData() : wall_type.createBlockData(); |
| 841 | + } |
822 | 842 | } |
823 | 843 | } |
824 | 844 | // always clear the door blocks on the north and west sides of adjacent spaces |
|
0 commit comments