Added support for shulkers and barrels as shop containers
This commit is contained in:
parent
331c912402
commit
79e2ca0b72
|
@ -8,18 +8,33 @@ import world.bentobox.bentobox.api.flags.Flag;
|
|||
import world.bentobox.bentobox.managers.RanksManager;
|
||||
|
||||
public class BentoBoxShopFlag {
|
||||
public static final Flag SHOP_FLAG = new Flag.Builder("CREATE_SHOPS", Material.CHEST)
|
||||
public static final Flag SHOP_CHEST_FLAG = new Flag.Builder("CREATE_SHOPS", Material.CHEST)
|
||||
.type(Flag.Type.PROTECTION)
|
||||
.mode(Flag.Mode.BASIC)
|
||||
.defaultRank(RanksManager.TRUSTED_RANK)
|
||||
.build();
|
||||
public static final Flag SHOP_TRAPPED_CHEST_FLAG = new Flag.Builder("CREATE_SHOPS", Material.TRAPPED_CHEST)
|
||||
.type(Flag.Type.PROTECTION)
|
||||
.mode(Flag.Mode.BASIC)
|
||||
.defaultRank(RanksManager.TRUSTED_RANK)
|
||||
.build();
|
||||
public static final Flag SHOP_SHULKER_BOX_FLAG = new Flag.Builder("CREATE_SHOPS", Material.SHULKER_BOX)
|
||||
.type(Flag.Type.PROTECTION)
|
||||
.mode(Flag.Mode.BASIC)
|
||||
.defaultRank(RanksManager.TRUSTED_RANK)
|
||||
.build();
|
||||
public static final Flag SHOP_BARREL_FLAG = new Flag.Builder("CREATE_SHOPS", Material.BARREL)
|
||||
.type(Flag.Type.PROTECTION)
|
||||
.mode(Flag.Mode.BASIC)
|
||||
.defaultRank(RanksManager.TRUSTED_RANK)
|
||||
.build();
|
||||
|
||||
public static void register(ShopChest plugin) {
|
||||
if (BentoBox.getInstance().getFlagsManager().registerFlag(SHOP_FLAG)) {
|
||||
plugin.debug("Registered BentoBox shop flag");
|
||||
if (BentoBox.getInstance().getFlagsManager().registerFlag(SHOP_CHEST_FLAG) && BentoBox.getInstance().getFlagsManager().registerFlag(SHOP_TRAPPED_CHEST_FLAG) && BentoBox.getInstance().getFlagsManager().registerFlag(SHOP_SHULKER_BOX_FLAG) && BentoBox.getInstance().getFlagsManager().registerFlag(SHOP_BARREL_FLAG)) {
|
||||
plugin.debug("Registered BentoBox shop flags");
|
||||
} else {
|
||||
plugin.getLogger().warning("Failed to register BentoBox shop flag");
|
||||
plugin.debug("Failed to register BentoBox shop flag");
|
||||
plugin.getLogger().warning("Failed to register BentoBox shop flags");
|
||||
plugin.debug("Failed to register BentoBox shop flags");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@ public class BlockExplodeListener implements Listener {
|
|||
public void onBlockExplode(BlockExplodeEvent e) {
|
||||
ArrayList<Block> bl = new ArrayList<>(e.blockList());
|
||||
for (Block b : bl) {
|
||||
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
||||
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST) || b.getType().equals(Material.SHULKER_BOX) || b.getType().equals(Material.BARREL)) {
|
||||
if (plugin.getShopUtils().isShop(b.getLocation())) e.blockList().remove(b);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,7 @@ import java.util.ArrayList;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.block.data.type.Chest.Type;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -123,7 +120,7 @@ public class ChestProtectListener implements Listener {
|
|||
public void onEntityExplode(EntityExplodeEvent e) {
|
||||
ArrayList<Block> bl = new ArrayList<>(e.blockList());
|
||||
for (Block b : bl) {
|
||||
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
||||
if (b.getType().equals(Material.CHEST) || b.getType().equals(Material.SHULKER_BOX) || b.getType().equals(Material.BARREL) || b.getType().equals(Material.TRAPPED_CHEST)) {
|
||||
if (shopUtils.isShop(b.getLocation())) e.blockList().remove(b);
|
||||
}
|
||||
}
|
||||
|
@ -134,11 +131,11 @@ public class ChestProtectListener implements Listener {
|
|||
final Player p = e.getPlayer();
|
||||
final Block b = e.getBlockPlaced();
|
||||
|
||||
if (!b.getType().equals(Material.CHEST) && !b.getType().equals(Material.TRAPPED_CHEST)) {
|
||||
if (!b.getType().equals(Material.CHEST) && !b.getType().equals(Material.SHULKER_BOX) && !b.getType().equals(Material.BARREL) && !b.getType().equals(Material.TRAPPED_CHEST)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Chest c = (Chest) b.getState();
|
||||
Container c = (Container) b.getState();
|
||||
Block b2;
|
||||
|
||||
// Can't use Utils::getChestLocations since inventory holder
|
||||
|
@ -160,9 +157,13 @@ public class ChestProtectListener implements Listener {
|
|||
b2 = l.getBlock();
|
||||
}
|
||||
} else {
|
||||
if (!(c instanceof Chest)) {
|
||||
return;
|
||||
}
|
||||
|
||||
org.bukkit.block.data.type.Chest data = (org.bukkit.block.data.type.Chest) c.getBlockData();
|
||||
|
||||
if (data.getType() == Type.SINGLE) {
|
||||
if (data.equals(Type.SINGLE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -228,7 +229,7 @@ public class ChestProtectListener implements Listener {
|
|||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onItemMove(InventoryMoveItemEvent e) {
|
||||
if ((e.getSource().getType().equals(InventoryType.CHEST)) && (!e.getInitiator().getType().equals(InventoryType.PLAYER))) {
|
||||
if ((e.getSource().getType().equals(InventoryType.CHEST) || e.getSource().getType().equals(InventoryType.SHULKER_BOX) || e.getSource().getType().equals(InventoryType.BARREL)) && (!e.getInitiator().getType().equals(InventoryType.PLAYER))) {
|
||||
|
||||
if (e.getSource().getHolder() instanceof DoubleChest) {
|
||||
DoubleChest dc = (DoubleChest) e.getSource().getHolder();
|
||||
|
@ -237,8 +238,8 @@ public class ChestProtectListener implements Listener {
|
|||
|
||||
if (shopUtils.isShop(r.getLocation()) || shopUtils.isShop(l.getLocation())) e.setCancelled(true);
|
||||
|
||||
} else if (e.getSource().getHolder() instanceof Chest) {
|
||||
Chest c = (Chest) e.getSource().getHolder();
|
||||
} else if (e.getSource().getHolder() instanceof Chest || e.getSource().getHolder() instanceof ShulkerBox || e.getSource().getHolder() instanceof Barrel) {
|
||||
Container c = (Container) e.getSource().getHolder();
|
||||
|
||||
if (shopUtils.isShop(c.getLocation())) e.setCancelled(true);
|
||||
}
|
||||
|
|
|
@ -17,10 +17,7 @@ import org.bukkit.Bukkit;
|
|||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
@ -87,13 +84,13 @@ public class ShopInteractListener implements Listener {
|
|||
|
||||
Inventory chestInv = e.getInventory();
|
||||
|
||||
if (!(chestInv.getHolder() instanceof Chest || chestInv.getHolder() instanceof DoubleChest)) {
|
||||
if (!(chestInv.getHolder() instanceof Chest || chestInv.getHolder() instanceof ShulkerBox || chestInv.getHolder() instanceof Barrel || chestInv.getHolder() instanceof DoubleChest)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc = null;
|
||||
if (chestInv.getHolder() instanceof Chest) {
|
||||
loc = ((Chest) chestInv.getHolder()).getLocation();
|
||||
if (chestInv.getHolder() instanceof Chest || chestInv.getHolder() instanceof ShulkerBox || chestInv.getHolder() instanceof Barrel) {
|
||||
loc = ((BlockState) chestInv.getHolder()).getLocation();
|
||||
} else if (chestInv.getHolder() instanceof DoubleChest) {
|
||||
loc = ((DoubleChest) chestInv.getHolder()).getLocation();
|
||||
}
|
||||
|
@ -120,7 +117,7 @@ public class ShopInteractListener implements Listener {
|
|||
if (!(ClickType.getPlayerClickType(p) instanceof CreateClickType))
|
||||
return;
|
||||
|
||||
if (b.getType() != Material.CHEST && b.getType() != Material.TRAPPED_CHEST)
|
||||
if (b.getType() != Material.CHEST && b.getType() != Material.SHULKER_BOX && b.getType() != Material.BARREL && b.getType() != Material.TRAPPED_CHEST)
|
||||
return;
|
||||
|
||||
if (ClickType.getPlayerClickType(p).getClickType() != ClickType.EnumClickType.CREATE)
|
||||
|
@ -164,8 +161,8 @@ public class ShopInteractListener implements Listener {
|
|||
|
||||
if (e.getAction() != Action.RIGHT_CLICK_BLOCK && e.getAction() != Action.LEFT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (b.getType() != Material.CHEST && b.getType() != Material.TRAPPED_CHEST)
|
||||
|
||||
if (b.getType() != Material.CHEST && b.getType() != Material.SHULKER_BOX && b.getType() != Material.BARREL && b.getType() != Material.TRAPPED_CHEST)
|
||||
return;
|
||||
|
||||
ClickType clickType = ClickType.getPlayerClickType(p);
|
||||
|
@ -302,7 +299,7 @@ public class ShopInteractListener implements Listener {
|
|||
}
|
||||
} else {
|
||||
if (externalPluginsAllowed || p.hasPermission(Permissions.BYPASS_EXTERNAL_PLUGIN)) {
|
||||
Chest c = (Chest) b.getState();
|
||||
Container c = (Container) b.getState();
|
||||
ItemStack itemStack = shop.getProduct().getItemStack();
|
||||
int amount = (p.isSneaking() ? itemStack.getMaxStackSize() : shop.getProduct().getAmount());
|
||||
|
||||
|
@ -606,7 +603,7 @@ public class ShopInteractListener implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
Chest c = (Chest) shop.getLocation().getBlock().getState();
|
||||
Container c = (Container) shop.getLocation().getBlock().getState();
|
||||
ItemStack itemStack = shop.getProduct().getItemStack();
|
||||
int amount = Utils.getAmount(c.getInventory(), itemStack);
|
||||
int space = Utils.getFreeSpaceForItem(c.getInventory(), itemStack);
|
||||
|
@ -753,7 +750,7 @@ public class ShopInteractListener implements Listener {
|
|||
plugin.debug(executor.getName() + " has enough money for " + amountForMoney + " item(s) (#" + shop.getID() + ")");
|
||||
|
||||
Block b = shop.getLocation().getBlock();
|
||||
Chest c = (Chest) b.getState();
|
||||
Container c = (Container) b.getState();
|
||||
|
||||
int amountForChestItems = Utils.getAmount(c.getInventory(), itemStack);
|
||||
|
||||
|
@ -921,7 +918,7 @@ public class ShopInteractListener implements Listener {
|
|||
}
|
||||
|
||||
Block block = shop.getLocation().getBlock();
|
||||
Chest chest = (Chest) block.getState();
|
||||
Container chest = (Container) block.getState();
|
||||
|
||||
int amountForItemCount = Utils.getAmount(executor.getInventory(), itemStack);
|
||||
|
||||
|
@ -1064,7 +1061,7 @@ public class ShopInteractListener implements Listener {
|
|||
/**
|
||||
* Adds items to an inventory
|
||||
* @param inventory The inventory, to which the items will be added
|
||||
* @param itemStack Items to add
|
||||
* @param product Products to add
|
||||
* @return Whether all items were added to the inventory
|
||||
*/
|
||||
private boolean addToInventory(Inventory inventory, ShopProduct product) {
|
||||
|
@ -1123,7 +1120,7 @@ public class ShopInteractListener implements Listener {
|
|||
/**
|
||||
* Removes items to from an inventory
|
||||
* @param inventory The inventory, from which the items will be removed
|
||||
* @param itemStack Items to remove
|
||||
* @param product Products to remove
|
||||
* @return Whether all items were removed from the inventory
|
||||
*/
|
||||
private boolean removeFromInventory(Inventory inventory, ShopProduct product) {
|
||||
|
|
|
@ -5,9 +5,9 @@ import java.util.Set;
|
|||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Shulker;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
@ -37,12 +37,12 @@ public class ShopUpdateListener implements Listener {
|
|||
|
||||
Location loc = null;
|
||||
|
||||
if (e.getSource().getHolder() instanceof Chest) {
|
||||
loc = ((Chest) e.getSource().getHolder()).getLocation();
|
||||
if (e.getSource().getHolder() instanceof Chest || e.getSource().getHolder() instanceof ShulkerBox || e.getSource().getHolder() instanceof Barrel) {
|
||||
loc = ((BlockState) e.getSource().getHolder()).getLocation();
|
||||
} else if (e.getSource().getHolder() instanceof DoubleChest) {
|
||||
loc = ((DoubleChest) e.getSource().getHolder()).getLocation();
|
||||
} else if (e.getDestination().getHolder() instanceof Chest) {
|
||||
loc = ((Chest) e.getDestination().getHolder()).getLocation();
|
||||
} else if (e.getDestination().getHolder() instanceof Chest || e.getDestination().getHolder() instanceof ShulkerBox || e.getDestination().getHolder() instanceof Barrel) {
|
||||
loc = ((BlockState) e.getDestination().getHolder()).getLocation();
|
||||
} else if (e.getDestination().getHolder() instanceof DoubleChest) {
|
||||
loc = ((DoubleChest) e.getDestination().getHolder()).getLocation();
|
||||
}
|
||||
|
|
|
@ -4,8 +4,7 @@ import java.util.Optional;
|
|||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event.Result;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -13,6 +12,7 @@ import org.bukkit.event.EventPriority;
|
|||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.BlockInventoryHolder;
|
||||
import org.codemc.worldguardwrapper.WorldGuardWrapper;
|
||||
import org.codemc.worldguardwrapper.event.WrappedUseBlockEvent;
|
||||
import org.codemc.worldguardwrapper.flag.IWrappedFlag;
|
||||
|
@ -69,7 +69,7 @@ public class WorldGuardListener implements Listener {
|
|||
Block block = event.getBlocks().get(0);
|
||||
Material type = block.getType();
|
||||
|
||||
if (type == Material.CHEST || type == Material.TRAPPED_CHEST) {
|
||||
if (type == Material.CHEST || type == Material.TRAPPED_CHEST || type == Material.SHULKER_BOX || type == Material.BARREL) {
|
||||
if (isAllowed(player, block.getLocation())) {
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
|
@ -77,8 +77,8 @@ public class WorldGuardListener implements Listener {
|
|||
} else if (event.getOriginalEvent() instanceof InventoryOpenEvent) {
|
||||
InventoryOpenEvent orig = (InventoryOpenEvent) event.getOriginalEvent();
|
||||
|
||||
if (orig.getInventory().getHolder() instanceof Chest) {
|
||||
if (isAllowed(player, ((Chest) orig.getInventory().getHolder()).getLocation())) {
|
||||
if (orig.getInventory().getHolder() instanceof Chest || orig.getInventory().getHolder() instanceof ShulkerBox || orig.getInventory().getHolder() instanceof Barrel) {
|
||||
if (isAllowed(player, ((BlockState) orig.getInventory().getHolder()).getLocation())) {
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,10 @@ import org.bukkit.Location;
|
|||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.BlockInventoryHolder;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -40,10 +38,10 @@ public class Shop {
|
|||
|
||||
private static class PreCreateResult {
|
||||
private final Inventory inventory;
|
||||
private final Chest[] chests;
|
||||
private final BlockInventoryHolder[] chests;
|
||||
private final BlockFace face;
|
||||
|
||||
private PreCreateResult(Inventory inventory, Chest[] chests, BlockFace face) {
|
||||
private PreCreateResult(Inventory inventory, BlockInventoryHolder[] chests, BlockFace face) {
|
||||
this.inventory = inventory;
|
||||
this.chests = chests;
|
||||
this.face = face;
|
||||
|
@ -113,7 +111,7 @@ public class Shop {
|
|||
plugin.debug("Creating shop (#" + id + ")");
|
||||
|
||||
Block b = location.getBlock();
|
||||
if (b.getType() != Material.CHEST && b.getType() != Material.TRAPPED_CHEST) {
|
||||
if (b.getType() != Material.CHEST && b.getType() != Material.TRAPPED_CHEST && b.getType() != Material.BARREL && b.getType() != Material.SHULKER_BOX) {
|
||||
ChestNotFoundException ex = new ChestNotFoundException(String.format("No Chest found in world '%s' at location: %d; %d; %d",
|
||||
b.getWorld().getName(), b.getX(), b.getY(), b.getZ()));
|
||||
plugin.getShopUtils().removeShop(this, Config.removeShopOnError);
|
||||
|
@ -176,7 +174,7 @@ public class Shop {
|
|||
|
||||
/**
|
||||
* <p>Creates the floating item of the shop</p>
|
||||
* <b>Call this after {@link #createHologram()}, because it depends on the hologram's location</b>
|
||||
* <b>Call this after {@link #createHologram(PreCreateResult)}, because it depends on the hologram's location</b>
|
||||
*/
|
||||
private void createItem() {
|
||||
plugin.debug("Creating item (#" + id + ")");
|
||||
|
@ -198,7 +196,7 @@ public class Shop {
|
|||
|
||||
if (ih == null) return null;
|
||||
|
||||
Chest[] chests = new Chest[2];
|
||||
BlockInventoryHolder[] chests = new BlockInventoryHolder[2];
|
||||
BlockFace face;
|
||||
|
||||
if (ih instanceof DoubleChest) {
|
||||
|
@ -209,13 +207,23 @@ public class Shop {
|
|||
chests[0] = r;
|
||||
chests[1] = l;
|
||||
} else {
|
||||
chests[0] = (Chest) ih;
|
||||
chests[0] = (BlockInventoryHolder) ih;
|
||||
}
|
||||
|
||||
if (Utils.getMajorVersion() < 13) {
|
||||
face = ((org.bukkit.material.Directional) chests[0].getData()).getFacing();
|
||||
if (chests[0] instanceof Chest) {
|
||||
Chest chest = (Chest) chests[0];
|
||||
face = ((org.bukkit.material.Directional) chest.getData()).getFacing();
|
||||
} else {
|
||||
face = null;
|
||||
}
|
||||
} else {
|
||||
face = ((Directional) chests[0].getBlockData()).getFacing();
|
||||
if (chests[0] instanceof Chest) {
|
||||
Chest chest = (Chest) chests[0];
|
||||
face = ((Directional) chest.getBlockData()).getFacing();
|
||||
} else {
|
||||
face = null;
|
||||
}
|
||||
}
|
||||
|
||||
return new PreCreateResult(ih.getInventory(), chests, face);
|
||||
|
@ -325,7 +333,7 @@ public class Shop {
|
|||
return lines.toArray(new String[0]);
|
||||
}
|
||||
|
||||
private Location getHologramLocation(Chest[] chests, BlockFace face) {
|
||||
private Location getHologramLocation(BlockInventoryHolder[] chests, BlockFace face) {
|
||||
World w = location.getWorld();
|
||||
int x = location.getBlockX();
|
||||
int y = location.getBlockY();
|
||||
|
@ -338,21 +346,21 @@ public class Shop {
|
|||
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];
|
||||
BlockInventoryHolder c1 = Utils.getMajorVersion() >= 13 && (face == BlockFace.NORTH || face == BlockFace.EAST) ? chests[1] : chests[0];
|
||||
BlockInventoryHolder c2 = Utils.getMajorVersion() >= 13 && (face == BlockFace.NORTH || face == BlockFace.EAST) ? chests[0] : chests[1];
|
||||
|
||||
if (holoLocation.equals(c1.getLocation())) {
|
||||
if (c1.getX() != c2.getX()) {
|
||||
if (holoLocation.equals(c1.getBlock().getLocation())) {
|
||||
if (c1.getBlock().getX() != c2.getBlock().getX()) {
|
||||
holoLocation.add(0, deltaY, 0.5);
|
||||
} else if (c1.getZ() != c2.getZ()) {
|
||||
} else if (c1.getBlock().getZ() != c2.getBlock().getZ()) {
|
||||
holoLocation.add(0.5, deltaY, 0);
|
||||
} else {
|
||||
holoLocation.add(0.5, deltaY, 0.5);
|
||||
}
|
||||
} else {
|
||||
if (c1.getX() != c2.getX()) {
|
||||
if (c1.getBlock().getX() != c2.getBlock().getX()) {
|
||||
holoLocation.add(1, deltaY, 0.5);
|
||||
} else if (c1.getZ() != c2.getZ()) {
|
||||
} else if (c1.getBlock().getZ() != c2.getBlock().getZ()) {
|
||||
holoLocation.add(0.5, deltaY, 1);
|
||||
} else {
|
||||
holoLocation.add(0.5, deltaY, 0.5);
|
||||
|
@ -474,6 +482,16 @@ public class Shop {
|
|||
return chest.getInventory().getHolder();
|
||||
}
|
||||
|
||||
if (b.getType() == Material.BARREL) {
|
||||
Barrel barrel = (Barrel) b.getState();
|
||||
return barrel.getInventory().getHolder();
|
||||
}
|
||||
|
||||
if (b.getType() == Material.SHULKER_BOX) {
|
||||
ShulkerBox shulkerBox = (ShulkerBox) b.getState();
|
||||
return shulkerBox.getInventory().getHolder();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public class ShopUtils {
|
|||
shopLocation.put(r.getLocation(), shop);
|
||||
shopLocation.put(l.getLocation(), shop);
|
||||
} else {
|
||||
plugin.debug("Added shop as single chest. (#" + shop.getID() + ")");
|
||||
plugin.debug("Added shop as single container. (#" + shop.getID() + ")");
|
||||
|
||||
shopLocation.put(shop.getLocation(), shop);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue