Skip to content

Commit

Permalink
Start working back toward performance gains
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerS1066 committed Jun 4, 2024
1 parent ccddfa5 commit 328f6d8
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,18 @@ public void onBlockDispense(@NotNull BlockDispenseEvent e) {
e.setCancelled(true);
}

@EventHandler
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFlow(BlockFromToEvent e) {
if (Settings.DisableSpillProtection)
return;
if (!e.getBlock().isLiquid())
if (Settings.DisableSpillProtection || !Tags.FLUID.contains(e.getBlock().getType()))
return;

MovecraftLocation loc = MathUtils.bukkit2MovecraftLoc(e.getBlock().getLocation());
MovecraftLocation toLoc = MathUtils.bukkit2MovecraftLoc(e.getToBlock().getLocation());
for (Craft craft : CraftManager.getInstance().getCraftsInWorld(e.getBlock().getWorld())) {
if (craft.getHitBox().contains((loc)) && !craft.getFluidLocations().contains(toLoc)) {
e.setCancelled(true);
break;
}
for (Craft craft : CraftManager.getInstance().getCrafts()) {
if (craft.getWorld() != e.getBlock().getWorld() || !craft.getHitBox().contains(loc) || craft.getFluidLocations().contains(toLoc))
continue;

e.setCancelled(true);
}
}

Expand Down

0 comments on commit 328f6d8

Please sign in to comment.