Fix Y coordinate at the proper location

This is necessary as the searcher is validating the block below the player's feet, not the one the player is standing in. Therefore we add one to the Y coordinate when completing.
This commit is contained in:
Phoenix616 2019-04-27 01:00:18 +01:00
parent 483a0bb2b3
commit 32de0ca58b
2 changed files with 2 additions and 2 deletions

View File

@ -317,7 +317,6 @@ public class RandomTeleport extends JavaPlugin implements RandomTeleportAPI {
}
sendMessage(searcher.getTargets(), "search", "worldname", searcher.getCenter().getWorld().getName());
searcher.search().thenApply(targetLoc -> {
targetLoc.add(0, 1, 0);
searcher.getTargets().forEach(e -> {
cooldowns.put(searcher.getId(), e.getUniqueId(), new AbstractMap.SimpleImmutableEntry<>(System.currentTimeMillis(), searcher.getCooldown()));
e.teleport(targetLoc);

View File

@ -311,7 +311,8 @@ public class RandomSearcher {
}
if (foundLoc != null) {
future.complete(foundLoc);
// all checks are for the top block, put we want a location above that so add 1 to y
future.complete(foundLoc.add(0, 1, 0));
return true;
}
checkRandom(future);