@@ -22,47 +22,35 @@ public final class WorldUtil {
22
22
BED_WORKS = ReflectionUtil .findMethod (World .class , "isBedWorks" , boolean .class );
23
23
}
24
24
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
-
43
25
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 ) {}
53
30
}
31
+ return world .getEnvironment () != World .Environment .NORMAL ;
54
32
}
55
33
56
34
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 ) {}
59
39
}
40
+ return world .getEnvironment () == World .Environment .NORMAL ;
41
+ }
60
42
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 ) {}
66
48
}
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 ;
67
55
}
68
56
}
0 commit comments