@@ -22,47 +22,35 @@ public final class WorldUtil {
2222 BED_WORKS = ReflectionUtil .findMethod (World .class , "isBedWorks" , boolean .class );
2323 }
2424
25- public static int getMinWorldHeight (World world ) {
26- if (!GET_MIN_WORLD_HEIGHT_AVAILABLE ) {
27- return AnarchyExploitFixes .config ().worldMinHeights .getOrDefault (world .getName (), getDefaultMinHeight (world ));
28- }
29-
30- try {
31- return (int ) GET_MIN_WORLD_HEIGHT .invoke (world );
32- } catch (Throwable t ) {
33- AnarchyExploitFixes .prefixedLogger ().error ("Error getting min world height from world '{}'." , world .getName (), t );
34- return AnarchyExploitFixes .config ().worldMinHeights .getOrDefault (world .getName (), getDefaultMinHeight (world ));
35- }
36- }
37-
38- private static int getDefaultMinHeight (World world ) {
39- return world .getEnvironment () == World .Environment .NORMAL
40- && Platform .getServerVersion ().isNewerThanOrEquals (ServerVersion .V_1_17 ) ? -64 : 0 ;
41- }
42-
4325 public static boolean isRespawnAnchorWorks (World world ) {
44- if (!RESPAWN_ANCHOR_WORKS_AVAILABLE ) {
45- return world .getEnvironment () != World .Environment .NORMAL ;
46- }
47-
48- try {
49- return (boolean ) RESPAWNANCHOR_WORKS .invoke (world );
50- } catch (Throwable t ) {
51- AnarchyExploitFixes .prefixedLogger ().error ("Error checking if respawn anchors work in world '{}'." , world .getName (), t );
52- return world .getEnvironment () != World .Environment .NORMAL ;
26+ if (RESPAWN_ANCHOR_WORKS_AVAILABLE ) {
27+ try {
28+ return (boolean ) RESPAWNANCHOR_WORKS .invoke (world );
29+ } catch (Throwable ignored ) {}
5330 }
31+ return world .getEnvironment () != World .Environment .NORMAL ;
5432 }
5533
5634 public static boolean isBedWorks (World world ) {
57- if (!BED_WORKS_AVAILABLE ) {
58- return world .getEnvironment () == World .Environment .NORMAL ;
35+ if (BED_WORKS_AVAILABLE ) {
36+ try {
37+ return (boolean ) BED_WORKS .invoke (world );
38+ } catch (Throwable ignored ) {}
5939 }
40+ return world .getEnvironment () == World .Environment .NORMAL ;
41+ }
6042
61- try {
62- return ( boolean ) BED_WORKS . invoke ( world );
63- } catch ( Throwable t ) {
64- AnarchyExploitFixes . prefixedLogger (). error ( "Error checking if beds work in world '{}'." , world . getName (), t );
65- return world . getEnvironment () == World . Environment . NORMAL ;
43+ public static int getMinWorldHeight ( World world ) {
44+ if ( GET_MIN_WORLD_HEIGHT_AVAILABLE ) {
45+ try {
46+ return ( int ) GET_MIN_WORLD_HEIGHT . invoke ( world );
47+ } catch ( Throwable ignored ) {}
6648 }
49+ return AnarchyExploitFixes .config ().worldMinHeights .getOrDefault (world .getName (), getDefaultMinHeight (world ));
50+ }
51+
52+ private static int getDefaultMinHeight (World world ) {
53+ return world .getEnvironment () == World .Environment .NORMAL
54+ && Platform .getServerVersion ().isNewerThanOrEquals (ServerVersion .V_1_17 ) ? -64 : 0 ;
6755 }
6856}
0 commit comments