mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-15 04:41:37 +08:00
Remove method reflection for getMinHeight in BukkitWorld. (#1796)
* Remove reflective use of the getMinHeight method in BukkitWorld. Which requires dep updates to 1.17, which may currently break this build? * Tell Gradle we can read Java 16 JARs Co-authored-by: Octavia Togami <octavia.togami@gmail.com>
This commit is contained in:
parent
eb7b79c949
commit
43da91ad92
@ -26,12 +26,16 @@
|
||||
configurations["compileOnly"].extendsFrom(localImplementation)
|
||||
configurations["testImplementation"].extendsFrom(localImplementation)
|
||||
|
||||
configurations.all {
|
||||
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 16)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"api"(project(":worldedit-core"))
|
||||
"api"(project(":worldedit-libs:bukkit"))
|
||||
// Technically this is api, but everyone should already have some form of the bukkit API
|
||||
// Avoid pulling in another one, especially one so outdated.
|
||||
"localImplementation"("org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT") {
|
||||
"localImplementation"("org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT") {
|
||||
exclude("junit", "junit")
|
||||
}
|
||||
|
||||
@ -41,7 +45,7 @@
|
||||
"localImplementation"("org.apache.logging.log4j:log4j-api")
|
||||
|
||||
"compileOnly"("org.jetbrains:annotations:20.1.0")
|
||||
"compileOnly"("com.destroystokyo.paper:paper-api:1.16.1-R0.1-SNAPSHOT") {
|
||||
"compileOnly"("io.papermc.paper:paper-api:1.17-R0.1-SNAPSHOT") {
|
||||
exclude(group = "org.slf4j", module = "slf4j-api")
|
||||
}
|
||||
"implementation"("io.papermc:paperlib:1.0.6")
|
||||
|
@ -59,8 +59,6 @@
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
@ -79,8 +77,6 @@ public class BukkitWorld extends AbstractWorld {
|
||||
|
||||
private static final boolean HAS_3D_BIOMES;
|
||||
private static final boolean HAS_MIN_Y;
|
||||
private static final Method GET_MIN_Y;
|
||||
private int minY;
|
||||
|
||||
private static final Map<Integer, Effect> effects = new HashMap<>();
|
||||
|
||||
@ -99,15 +95,12 @@ public class BukkitWorld extends AbstractWorld {
|
||||
temp = false;
|
||||
}
|
||||
HAS_3D_BIOMES = temp;
|
||||
Method tempGetMinY;
|
||||
try {
|
||||
tempGetMinY = World.class.getMethod("getMinHeight");
|
||||
World.class.getMethod("getMinHeight");
|
||||
temp = true;
|
||||
} catch (NoSuchMethodException e) {
|
||||
tempGetMinY = null;
|
||||
temp = false;
|
||||
}
|
||||
GET_MIN_Y = tempGetMinY;
|
||||
HAS_MIN_Y = temp;
|
||||
}
|
||||
|
||||
@ -127,13 +120,6 @@ public BukkitWorld(World world) {
|
||||
} else {
|
||||
this.worldNativeAccess = null;
|
||||
}
|
||||
if (HAS_MIN_Y) {
|
||||
try {
|
||||
minY = (int) GET_MIN_Y.invoke(world);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
minY = super.getMinY();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -374,11 +360,10 @@ public int getMaxY() {
|
||||
|
||||
@Override
|
||||
public int getMinY() {
|
||||
/*if (HAS_MIN_Y) {
|
||||
if (HAS_MIN_Y) {
|
||||
return getWorld().getMinHeight();
|
||||
}
|
||||
return super.getMinY();*/
|
||||
return minY;
|
||||
return super.getMinY();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
Loading…
Reference in New Issue
Block a user