mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-23 08:31:47 +01:00
Ignore hopper minecarts with the ignore hopper setting.
This commit is contained in:
parent
056eaa6587
commit
effbd62e68
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user