mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-27 02:21:25 +01:00
Work around odd class casting with odder class casting.
Despite the API guaranteeing a block for chests, they are not actually BlockStates. Fixes WORLDGUARD-3607. Probably.
This commit is contained in:
parent
ca4bb7a53d
commit
93d454c675
@ -44,7 +44,12 @@
|
||||
import com.sk89q.worldguard.bukkit.util.Materials;
|
||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.block.Hopper;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
@ -907,8 +912,8 @@ private static <T extends Event & Cancellable> void handleInventoryHolderUse(T o
|
||||
} else if (holder instanceof BlockState) {
|
||||
Events.fireToCancel(originalEvent, new UseBlockEvent(originalEvent, cause, ((BlockState) holder).getBlock()));
|
||||
} else if (holder instanceof DoubleChest) {
|
||||
Events.fireToCancel(originalEvent, new UseBlockEvent(originalEvent, cause, ((BlockState) ((DoubleChest) holder).getLeftSide()).getBlock()));
|
||||
Events.fireToCancel(originalEvent, new UseBlockEvent(originalEvent, cause, ((BlockState) ((DoubleChest) holder).getRightSide()).getBlock()));
|
||||
Events.fireToCancel(originalEvent, new UseBlockEvent(originalEvent, cause, (((Chest) ((DoubleChest) holder).getLeftSide()).getBlock())));
|
||||
Events.fireToCancel(originalEvent, new UseBlockEvent(originalEvent, cause, (((Chest) ((DoubleChest) holder).getRightSide()).getBlock())));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user