Skip to content

Commit

Permalink
Fix location definition in scripts ran by 'Push'
Browse files Browse the repository at this point in the history
If you PUSH an arrow into a mob, the arrow disappears before the script
is ran, so the location isn't recorded. This will record the last-known
location before collision.
  • Loading branch information
mcmonkey4eva committed Nov 27, 2013
1 parent c9b25a2 commit e8d9282
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -184,6 +184,7 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept

BukkitRunnable task = new BukkitRunnable() {
int runs = 0;
dLocation lastLocation;
@Override
public void run() {

Expand All @@ -206,6 +207,7 @@ public void run() {
if (lastEntity.getLocation().add(v3).getBlock().getType() != Material.AIR) {
runs = maxTicks;
}
lastLocation = lastEntity.getLocation();
}
else {
this.cancel();
Expand All @@ -218,6 +220,8 @@ public void run() {
ScriptQueue queue = InstantQueue.getQueue(ScriptQueue._getNextId()).addEntries(entries);
if (lastEntity.getLocation() != null)
queue.addDefinition("location", lastEntity.getLocation().identify());
else
queue.addDefinition("location", lastLocation.identify());
queue.addDefinition("pushed_entities", entityList.toString());
queue.addDefinition("last_entity", lastEntity.identify());
queue.start();
Expand Down

0 comments on commit e8d9282

Please sign in to comment.