mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-28 10:12:15 +01:00
parent
3a181a230f
commit
4a21bf43e7
@ -1215,8 +1215,7 @@ private static <T extends Event & Cancellable> void handleInventoryHolderUse(T o
|
||||
return;
|
||||
}
|
||||
|
||||
if (holder instanceof Entity) {
|
||||
Entity entity = (Entity) holder;
|
||||
if (holder instanceof Entity entity) {
|
||||
Material mat = Materials.getRelatedMaterial((entity).getType());
|
||||
UseEntityEvent useEntityEvent = new UseEntityEvent(originalEvent, cause, entity);
|
||||
if (mat != null && hasInteractBypass((entity).getWorld(), mat)) {
|
||||
@ -1224,8 +1223,7 @@ private static <T extends Event & Cancellable> void handleInventoryHolderUse(T o
|
||||
}
|
||||
Events.fireToCancel(originalEvent, useEntityEvent);
|
||||
} else {
|
||||
if (holder instanceof BlockState) {
|
||||
final BlockState block = (BlockState) holder;
|
||||
if (holder instanceof BlockState block && block.isPlaced()) {
|
||||
final UseBlockEvent useBlockEvent = new UseBlockEvent(originalEvent, cause, block.getBlock());
|
||||
if (hasInteractBypass(block.getWorld(), block.getType())) {
|
||||
useBlockEvent.setAllowed(true);
|
||||
|
Loading…
Reference in New Issue
Block a user