Ejemplo n.º 1
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);
  }
Ejemplo n.º 2
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);
      }
    }
  }