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