From 3861a72d2b8426e8e3cf56237ff91ff495b74c10 Mon Sep 17 00:00:00 2001 From: MorphanOne Date: Sat, 31 Aug 2013 17:10:58 -0400 Subject: [PATCH] More world script meta --- .../containers/core/WorldScriptHelper.java | 127 +++++++++++++++++- 1 file changed, 123 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/aufdemrand/denizen/scripts/containers/core/WorldScriptHelper.java b/src/main/java/net/aufdemrand/denizen/scripts/containers/core/WorldScriptHelper.java index 930fa50aca..89846518ce 100644 --- a/src/main/java/net/aufdemrand/denizen/scripts/containers/core/WorldScriptHelper.java +++ b/src/main/java/net/aufdemrand/denizen/scripts/containers/core/WorldScriptHelper.java @@ -298,6 +298,20 @@ public void blockIgnite(BlockIgniteEvent event) { event.setCancelled(true); } + // <--[event] + // @Events + // block moves + // moves + // + // @Triggers when a block moves. + // @Context + // will return the location the block moved to. + // will return the material of the block that moved. + // + // @Determine + // CANCELLED to stop the block from being moved. + // + // --> @EventHandler public void blockPhysics(BlockPhysicsEvent event) { @@ -315,6 +329,20 @@ public void blockPhysics(BlockPhysicsEvent event) { event.setCancelled(true); } + // <--[event] + // @Events + // player places block + // player places + // + // @Triggers when a player places a block. + // @Context + // will return the location the block that was placed. + // will return the material of the block that was placed. + // + // @Determine + // CANCELLED to stop the block from being placed. + // + // --> @EventHandler public void blockPlace(BlockPlaceEvent event) { @@ -332,7 +360,22 @@ public void blockPlace(BlockPlaceEvent event) { event.setCancelled(true); } - + // <--[event] + // @Events + // block powered + // powered + // block unpowered + // unpowered + // + // @Triggers when a block is (un)powered. + // @Context + // will return the location of the block that was (un)powered. + // will return the material of the block that was (un)powered. + // + // @Determine + // CANCELLED to stop the block from being (un)powered. + // + // --> @EventHandler public void blockRedstone(BlockRedstoneEvent event) { @@ -358,6 +401,21 @@ public void blockRedstone(BlockRedstoneEvent event) { event.setNewCurrent(event.getOldCurrent()); } + // <--[event] + // @Events + // block spreads + // spreads + // + // @Triggers when a liquid block spreads. + // @Context + // will return the location the block spread from. + // will return the material of the block that spread. + // will return the location the block spread to. + // + // @Determine + // CANCELLED to stop the block from spreading. + // + // --> @EventHandler public void blockFromTo(BlockFromToEvent event) { @@ -376,8 +434,24 @@ public void blockFromTo(BlockFromToEvent event) { event.setCancelled(true); } + // <--[event] + // @Events + // player changes sign + // player changes wall_sign + // player changes sign_post + // + // @Triggers when a player changes a sign. + // @Context + // will return the location of the sign. + // will return the old sign text as a dList. + // will return the new sign text as a dList. + // + // @Determine + // CANCELLED to stop the sign from being changed. + // + // --> @EventHandler - public void signChange(SignChangeEvent event) { + public void signChange(final SignChangeEvent event) { final Map context = new HashMap(); @@ -396,7 +470,8 @@ public void run() { context.put("new", new dList(Arrays.asList(sign.getLines()))); String determination = doEvents(Arrays.asList - ("player changes sign"), + ("player changes sign", + "player changes " + event.getBlock().getType().name()), null, player, context); if (determination.toUpperCase().startsWith("CANCELLED")) @@ -409,7 +484,14 @@ public void run() { ///////////////////// // CUSTOM EVENTS ///////////////// - + + // <--[event] + // @Events + // server start + // + // @Triggers when the server starts + // + // --> public void serverStartEvent() { // Start the 'timeEvent' Bukkit.getScheduler().scheduleSyncRepeatingTask(DenizenAPI.getCurrentInstance(), @@ -427,6 +509,18 @@ public void run() { private Map current_time = new HashMap(); + // <--[event] + // @Events + // time changes in + // <0-23>:00 in + // time <0-23> in + // + // @Triggers when a block is set on fire. + // @Context + // will return the current time. + // will return the world. + // + // --> public void timeEvent() { for (World world : Bukkit.getWorlds()) { int hour = Double.valueOf(world.getTime() / 1000).intValue(); @@ -456,6 +550,31 @@ public void timeEvent() { // HANGING EVENTS ///////////////// + // <--[event] + // @Events + // hanging breaks + // hanging breaks because + // breaks + // breaks because + // entity breaks hanging + // entity breaks hanging because + // entity breaks + // entity breaks because + // breaks hanging + // breaks hanging because + // breaks + // breaks because + // + // @Triggers when a hanging block is broken. + // @Context + // will return the hanging block as a dEntity. + // will return the cause of the block breaking. + // will return the entity that broke the hanging block, if any. + // + // @Determine + // CANCELLED to stop the hanging block from being broken. + // + // --> @EventHandler public void hangingBreak(HangingBreakEvent event) {