Skip to content

Commit

Permalink
Change general.teleportLocationY to also accept a number.
Browse files Browse the repository at this point in the history
  • Loading branch information
NLthijs48 committed Feb 8, 2016
1 parent 8c33826 commit 0d205b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1075,8 +1075,15 @@ public boolean teleportPlayer(Player player, boolean toSign, boolean checkPermis
middle = middle.setY(region.getMinimumPoint().getBlockY());
} else if("top".equalsIgnoreCase(configSetting)) {
middle = middle.setY(region.getMaximumPoint().getBlockY());
} else {
} else if("middle".equalsIgnoreCase(configSetting)) {
middle = middle.setY(middle.getBlockY());
} else {
try {
int vertical = Integer.parseInt(configSetting);
middle = middle.setY(vertical);
} catch(NumberFormatException e) {
plugin.getLogger().warning("Could not parse general.teleportLocationY: '"+configSetting+"'");
}
}
startLocation = new Location(getWorld(), middle.getX(), middle.getY(), middle.getZ(), player.getLocation().getYaw(), player.getLocation().getPitch());
}
Expand Down
2 changes: 1 addition & 1 deletion AreaShop/src/main/resources/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ general:
## The profile for the WorldGuard flags from the 'flagProfiles' section in the config.
flagProfile: 'default'
## The y location within the region to start searching for safe teleport spots (x and z will be in the middle of the region).
## Possible values: bottom, middle, top.
## Possible values: bottom, middle, top, integer.
teleportLocationY: bottom
## If true the teleportation algorithm only allows telportation to inside the region, otherwise it will expand
## a cube from the starting point to check for safe spots (then it could end outside of the region).
Expand Down

0 comments on commit 0d205b0

Please sign in to comment.