Пример #1
0
 @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
 public void onBlockPhysics(BlockPhysicsEvent event) {
   final Block block = event.getBlock();
   final Material type = block.getType();
   if (MaterialUtil.ISSIGN.get(type)) {
     if (Util.isSupported(block)) {
       // Check for potential redstone changes
       updateRedstonePower(block);
     } else {
       // Remove from block power storage
       poweredBlocks.remove(block);
     }
   } else if (MaterialUtil.ISREDSTONETORCH.get(type)) {
     // Send proper update events for all signs around this power source
     for (BlockFace face : FaceUtil.RADIAL) {
       final Block rel = event.getBlock().getRelative(face);
       if (MaterialUtil.ISSIGN.get(rel)) {
         CommonUtil.nextTick(
             new Runnable() {
               public void run() {
                 updateRedstonePower(rel);
               }
             });
       }
     }
   }
 }
Пример #2
0
 @EventHandler(priority = EventPriority.HIGH)
 public void onBlockPhysics(BlockPhysicsEvent event) {
   if (event.getBlock().getType() == Material.PORTAL) {
     if (DPortal.get(event.getBlock()) != null) {
       event.setCancelled(true);
     }
   }
 }
 @EventHandler(priority = EventPriority.MONITOR)
 public void onBlockPhysics(BlockPhysicsEvent event) {
   if (event.isCancelled() || !OrebfuscatorConfig.getUpdateOnPhysics()) return;
   if (event.getBlock().getType() != Material.SAND
       && event.getBlock().getType() != Material.GRAVEL) return;
   if (!applyphysics(event.getBlock())) return;
   OrebfuscatorThreadUpdate.Queue(event.getBlock());
 }
 @EventHandler(ignoreCancelled = true)
 public void onBlockPhysics(BlockPhysicsEvent event) {
   Block block = event.getBlock();
   if (LotteryManager.isSignRegistered(block) || !checkBlockBroken(block)) {
     event.setCancelled(true);
     return;
   }
 }
  /** Detect when water drains. */
  @EventHandler
  public void onBlockPhysics(BlockPhysicsEvent event) {
    if (event.isCancelled()) return;

    BlockState b = event.getBlock().getState();
    // As far as I know, these are always evaporation events.
    if (plugin.isBlockStateDetectable(b)) {
      plugin.executeSensorsAroundBlock(b, true, event);
    }
  }
  /*
   * Called when block physics occurs.
   */
  @EventHandler(ignoreCancelled = true)
  public void onBlockPhysics(BlockPhysicsEvent event) {
    ConfigurationManager cfg = plugin.getGlobalStateManager();
    WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());

    if (cfg.activityHaltToggle) {
      event.setCancelled(true);
      return;
    }

    int id = event.getChangedTypeId();

    if (id == 13 && wcfg.noPhysicsGravel) {
      event.setCancelled(true);
      return;
    }

    if (id == 12 && wcfg.noPhysicsSand) {
      event.setCancelled(true);
      return;
    }

    if (id == 90 && wcfg.allowPortalAnywhere) {
      event.setCancelled(true);
      return;
    }

    if (wcfg.ropeLadders && event.getBlock().getType() == Material.LADDER) {
      if (event.getBlock().getRelative(0, 1, 0).getType() == Material.LADDER) {
        event.setCancelled(true);
        return;
      }
    }
  }
Пример #7
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);
   }
 }
  @Override
  public void onBlockPhysics(BlockPhysicsEvent event) {
    Block block = event.getBlock();
    Material material = block.getType();
    if (material == Material.LEVER || material == Material.STONE_BUTTON) {
      Material adjMaterial = getBlockBehindButton(block).getType();

      if (adjMaterial == Material.PISTON_BASE
          || adjMaterial == Material.PISTON_STICKY_BASE
          || adjMaterial == Material.PISTON_MOVING_PIECE) {
        event.setCancelled(true);
        return;
      }
    }
  }
 public void onBlockPhysics(BlockPhysicsEvent event) {
   if (event.isCancelled()) {
     return;
   }
   // Forces diode not to update and disable itself
   if (event.getBlock().getTypeId() == Material.DIODE_BLOCK_ON.getId()) {
     ConcurrentHashMap<Block, Sensor> sensorList = SensorManager.getSensorList();
     Iterator<Entry<Block, Sensor>> i = sensorList.entrySet().iterator();
     while (i.hasNext()) {
       Entry<Block, Sensor> e = i.next();
       if (SensorManager.isSign(e.getKey())
           && ((GenericSensor) e.getValue()).equals(event.getBlock().getLocation())) {
         event.setCancelled(true);
         return;
       }
     }
   }
 }
  @EventHandler
  public void onPhysics(BlockPhysicsEvent event) {
    Block block = event.getBlock();

    if (block.getType() == Material.GRASS
        || block.getType() == Material.LONG_GRASS
        || block.getType() == Material.YELLOW_FLOWER
            && (plugin.isProtectedRegion(block))
            && (plugin.getWorlds().contains(block.getWorld().getName()))
            && !(plugin.isExcluded(block))
            && !(plugin.isPaused())) {}
  }
Пример #12
0
  /**
   * Called when block physics occurs
   *
   * @param event Relevant event details
   */
  @Override
  public void onBlockPhysics(BlockPhysicsEvent event) {

    if (event.isCancelled()) {
      return;
    }

    ConfigurationManager cfg = plugin.getGlobalConfiguration();
    WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld());

    int id = event.getChangedTypeId();

    if (id == 13 && wcfg.noPhysicsGravel) {
      event.setCancelled(true);
      return;
    }

    if (id == 12 && wcfg.noPhysicsSand) {
      event.setCancelled(true);
      return;
    }

    if (id == 90 && wcfg.allowPortalAnywhere) {
      event.setCancelled(true);
      return;
    }
  }
Пример #13
0
 @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
 public void onBlockPhysics(BlockPhysicsEvent event) {
   final Block physics = event.getBlock();
   if (physics.getRelative(BlockFace.DOWN).getType() != Material.AIR) {
     return;
   }
   final Sprout sprout =
       plugin
           .getWorldRegistry()
           .remove(physics.getWorld().getName(), physics.getX(), physics.getY(), physics.getZ());
   final SaveThread thread = ((SaveThread) ThreadRegistry.get(physics.getWorld().getName()));
   if (thread != null) {
     thread.remove(physics.getLocation(), (SimpleSprout) sprout);
   }
   if (sprout == null) {
     return;
   }
   event.setCancelled(true);
   physics.setType(Material.AIR);
   ((SpoutBlock) physics).setCustomBlock(null);
   if (!sprout.getRequiredTools().isEmpty()) {
     disperseDrops(sprout, physics, false);
   }
 }
Пример #14
0
 @Override
 public void onBlockPhysics(BlockPhysicsEvent event) {
   if (!manager.allowPhysics(event.getBlock())) {
     event.setCancelled(true);
   }
 }