Skip to content

Commit

Permalink
Add stickiness context to the extend/retract events, fixes #947
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 6, 2015
1 parent 1378914 commit ebde22d
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -531,8 +531,9 @@ public void blockIgnite(BlockIgniteEvent event) {
// @Context
// <context.location> returns the dLocation of the piston.
// <context.material> returns the dMaterial of the piston.
// <context.length> returns the number of blocks that will be moved by the piston.
// <context.length> returns an Element of the number of blocks that will be moved by the piston.
// <context.blocks> returns a dList of all block locations about to be moved.
// <context.sticky> returns an Element of whether the piston is sticky.
//
// @Determine
// "CANCELLED" to stop the piston from extending.
Expand All @@ -547,6 +548,7 @@ public void blockPistonExtend(BlockPistonExtendEvent event) {
context.put("location", new dLocation(event.getBlock().getLocation()));
context.put("material", material);
context.put("length", new Element(event.getLength()));
context.put("sticky", new Element(event.isSticky() ? "true": "false"));

dList blocks = new dList();
for (Block block: event.getBlocks())
Expand All @@ -573,6 +575,7 @@ public void blockPistonExtend(BlockPistonExtendEvent event) {
// <context.retract_location> returns the new dLocation of the block that
// will be moved by the piston if it is sticky.
// <context.material> returns the dMaterial of the piston.
// <context.sticky> returns an Element of whether the piston is sticky.
//
// @Determine
// "CANCELLED" to stop the piston from retracting.
Expand All @@ -587,6 +590,7 @@ public void blockPistonRetract(BlockPistonRetractEvent event) {
context.put("location", new dLocation(event.getBlock().getLocation()));
context.put("retract_location", new dLocation(event.getRetractLocation()));
context.put("material", material);
context.put("sticky", new Element(event.isSticky() ? "true": "false"));

String determination = doEvents(Arrays.asList
("piston retracts",
Expand Down Expand Up @@ -1590,8 +1594,8 @@ public void entityPortalExit(EntityPortalExitEvent event) {
else if (entity.isPlayer()) player = new dPlayer(entity.getPlayer());

doEvents(Arrays.asList
("entity exits portal",
entity.identifyType() + " exits portal"),
("entity exits portal",
entity.identifyType() + " exits portal"),
npc, player, context, true);
}

Expand Down

0 comments on commit ebde22d

Please sign in to comment.