Skip to content

Commit

Permalink
add 'determine uncancelled' to 'on player clicks'
Browse files Browse the repository at this point in the history
A lot of click events seem to be cancelled by default... this adds a
determination for 'uncancelled' in the click event.
Actual usage: right-clicking a dragoncontrolstaff item while riding an
enderdragon:
normally, does nothing due to arbitrarily pre-cancellation (At least on
C-K's server)... but with a 'determine uncancelled' in the event,
right-clicking will properly cause the dragon to move downward.
I imagine plugins will cancel a lot of events that Denizen users want to
not be cancelled... so I think this should be the first of many
'uncancelled' determine options.
  • Loading branch information
mcmonkey4eva committed Nov 6, 2013
1 parent a879014 commit a19d72c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -1596,7 +1596,7 @@ public void registerCoreMembers() {

// <--[command]
// @Name Push
// @Syntax push [<entity>|...] (origin:<entity>/<location>) (destination:<location>) (speed:<#.#>) (<duration>) (<script>)
// @Syntax push [<entity>|...] (origin:<entity>/<location>) (destination:<location>) (speed:<#.#>) (duration:<duration>) (<script>)
// @Required 1
// @Stable mostly
// @Short Pushes entities through the air in a straight line.
Expand Down
Expand Up @@ -3495,6 +3495,7 @@ public void playerGameModeChange(PlayerGameModeChangeEvent event) {
//
// @Determine
// "CANCELLED" to stop the click from happening.
// "UNCANCELLED" to ensure other plugins will process the event properly.
//
// -->
@EventHandler
Expand Down Expand Up @@ -3565,10 +3566,12 @@ else if (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)

}

String determination = doEvents(events, null, event.getPlayer(), context, true);
String determination = doEvents(events, null, event.getPlayer(), context, true).toUpperCase();

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

// <--[event]
Expand Down

0 comments on commit a19d72c

Please sign in to comment.