Skip to content

Commit

Permalink
Even closer
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerS1066 committed Jun 4, 2024
1 parent 5d5bd9b commit fac185e
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ public void onBlockDispense(@NotNull BlockDispenseEvent e) {
e.setCancelled(true);
}

@EventHandler(priority = EventPriority.HIGHEST)
public void onFlow(BlockFromToEvent e) {
@EventHandler
public void onFlow(@NotNull BlockFromToEvent e) {
if (Settings.DisableSpillProtection || e.isCancelled())
return;
Block block = e.getBlock();
Expand All @@ -196,12 +196,11 @@ public void onFlow(BlockFromToEvent e) {

MovecraftLocation loc = MathUtils.bukkit2MovecraftLoc(block.getLocation());
MovecraftLocation toLoc = MathUtils.bukkit2MovecraftLoc(e.getToBlock().getLocation());
for (Craft craft : CraftManager.getInstance().getCrafts()) {
if (craft.getWorld() != e.getBlock().getWorld() || !craft.getHitBox().contains(loc) || craft.getFluidLocations().contains(toLoc))
continue;
Craft craft = MathUtils.fastNearestCraftToLoc(CraftManager.getInstance().getCrafts(), e.getBlock().getLocation());
if (craft == null || !craft.getHitBox().contains((loc)) || craft.getFluidLocations().contains(toLoc))
return;

e.setCancelled(true);
}
e.setCancelled(true);
}

@EventHandler
Expand Down

0 comments on commit fac185e

Please sign in to comment.