File tree Expand file tree Collapse file tree
shared/src/main/java/me/xginko/aef/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import de .tr7zw .changeme .nbtapi .NBT ;
44import de .tr7zw .changeme .nbtapi .iface .ReadableNBT ;
5+ import me .xginko .aef .utils .models .Lazy ;
56import org .bukkit .Material ;
67import org .bukkit .block .BlockState ;
78import org .bukkit .block .data .Waterlogged ;
@@ -23,10 +24,10 @@ public static boolean isWaterloggedAvailable() {
2324 return WATERLOGGED_AVAILABLE ;
2425 }
2526
26- private static final Map <Material , Boolean > IS_WATERLOGGABLE_CACHE = new EnumMap <>(Material .class );
27+ private static final Lazy < Map <Material , Boolean >> IS_WATERLOGGABLE_CACHE = Lazy . of (() -> new EnumMap <>(Material .class ) );
2728 public static boolean isWaterlogged (@ Nullable BlockState blockState ) {
2829 return blockState != null
29- && IS_WATERLOGGABLE_CACHE .computeIfAbsent (blockState .getType (), k -> blockState .getBlockData () instanceof Waterlogged )
30+ && IS_WATERLOGGABLE_CACHE .get (). computeIfAbsent (blockState .getType (), k -> blockState .getBlockData () instanceof Waterlogged )
3031 && ((Waterlogged ) blockState .getBlockData ()).isWaterlogged ();
3132 }
3233
You can’t perform that action at this time.
0 commit comments