mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Fixes #2754
This commit is contained in:
parent
83c2c6a915
commit
389a2978c0
@ -47,6 +47,7 @@
|
|||||||
* Fixed some backpack opening issues
|
* Fixed some backpack opening issues
|
||||||
* Fixed Infused Hopper picking up items with a max pickup delay
|
* Fixed Infused Hopper picking up items with a max pickup delay
|
||||||
* Fixed duplication issues related to holograms/armorstands
|
* Fixed duplication issues related to holograms/armorstands
|
||||||
|
* Fixed #2754
|
||||||
|
|
||||||
## Release Candidate 19 (11 Jan 2021)
|
## Release Candidate 19 (11 Jan 2021)
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -23,7 +23,7 @@
|
|||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
|
||||||
<!-- Spigot properties -->
|
<!-- Spigot properties -->
|
||||||
<spigot.version>1.16.4</spigot.version>
|
<spigot.version>1.16.5</spigot.version>
|
||||||
<spigot.javadocs>https://hub.spigotmc.org/javadocs/spigot/</spigot.javadocs>
|
<spigot.javadocs>https://hub.spigotmc.org/javadocs/spigot/</spigot.javadocs>
|
||||||
|
|
||||||
<!-- Default settings for sonarcloud.io -->
|
<!-- Default settings for sonarcloud.io -->
|
||||||
|
@ -2,15 +2,14 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
import io.github.thebusybiscuit.slimefun4.implementation.items.cargo.CargoNode;
|
||||||
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
|
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,25 +27,15 @@ public class CargoNodeListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onCargoNodePlace(BlockPlaceEvent e) {
|
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);
|
SlimefunPlugin.getLocalization().sendMessage(e.getPlayer(), "machines.CARGO_NODES.must-be-placed", true);
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCargoNode(@Nonnull ItemStack item) {
|
private boolean isCargoNode(@Nonnull ItemStack item) {
|
||||||
if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) {
|
return SlimefunItem.getByItem(item) instanceof CargoNode;
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user