mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-18 16:35:25 +01:00
fix: update to changes in 1.21 class paths
This commit is contained in:
parent
5d979b0a4f
commit
21a94104be
@ -1171,7 +1171,9 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
@Override
|
@Override
|
||||||
public @NonNull String serverNativePackage() {
|
public @NonNull String serverNativePackage() {
|
||||||
final String name = Bukkit.getServer().getClass().getPackage().getName();
|
final String name = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
return name.substring(name.lastIndexOf('.') + 1);
|
String ver = name.substring(name.lastIndexOf('.') + 1);
|
||||||
|
// org.bukkit.craftbukkit is no longer suffixed by a version
|
||||||
|
return ver.equals("craftbukkit") ? "" : ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,9 +49,14 @@ public class SingleWorldListener implements Listener {
|
|||||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
|
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
|
||||||
} catch (NoSuchMethodException ignored) {
|
} catch (NoSuchMethodException ignored) {
|
||||||
try {
|
try {
|
||||||
ReflectionUtils.RefClass classChunkStatus = getRefClass("net.minecraft.world.level.chunk.ChunkStatus");
|
String chunkStatus = PlotSquared.platform().serverVersion()[1] < 21
|
||||||
|
? "net.minecraft.world.level.chunk" + ".ChunkStatus"
|
||||||
|
: "net.minecraft.world.level.chunk.status.ChunkStatus";
|
||||||
|
ReflectionUtils.RefClass classChunkStatus = getRefClass(chunkStatus);
|
||||||
this.objChunkStatusFull = classChunkStatus.getRealClass().getField("n").get(null);
|
this.objChunkStatusFull = classChunkStatus.getRealClass().getField("n").get(null);
|
||||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle", classChunkStatus.getRealClass()).getRealMethod();
|
this.methodGetHandleChunk = classCraftChunk
|
||||||
|
.getMethod("getHandle", classChunkStatus.getRealClass())
|
||||||
|
.getRealMethod();
|
||||||
} catch (NoSuchMethodException ex) {
|
} catch (NoSuchMethodException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,8 @@ public class PlotSquared {
|
|||||||
GlobalFlagContainer.setup();
|
GlobalFlagContainer.setup();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new ReflectionUtils(this.platform.serverNativePackage());
|
String ver = this.platform.serverNativePackage();
|
||||||
|
new ReflectionUtils(ver.isEmpty() ? null : ver);
|
||||||
try {
|
try {
|
||||||
URL logurl = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation();
|
URL logurl = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation();
|
||||||
this.jarFile = new File(
|
this.jarFile = new File(
|
||||||
@ -214,7 +215,7 @@ public class PlotSquared {
|
|||||||
logurl.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file"))
|
logurl.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file"))
|
||||||
.getPath());
|
.getPath());
|
||||||
} catch (URISyntaxException | SecurityException e) {
|
} catch (URISyntaxException | SecurityException e) {
|
||||||
e.printStackTrace();
|
LOGGER.error(e);
|
||||||
this.jarFile = new File(this.platform.getDirectory().getParentFile(), "PlotSquared.jar");
|
this.jarFile = new File(this.platform.getDirectory().getParentFile(), "PlotSquared.jar");
|
||||||
if (!this.jarFile.exists()) {
|
if (!this.jarFile.exists()) {
|
||||||
this.jarFile = new File(
|
this.jarFile = new File(
|
||||||
@ -238,7 +239,7 @@ public class PlotSquared {
|
|||||||
copyFile("skyblock.template", Settings.Paths.TEMPLATES);
|
copyFile("skyblock.template", Settings.Paths.TEMPLATES);
|
||||||
showDebug();
|
showDebug();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
LOGGER.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user