From 0d205b0d9e2bdbbb4cf577b08d8dc9c8069593b2 Mon Sep 17 00:00:00 2001 From: Thijs Wiefferink Date: Mon, 8 Feb 2016 14:43:24 +0100 Subject: [PATCH] Change general.teleportLocationY to also accept a number. --- .../evolutioncoding/areashop/regions/GeneralRegion.java | 9 ++++++++- AreaShop/src/main/resources/default.yml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/AreaShop/src/main/java/nl/evolutioncoding/areashop/regions/GeneralRegion.java b/AreaShop/src/main/java/nl/evolutioncoding/areashop/regions/GeneralRegion.java index 211901ab..b72bd306 100644 --- a/AreaShop/src/main/java/nl/evolutioncoding/areashop/regions/GeneralRegion.java +++ b/AreaShop/src/main/java/nl/evolutioncoding/areashop/regions/GeneralRegion.java @@ -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()); } diff --git a/AreaShop/src/main/resources/default.yml b/AreaShop/src/main/resources/default.yml index f1f75797..03ae953c 100644 --- a/AreaShop/src/main/resources/default.yml +++ b/AreaShop/src/main/resources/default.yml @@ -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).