From 91ef3ff3c8c9af9f78a86bb78ef7e9fdb448a86c Mon Sep 17 00:00:00 2001 From: SuperRonanCraft Date: Wed, 16 Mar 2022 21:40:46 -0400 Subject: [PATCH] max/min y pushed to location verification --- .../BetterRTP/player/rtp/RTPPlayer.java | 16 +++++++--------- src/main/resources/locations.yml | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/player/rtp/RTPPlayer.java b/src/main/java/me/SuperRonanCraft/BetterRTP/player/rtp/RTPPlayer.java index 1455f98..6c8e7a8 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/player/rtp/RTPPlayer.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/player/rtp/RTPPlayer.java @@ -96,28 +96,26 @@ public class RTPPlayer { b = world.getBlockAt(x, b.getY() - 1, z); } } - //System.out.println(b.getType().name()); - if (b.getY() > pWorld.getMinY() && !badBlock(b.getType().name(), x, z, pWorld.getWorld(), pWorld.getBiomes())) { + //Between max and min y + if ( b.getY() >= pWorld.getMinY() + && b.getY() <= pWorld.getMaxY() + && !badBlock(b.getType().name(), x, z, pWorld.getWorld(), pWorld.getBiomes())) { return new Location(world, (x + 0.5), b.getY() + 1, (z + 0.5), yaw, pitch); } return null; } private Location getLocAtNether(int x, int z, World world, Float yaw, Float pitch, WorldPlayer pWorld) { - //System.out.println("-----------"); - for (int y = 1; y < world.getMaxHeight(); y++) { - // System.out.println("--"); + //Max and Min Y + for (int y = pWorld.getMinY() + 1; y < pWorld.getMaxY()/*world.getMaxHeight()*/; y++) { Block block_current = world.getBlockAt(x, y, z); - //System.out.println(block_current.getType().name()); if (block_current.getType().name().endsWith("AIR") || !block_current.getType().isSolid()) { - //System.out.println(block_current.getType().name()); if (!block_current.getType().name().endsWith("AIR") && !block_current.getType().isSolid()) { //Block is not a solid (ex: lava, water...) String block_in = block_current.getType().name(); if (badBlock(block_in, x, z, pWorld.getWorld(), null)) - continue;//return null; + continue; } - //System.out.println(block_current.getType().name()); String block = world.getBlockAt(x, y - 1, z).getType().name(); if (block.endsWith("AIR")) //Block below is air, skip continue; diff --git a/src/main/resources/locations.yml b/src/main/resources/locations.yml index 8f674c0..f88a3bd 100644 --- a/src/main/resources/locations.yml +++ b/src/main/resources/locations.yml @@ -12,7 +12,7 @@ Enabled: false #enable the locations feature RequirePermission: false #Require players to have `betterrtp.location.` UseLocationIfAvailable: true #Will choose a location upon `/rtp` if location(s) is available in the world -#OnlyAllowInWorld: true #Only allow players to use locations that correspond to the world they are standing in +#OnlyAllowInWorld: true #Only allow players to use locations that correspond to the world they are standing in #coming soon Locations: - main_loc: