Skip to content
Permalink
Browse files

Ignore hopper minecarts with the ignore hopper setting.

  • Loading branch information...
wizjany committed Sep 13, 2019
1 parent 056eaa6 commit effbd62e684ec3edca979289b16d4f2ddad60d26
@@ -76,6 +76,7 @@
import org.bukkit.entity.Painting;
import org.bukkit.entity.Player;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.entity.minecart.HopperMinecart;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Result;
@@ -853,18 +854,20 @@ public void onInventoryOpen(InventoryOpenEvent event) {
@EventHandler(ignoreCancelled = true)
public void onInventoryMoveItem(InventoryMoveItemEvent event) {
final InventoryHolder causeHolder = event.getInitiator().getHolder();
InventoryHolder sourceHolder = event.getSource().getHolder();
InventoryHolder targetHolder = event.getDestination().getHolder();

if ((causeHolder instanceof Hopper || causeHolder instanceof Dropper)
&& ((BukkitWorldConfiguration) WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(
BukkitAdapter.adapt(((Container) causeHolder).getWorld()))).ignoreHopperMoveEvents) {
if (causeHolder instanceof Hopper
&& getWorldConfig(BukkitAdapter.adapt((((Hopper) causeHolder).getWorld()))).ignoreHopperMoveEvents) {
return;
} else if (causeHolder instanceof HopperMinecart
&& getWorldConfig(BukkitAdapter.adapt((((HopperMinecart) causeHolder).getWorld()))).ignoreHopperMoveEvents) {
return;
}

Entry entry;

if ((entry = moveItemDebounce.tryDebounce(event)) != null) {
InventoryHolder sourceHolder = event.getSource().getHolder();
InventoryHolder targetHolder = event.getDestination().getHolder();
Cause cause;

if (causeHolder instanceof Entity) {

0 comments on commit effbd62

Please sign in to comment.
You can’t perform that action at this time.