Skip to content

Commit

Permalink
Fix bad highest block location.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCubee committed Jul 22, 2022
1 parent 799dd70 commit 84e87da
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>fr.mrcubee.minecraft.plugin</groupId>
<artifactId>waypoint</artifactId>
<version>1.2.2</version>
<version>1.2.3</version>
<packaging>jar</packaging>

<name>Waypoint</name>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/fr/mrcubee/waypoint/tools/LocationTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ public class LocationTools {
static {
if (ClassUtil.isExist("org.bukkit.HeightMap")
&& ClassUtil.isMethodExist(World.class,"getHighestBlockYAt",
Integer.class, Integer.class, ClassUtil.getClass("org.bukkit.HeightMap"))) {
int.class, int.class, ClassUtil.getClass("org.bukkit.HeightMap"))) {
HIGHEST_BLOCK = (world, coordX, coordZ) -> {
return world.getHighestBlockYAt(coordX, coordZ, HeightMap.WORLD_SURFACE);
};
} else if (ClassUtil.isMethodExist(World.class, "getHighestBlockYAt", Integer.class, Integer.class)) {
} else if (ClassUtil.isMethodExist(World.class, "getHighestBlockYAt", int.class, int.class)) {
HIGHEST_BLOCK = (world, coordX, coordZ) -> {
return world.getHighestBlockYAt(coordX, coordZ);
};
} else {
HIGHEST_BLOCK = (world, coordX, coordZ) -> {
return 0;
return -1;
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/fr/mrcubee/waypoint/util/ClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static boolean isMethodExist(final Class<?> clazz, final String methodNam
if (clazz == null || methodName == null)
return false;
try {
clazz.getMethod(methodName, parameterTypes);
clazz.getDeclaredMethod(methodName, parameterTypes);
return true;
} catch (Exception ignored) {
return false;
Expand Down

0 comments on commit 84e87da

Please sign in to comment.