Java Code Examples for org.bukkit.block.Chest#getX()
The following examples show how to use
org.bukkit.block.Chest#getX() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GameMap.java From SkyWarsReloaded with GNU General Public License v3.0 | 6 votes |
public void addChest(Chest chest, ChestPlacementType cpt) { ArrayList<CoordLoc> list; if (cpt == ChestPlacementType.NORMAL) { list = chests; } else { list = centerChests; } InventoryHolder ih = chest.getInventory().getHolder(); if (ih instanceof DoubleChest) { DoubleChest dc = (DoubleChest) ih; Chest left = (Chest) dc.getLeftSide(); Chest right = (Chest) dc.getRightSide(); CoordLoc locLeft = new CoordLoc(left.getX(), left.getY(), left.getZ()); CoordLoc locRight = new CoordLoc(right.getX(), right.getY(), right.getZ()); if (!(list.contains(locLeft) || list.contains(locRight))) { addChest(locLeft, cpt, true); } } else { CoordLoc loc = new CoordLoc(chest.getX(), chest.getY(), chest.getZ()); if (!list.contains(loc)){ addChest(loc, cpt, true); } } }
Example 2
Source File: GameMap.java From SkyWarsReloaded with GNU General Public License v3.0 | 6 votes |
public void removeChest(Chest chest) { InventoryHolder ih = chest.getInventory().getHolder(); if (ih instanceof DoubleChest) { DoubleChest dc = (DoubleChest) ih; Chest left = (Chest) dc.getLeftSide(); Chest right = (Chest) dc.getRightSide(); CoordLoc locLeft = new CoordLoc(left.getX(), left.getY(), left.getZ()); CoordLoc locRight = new CoordLoc(right.getX(), right.getY(), right.getZ()); chests.remove(locLeft); centerChests.remove(locLeft); chests.remove(locRight); centerChests.remove(locLeft); saveArenaData(); } else { CoordLoc loc = new CoordLoc(chest.getX(), chest.getY(), chest.getZ()); chests.remove(loc); centerChests.remove(loc); saveArenaData(); } }
Example 3
Source File: Shop.java From ShopChest with MIT License | 4 votes |
private Location getHologramLocation(Chest[] chests, BlockFace face) { World w = location.getWorld(); int x = location.getBlockX(); int y = location.getBlockY(); int z = location.getBlockZ(); Location holoLocation = new Location(w, x, y, z); double deltaY = -0.6; if (Config.hologramFixedBottom) deltaY = -0.85; if (chests[1] != null) { Chest c1 = Utils.getMajorVersion() >= 13 && (face == BlockFace.NORTH || face == BlockFace.EAST) ? chests[1] : chests[0]; Chest c2 = Utils.getMajorVersion() >= 13 && (face == BlockFace.NORTH || face == BlockFace.EAST) ? chests[0] : chests[1]; if (holoLocation.equals(c1.getLocation())) { if (c1.getX() != c2.getX()) { holoLocation.add(0, deltaY, 0.5); } else if (c1.getZ() != c2.getZ()) { holoLocation.add(0.5, deltaY, 0); } else { holoLocation.add(0.5, deltaY, 0.5); } } else { if (c1.getX() != c2.getX()) { holoLocation.add(1, deltaY, 0.5); } else if (c1.getZ() != c2.getZ()) { holoLocation.add(0.5, deltaY, 1); } else { holoLocation.add(0.5, deltaY, 0.5); } } } else { holoLocation.add(0.5, deltaY, 0.5); } holoLocation.add(0, Config.hologramLift, 0); return holoLocation; }