diff --git a/CHANGELOG.md b/CHANGELOG.md index 51a2d5b74..8dec7c590 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ * Fixed some backpack opening issues * Fixed Infused Hopper picking up items with a max pickup delay * Fixed duplication issues related to holograms/armorstands +* Fixed #2754 ## Release Candidate 19 (11 Jan 2021) diff --git a/pom.xml b/pom.xml index 821dba405..753cf0864 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 1.8 - 1.16.4 + 1.16.5 https://hub.spigotmc.org/javadocs/spigot/ diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CargoNodeListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CargoNodeListener.java index d28b8475a..976fb9502 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CargoNodeListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/CargoNodeListener.java @@ -2,15 +2,14 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners; import javax.annotation.Nonnull; +import org.bukkit.block.Block; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.inventory.ItemStack; -import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; -import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; -import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper; +import io.github.thebusybiscuit.slimefun4.implementation.items.cargo.CargoNode; import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; /** @@ -28,25 +27,15 @@ public class CargoNodeListener implements Listener { @EventHandler(ignoreCancelled = true) public void onCargoNodePlace(BlockPlaceEvent e) { - if (e.getBlock().getY() != e.getBlockAgainst().getY() && isCargoNode(e.getItemInHand())) { + Block b = e.getBlock(); + + if ((b.getY() != e.getBlockAgainst().getY() || !b.isEmpty()) && isCargoNode(e.getItemInHand())) { SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "machines.CARGO_NODES.must-be-placed", true); e.setCancelled(true); } } private boolean isCargoNode(@Nonnull ItemStack item) { - if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) { - ItemStackWrapper wrapper = new ItemStackWrapper(item); - - return SlimefunUtils.isItemSimilar(wrapper, SlimefunItems.CARGO_INPUT_NODE, false) || SlimefunUtils.isItemSimilar(wrapper, SlimefunItems.CARGO_OUTPUT_NODE, false) || SlimefunUtils.isItemSimilar(wrapper, SlimefunItems.CARGO_OUTPUT_NODE_2, false); - } - - SlimefunItem sfItem = SlimefunItem.getByItem(item); - - if (sfItem == null) { - return false; - } - - return sfItem.getId().equals(SlimefunItems.CARGO_INPUT_NODE.getItemId()) || sfItem.getId().equals(SlimefunItems.CARGO_OUTPUT_NODE.getItemId()) || sfItem.getId().equals(SlimefunItems.CARGO_OUTPUT_NODE_2.getItemId()); + return SlimefunItem.getByItem(item) instanceof CargoNode; } }