File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed
Bukkit/src/main/java/com/plotsquared/bukkit
Core/src/main/java/com/plotsquared/core Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -1171,7 +1171,9 @@ public void setGenerator(final @NonNull String worldName) {
11711171 @ Override
11721172 public @ NonNull String serverNativePackage () {
11731173 final String name = Bukkit .getServer ().getClass ().getPackage ().getName ();
1174- return name .substring (name .lastIndexOf ('.' ) + 1 );
1174+ String ver = name .substring (name .lastIndexOf ('.' ) + 1 );
1175+ // org.bukkit.craftbukkit is no longer suffixed by a version
1176+ return ver .equals ("craftbukkit" ) ? "" : ver ;
11751177 }
11761178
11771179 @ Override
Original file line number Diff line number Diff line change @@ -49,9 +49,14 @@ public SingleWorldListener() throws Exception {
4949 this .methodGetHandleChunk = classCraftChunk .getMethod ("getHandle" ).getRealMethod ();
5050 } catch (NoSuchMethodException ignored ) {
5151 try {
52- ReflectionUtils .RefClass classChunkStatus = getRefClass ("net.minecraft.world.level.chunk.ChunkStatus" );
52+ String chunkStatus = PlotSquared .platform ().serverVersion ()[1 ] < 21
53+ ? "net.minecraft.world.level.chunk" + ".ChunkStatus"
54+ : "net.minecraft.world.level.chunk.status.ChunkStatus" ;
55+ ReflectionUtils .RefClass classChunkStatus = getRefClass (chunkStatus );
5356 this .objChunkStatusFull = classChunkStatus .getRealClass ().getField ("n" ).get (null );
54- this .methodGetHandleChunk = classCraftChunk .getMethod ("getHandle" , classChunkStatus .getRealClass ()).getRealMethod ();
57+ this .methodGetHandleChunk = classCraftChunk
58+ .getMethod ("getHandle" , classChunkStatus .getRealClass ())
59+ .getRealMethod ();
5560 } catch (NoSuchMethodException ex ) {
5661 throw new RuntimeException (ex );
5762 }
Original file line number Diff line number Diff line change @@ -206,15 +206,16 @@ public PlotSquared(
206206 GlobalFlagContainer .setup ();
207207
208208 try {
209- new ReflectionUtils (this .platform .serverNativePackage ());
209+ String ver = this .platform .serverNativePackage ();
210+ new ReflectionUtils (ver .isEmpty () ? null : ver );
210211 try {
211212 URL logurl = PlotSquared .class .getProtectionDomain ().getCodeSource ().getLocation ();
212213 this .jarFile = new File (
213214 URI .create (
214215 logurl .toURI ().toString ().split ("\\ !" )[0 ].replaceAll ("jar:file" , "file" ))
215216 .getPath ());
216217 } catch (URISyntaxException | SecurityException e ) {
217- e . printStackTrace ( );
218+ LOGGER . error ( e );
218219 this .jarFile = new File (this .platform .getDirectory ().getParentFile (), "PlotSquared.jar" );
219220 if (!this .jarFile .exists ()) {
220221 this .jarFile = new File (
@@ -238,7 +239,7 @@ public PlotSquared(
238239 copyFile ("skyblock.template" , Settings .Paths .TEMPLATES );
239240 showDebug ();
240241 } catch (Throwable e ) {
241- e . printStackTrace ( );
242+ LOGGER . error ( e );
242243 }
243244 }
244245
You can’t perform that action at this time.
0 commit comments