Cover item dispense behaviors.

Depends on spigot throwing events.
This commit is contained in:
wizjany 2021-06-12 23:01:32 -04:00
parent 34ed6175e5
commit dd90fa21c7
1 changed files with 8 additions and 3 deletions

View File

@ -1050,9 +1050,14 @@ public class EventAbstractionListener extends AbstractListener {
handleBlockRightClick(event, cause, item, clicked, placed);
// handle special dispenser behavior
if (item != null && Materials.isShulkerBox(item.getType())) {
Events.fireToCancel(event, new PlaceBlockEvent(event, cause, placed.getLocation(), item.getType()));
return;
if (Materials.isShulkerBox(item.getType())) {
if (Events.fireToCancel(event, new PlaceBlockEvent(event, cause, placed.getLocation(), item.getType()))) {
playDenyEffect(placed.getLocation());
}
} else if (isItemAppliedToBlock(item, placed)) {
if (Events.fireToCancel(event, new PlaceBlockEvent(event, cause, placed.getLocation(), placed.getType()))) {
playDenyEffect(placed.getLocation());
}
}
}
}