示例#1
0
  @EventHandler
  public void onPlayerInteract(PlayerInteractEvent event) {
    int BLWand = getConfig().getInt("blocklog.wand");
    boolean WandEnabled = plugin.users.contains(event.getPlayer().getName());
    if (!event.isCancelled()) {
      if (event.getPlayer().getItemInHand().getTypeId() == BLWand && WandEnabled) {
        if ((event.getAction() == Action.RIGHT_CLICK_BLOCK
                && (!event.getPlayer().getItemInHand().getType().isBlock())
            || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
          Material type = event.getClickedBlock().getType();
          if (type == Material.WOODEN_DOOR
              || type == Material.TRAP_DOOR
              || type == Material.CHEST
              || type == Material.DISPENSER
              || type == Material.STONE_BUTTON
              || type == Material.LEVER)
            getBlockInteractions(
                event.getPlayer(), event.getClickedBlock(), Interaction.getByMaterial(type));
          else getBlockEdits(event.getPlayer(), event.getClickedBlock());

          event.setCancelled(true);
        }
      }
    }
  }