use of net.countercraft.movecraft.craft.Craft in project Movecraft by APDevTeam.
the class BlockListener method onHopperEvent.
// prevent hoppers on cruising crafts
@EventHandler(priority = EventPriority.HIGHEST)
public void onHopperEvent(InventoryMoveItemEvent event) {
if (!(event.getSource().getHolder() instanceof Hopper)) {
return;
}
Hopper block = (Hopper) event.getSource().getHolder();
CraftManager.getInstance().getCraftsInWorld(block.getWorld());
for (Craft tcraft : CraftManager.getInstance().getCraftsInWorld(block.getWorld())) {
MovecraftLocation mloc = new MovecraftLocation(block.getX(), block.getY(), block.getZ());
if (MathUtils.locIsNearCraftFast(tcraft, mloc) && tcraft.getCruising() && !tcraft.isNotProcessing()) {
event.setCancelled(true);
return;
}
}
}
use of net.countercraft.movecraft.craft.Craft in project Movecraft by APDevTeam.
the class BlockListener method onPistonEvent.
// prevent pistons on cruising crafts
@EventHandler(priority = EventPriority.HIGHEST)
public void onPistonEvent(BlockPistonExtendEvent event) {
Block block = event.getBlock();
CraftManager.getInstance().getCraftsInWorld(block.getWorld());
for (Craft tcraft : CraftManager.getInstance().getCraftsInWorld(block.getWorld())) {
MovecraftLocation mloc = new MovecraftLocation(block.getX(), block.getY(), block.getZ());
if (MathUtils.locIsNearCraftFast(tcraft, mloc) && tcraft.getCruising() && !tcraft.isNotProcessing()) {
event.setCancelled(true);
return;
}
}
}
Aggregations