Skip to content

Commit

Permalink
TravelListener updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Aug 3, 2013
1 parent 213e0d1 commit d64b092
Showing 1 changed file with 20 additions and 7 deletions.
Expand Up @@ -168,24 +168,37 @@ public String report() {
*/
@EventHandler
public void walking(PlayerMoveEvent event) {
// Only continue if the player moving owns this Listener
if (!(event.getPlayer() == player.getPlayerEntity())) return;
// Don't look if the player hasn't moved a block yet...
if (event.getTo().getBlock().equals(event.getFrom().getBlock())) return;

//
// DISTANCE type Location Listener
//
if (type == TravelType.DISTANCE){
if (!event.getTo().getBlock().equals(event.getFrom().getBlock())) {
blocks_walked++;
dB.echoDebug("..player moved a block");
check();
}
} else if (type == TravelType.TOLOCATION) {
}

//
// TOLOCATION type Location Listener
//
else if (type == TravelType.TOLOCATION) {
if (!player.getPlayerEntity().getLocation().getWorld().equals(end_point.getWorld())) return;
//if (player.getLocation().distance(endPoint) <= radius) {
if (Utilities.checkLocation(player.getPlayerEntity(), end_point, radius)) {
dB.echoDebug("...player reached location");
finish();
}
} else if (type == TravelType.TONPC) {
//if (player.getLocation().distance(target.getBukkitEntity().getLocation()) <= radius) {
if (Utilities.checkLocation(player.getPlayerEntity(), target.getLocation(), radius)) {
}

//
// TONPC type Location Listener
//
else if (type == TravelType.TONPC) {
if (Utilities.checkLocation(player.getPlayerEntity(),
target.getLocation(), radius)) {
dB.echoDebug("...player reached NPC");
finish();
}
Expand Down

0 comments on commit d64b092

Please sign in to comment.