Пример #1
0
 @Override
 public void onRightClick(PlayerInteractEvent event) {
   if (!plugin.getLocalConfiguration().lightSwitchSettings.enable) return;
   if (!BukkitUtil.toWorldVector(event.getClickedBlock()).equals(pt))
     return; // wth? our manager is insane
   toggleLights(pt);
 }
Пример #2
0
  @Override
  public void onRightClick(PlayerInteractEvent event) {

    if (!plugin.getLocalConfiguration().teleporterSettings.enable) return;

    if (!BukkitUtil.toWorldVector(event.getClickedBlock())
        .equals(BukkitUtil.toWorldVector(trigger))) return; // wth? our manager is insane. ikr.

    LocalPlayer localPlayer = plugin.wrap(event.getPlayer());

    if (!localPlayer.hasPermission("craftbook.mech.teleporter.use")) {
      localPlayer.printError("mech.use-permission");
      return;
    }

    makeItSo(event.getPlayer());

    event.setCancelled(true);
  }
Пример #3
0
  /**
   * Notify mechanics about a changed block that they are watching.
   *
   * @param event
   */
  public void notify(BlockEvent event) {

    Set<PersistentMechanic> pms = watchBlocks.get(BukkitUtil.toWorldVector(event.getBlock()));

    if (pms == null) return;

    for (PersistentMechanic m : pms) {
      m.onWatchBlockNotification(event);
    }
  }
Пример #4
0
  @Override
  public void onRightClick(PlayerInteractEvent event) {

    LocalPlayer localPlayer = plugin.wrap(event.getPlayer());

    if (!plugin.getLocalConfiguration().cauldronSettings.enable) return;

    if (!localPlayer.hasPermission("craftbook.mech.cauldron")) return;

    if (!BukkitUtil.toWorldVector(event.getClickedBlock()).equals(pt)) return;
    if (event.getPlayer().getItemInHand().getTypeId() >= 255
        || event.getPlayer().getItemInHand().getType() == Material.AIR) {
      if (preCauldron(event.getPlayer(), event.getPlayer().getWorld(), pt)) {
        event.setUseInteractedBlock(Result.DENY);
        event.setUseItemInHand(Result.DENY);
        event.setCancelled(true);
      }
    }
  }