Skip to content

Commit

Permalink
Added "on player places block" world script event.
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Jul 3, 2013
1 parent 49997da commit 0c121ab
Showing 1 changed file with 21 additions and 0 deletions.
Expand Up @@ -21,6 +21,7 @@
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
Expand Down Expand Up @@ -655,6 +656,26 @@ public void blockIgnite(BlockIgniteEvent event) {
event.setCancelled(true);
}

@EventHandler
public void blockPlace(BlockPlaceEvent event) {

String determination;
Map<String, Object> context = new HashMap<String, Object>();

context.put("location", new dLocation(event.getBlock().getLocation()));
context.put("type", event.getBlock().getType().name());

determination = doEvent("player places block", null, event.getPlayer(), context);

if (determination.toUpperCase().startsWith("CANCELLED"))
event.setCancelled(true);

determination = doEvent("player places " + event.getBlock().getType().name(), null, event.getPlayer(), context);

if (determination.toUpperCase().startsWith("CANCELLED"))
event.setCancelled(true);
}


@EventHandler
public void blockRedstone(BlockRedstoneEvent event) {
Expand Down

0 comments on commit 0c121ab

Please sign in to comment.