Skip to content

Commit

Permalink
Add World Script Events: On player hits block with item, on player hi…
Browse files Browse the repository at this point in the history
…ts block with [item name], on player hits block
  • Loading branch information
aufdemrand committed Mar 9, 2013
1 parent 2c7bf52 commit 94b0ca7
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public void playerInteract(PlayerInteractEvent event) {
else if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
Map<String, String> context = new HashMap<String, String>();

context.put("location clicked", new Location(event.getClickedBlock().getLocation()).dScriptArgValue());
if (event.getItem() != null ) {
context.put("item_in_hand", new Item(event.getItem()).dScriptArgValue());

Expand All @@ -176,6 +177,18 @@ else if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
event.setCancelled(true);
}

else if (event.getAction() == Action.PHYSICAL) {
Map<String, String> context = new HashMap<String, String>();

context.put("interact location", new Location(event.getClickedBlock().getLocation()).dScriptArgValue());

if (doEvent("player interacts with block", null, event.getPlayer(), context))
event.setCancelled(true);
}

}


}

}

0 comments on commit 94b0ca7

Please sign in to comment.