Ejemplo n.º 1
0
 /** Cancels block physics events in arenas not currently running. */
 @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
 public void onBlockPhysics(BlockPhysicsEvent event) {
   Material material = event.getChangedType();
   if (material == Material.WATER || material == Material.LAVA || UGUtils.hasPhysics(material)) {
     Arena arena =
         ultimateGames.getArenaManager().getLocationArena(event.getBlock().getLocation());
     if (arena != null && arena.getStatus() != ArenaStatus.RUNNING) {
       event.setCancelled(true);
     }
   }
 }
 @Override
 public void onBlockPhysics(BlockPhysicsEvent event) {
   if (event.isCancelled()) {
     return;
   }
   PortalManager pm = this.plugin.getPortalManager();
   MVPortal portal = pm.isPortal(null, event.getBlock().getLocation());
   if (portal != null
       && (event.getChangedType() == Material.PORTAL
           || event.getBlock().getType() == Material.PORTAL)) {
     event.setCancelled(true);
   }
 }