Program: 57928
Project: 57928
Buggy source:
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=true) public void onInteract(PlayerInteractEvent event){
  Player player=event.getPlayer();
  PlotPlayer pp=BukkitUtil.getPlayer(player);
  PlotArea area=pp.getPlotAreaAbs();
  if (area == null) {
    return;
  }
  PlayerBlockEventType eventType=null;
  BukkitLazyBlock lb;
  Location location;
  Action action=event.getAction();
switch (action) {
case PHYSICAL:
{
      eventType=PlayerBlockEventType.TRIGGER_PHYSICAL;
      Block block=event.getClickedBlock();
      lb=new BukkitLazyBlock(block);
      location=BukkitUtil.getLocation(block.getLocation());
      break;
    }
case RIGHT_CLICK_BLOCK:
{
    Block block=event.getClickedBlock();
    location=BukkitUtil.getLocation(block.getLocation());
    Material blockType=block.getType();
    int blockId=blockType.getId();
switch (blockType) {
case ANVIL:
case ACACIA_DOOR:
case BIRCH_DOOR:
case DARK_OAK_DOOR:
case IRON_DOOR:
case JUNGLE_DOOR:
case SPRUCE_DOOR:
case TRAP_DOOR:
case IRON_TRAPDOOR:
case WOOD_DOOR:
case WOODEN_DOOR:
case TRAPPED_CHEST:
case ENDER_CHEST:
case CHEST:
case ACACIA_FENCE_GATE:
case BIRCH_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case FENCE_GATE:
case JUNGLE_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case LEVER:
case DIODE:
case DIODE_BLOCK_OFF:
case DIODE_BLOCK_ON:
case COMMAND:
case REDSTONE_COMPARATOR:
case REDSTONE_COMPARATOR_OFF:
case REDSTONE_COMPARATOR_ON:
case REDSTONE_ORE:
case WOOD_BUTTON:
case STONE_BUTTON:
case BEACON:
case BED_BLOCK:
case SIGN:
case WALL_SIGN:
case SIGN_POST:
case ENCHANTMENT_TABLE:
case BREWING_STAND:
case STANDING_BANNER:
case BURNING_FURNACE:
case FURNACE:
case CAKE_BLOCK:
case DISPENSER:
case DROPPER:
case HOPPER:
case NOTE_BLOCK:
case JUKEBOX:
case WORKBENCH:
      eventType=PlayerBlockEventType.INTERACT_BLOCK;
    break;
case DRAGON_EGG:
  eventType=PlayerBlockEventType.TELEPORT_OBJECT;
break;
default :
if (blockId > 197) {
eventType=PlayerBlockEventType.INTERACT_BLOCK;
}
break;
}
lb=new BukkitLazyBlock(blockId,block);
ItemStack hand=player.getItemInHand();
if (eventType != null) {
break;
}
Material type=(hand == null) ? null : hand.getType();
int id=(type == null) ? 0 : type.getId();
if (id == 0) {
eventType=PlayerBlockEventType.INTERACT_BLOCK;
lb=new BukkitLazyBlock(0,block);
break;
}
 else if (id < 198) {
location=BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
eventType=PlayerBlockEventType.PLACE_BLOCK;
lb=new BukkitLazyBlock(id,block);
break;
}
Material handType=hand.getType();
lb=new BukkitLazyBlock(new PlotBlock((short)handType.getId(),(byte)0));
switch (handType) {
case MONSTER_EGG:
case MONSTER_EGGS:
eventType=PlayerBlockEventType.SPAWN_MOB;
break;
case ARMOR_STAND:
location=BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
eventType=PlayerBlockEventType.PLACE_MISC;
break;
case WRITTEN_BOOK:
case BOOK_AND_QUILL:
case BOOK:
eventType=PlayerBlockEventType.READ;
break;
case APPLE:
case BAKED_POTATO:
case MUSHROOM_SOUP:
case BREAD:
case CARROT:
case CARROT_ITEM:
case COOKIE:
case GRILLED_PORK:
case POISONOUS_POTATO:
case MUTTON:
case PORK:
case POTATO:
case POTATO_ITEM:
case POTION:
case PUMPKIN_PIE:
case RABBIT:
case RABBIT_FOOT:
case RABBIT_STEW:
case RAW_BEEF:
case RAW_FISH:
case RAW_CHICKEN:
eventType=PlayerBlockEventType.EAT;
break;
case MINECART:
case STORAGE_MINECART:
case POWERED_MINECART:
case HOPPER_MINECART:
case EXPLOSIVE_MINECART:
case COMMAND_MINECART:
case BOAT:
eventType=PlayerBlockEventType.PLACE_VEHICLE;
break;
case PAINTING:
case ITEM_FRAME:
location=BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
eventType=PlayerBlockEventType.PLACE_HANGING;
break;
default :
eventType=PlayerBlockEventType.INTERACT_BLOCK;
break;
}
break;
}
case LEFT_CLICK_BLOCK:
Block block=event.getClickedBlock();
location=BukkitUtil.getLocation(block.getLocation());
eventType=PlayerBlockEventType.BREAK_BLOCK;
lb=new BukkitLazyBlock(block);
break;
default :
return;
}
if (PS.get().worldedit != null && pp.getAttribute("String_Node_Str")) {
if (player.getItemInHand().getTypeId() == PS.get().worldedit.getConfiguration().wandItem) {
return;
}
}
if (!EventUtil.manager.checkPlayerBlockEvent(pp,eventType,location,lb,true)) {
event.setCancelled(true);
}
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=true) public void onInteract(PlayerInteractEvent event){
  Player player=event.getPlayer();
  PlotPlayer pp=BukkitUtil.getPlayer(player);
  PlotArea area=pp.getPlotAreaAbs();
  if (area == null) {
    return;
  }
  PlayerBlockEventType eventType=null;
  BukkitLazyBlock lb;
  Location location;
  Action action=event.getAction();
switch (action) {
case PHYSICAL:
{
      eventType=PlayerBlockEventType.TRIGGER_PHYSICAL;
      Block block=event.getClickedBlock();
      lb=new BukkitLazyBlock(block);
      location=BukkitUtil.getLocation(block.getLocation());
      break;
    }
case RIGHT_CLICK_BLOCK:
{
    Block block=event.getClickedBlock();
    location=BukkitUtil.getLocation(block.getLocation());
    Material blockType=block.getType();
    int blockId=blockType.getId();
switch (blockType) {
case ANVIL:
case ACACIA_DOOR:
case BIRCH_DOOR:
case DARK_OAK_DOOR:
case IRON_DOOR:
case JUNGLE_DOOR:
case SPRUCE_DOOR:
case TRAP_DOOR:
case IRON_TRAPDOOR:
case WOOD_DOOR:
case WOODEN_DOOR:
case TRAPPED_CHEST:
case ENDER_CHEST:
case CHEST:
case ACACIA_FENCE_GATE:
case BIRCH_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case FENCE_GATE:
case JUNGLE_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case LEVER:
case DIODE:
case DIODE_BLOCK_OFF:
case DIODE_BLOCK_ON:
case COMMAND:
case REDSTONE_COMPARATOR:
case REDSTONE_COMPARATOR_OFF:
case REDSTONE_COMPARATOR_ON:
case REDSTONE_ORE:
case WOOD_BUTTON:
case STONE_BUTTON:
case BEACON:
case BED_BLOCK:
case SIGN:
case WALL_SIGN:
case SIGN_POST:
case ENCHANTMENT_TABLE:
case BREWING_STAND:
case STANDING_BANNER:
case BURNING_FURNACE:
case FURNACE:
case CAKE_BLOCK:
case DISPENSER:
case DROPPER:
case HOPPER:
case NOTE_BLOCK:
case JUKEBOX:
case WORKBENCH:
      eventType=PlayerBlockEventType.INTERACT_BLOCK;
    break;
case DRAGON_EGG:
  eventType=PlayerBlockEventType.TELEPORT_OBJECT;
break;
default :
if (blockId > 197) {
eventType=PlayerBlockEventType.INTERACT_BLOCK;
}
break;
}
lb=new BukkitLazyBlock(blockId,block);
ItemStack hand=player.getItemInHand();
if (eventType != null) {
break;
}
Material type=(hand == null) ? null : hand.getType();
int id=(type == null) ? 0 : type.getId();
if (id == 0) {
eventType=PlayerBlockEventType.INTERACT_BLOCK;
lb=new BukkitLazyBlock(0,block);
break;
}
if (id < 198) {
location=BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
eventType=PlayerBlockEventType.PLACE_BLOCK;
lb=new BukkitLazyBlock(id,block);
break;
}
Material handType=hand.getType();
lb=new BukkitLazyBlock(new PlotBlock((short)handType.getId(),(byte)0));
switch (handType) {
case MONSTER_EGG:
case MONSTER_EGGS:
eventType=PlayerBlockEventType.SPAWN_MOB;
break;
case ARMOR_STAND:
location=BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
eventType=PlayerBlockEventType.PLACE_MISC;
break;
case WRITTEN_BOOK:
case BOOK_AND_QUILL:
case BOOK:
eventType=PlayerBlockEventType.READ;
break;
case APPLE:
case BAKED_POTATO:
case MUSHROOM_SOUP:
case BREAD:
case CARROT:
case CARROT_ITEM:
case COOKIE:
case GRILLED_PORK:
case POISONOUS_POTATO:
case MUTTON:
case PORK:
case POTATO:
case POTATO_ITEM:
case POTION:
case PUMPKIN_PIE:
case RABBIT:
case RABBIT_FOOT:
case RABBIT_STEW:
case RAW_BEEF:
case RAW_FISH:
case RAW_CHICKEN:
eventType=PlayerBlockEventType.EAT;
break;
case MINECART:
case STORAGE_MINECART:
case POWERED_MINECART:
case HOPPER_MINECART:
case EXPLOSIVE_MINECART:
case COMMAND_MINECART:
case BOAT:
eventType=PlayerBlockEventType.PLACE_VEHICLE;
break;
case PAINTING:
case ITEM_FRAME:
location=BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
eventType=PlayerBlockEventType.PLACE_HANGING;
break;
default :
eventType=PlayerBlockEventType.INTERACT_BLOCK;
break;
}
break;
}
case LEFT_CLICK_BLOCK:
Block block=event.getClickedBlock();
location=BukkitUtil.getLocation(block.getLocation());
eventType=PlayerBlockEventType.BREAK_BLOCK;
lb=new BukkitLazyBlock(block);
break;
default :
return;
}
if (PS.get().worldedit != null && pp.getAttribute("String_Node_Str")) {
if (player.getItemInHand().getTypeId() == PS.get().worldedit.getConfiguration().wandItem) {
return;
}
}
if (!EventUtil.manager.checkPlayerBlockEvent(pp,eventType,location,lb,true)) {
event.setCancelled(true);
}
}