Skip to content

Commit 6efd533

Browse files
committed
initialize MaterialUtil lazily
1 parent 83bb720 commit 6efd533

51 files changed

Lines changed: 125 additions & 135 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/chunklimits/MinecartLimit.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ public void disable() {
5353
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
5454
private void onCreate(VehicleCreateEvent event) {
5555
Vehicle vehicle = event.getVehicle();
56-
if (!EntityUtil.MINECARTS.contains(vehicle.getType())) return;
56+
if (!EntityUtil.MINECARTS.get().contains(vehicle.getType())) return;
5757

5858
int minecartCount = 1;
5959
for (Entity entity : vehicle.getChunk().getEntities()) {
60-
if (!EntityUtil.MINECARTS.contains(entity.getType())) continue;
60+
if (!EntityUtil.MINECARTS.get().contains(entity.getType())) continue;
6161

6262
minecartCount++;
6363
if (minecartCount <= maxMinecartsPerChunk) continue;
@@ -85,7 +85,7 @@ public void accept(ScheduledTask task) {
8585
for (Entity entity : chunk.getEntities()) {
8686
entity.getScheduler().execute(plugin, () -> {
8787
if (
88-
!EntityUtil.MINECARTS.contains(entity.getType())
88+
!EntityUtil.MINECARTS.get().contains(entity.getType())
8989
|| minecartCount.incrementAndGet() <= maxMinecartsPerChunk
9090
) return;
9191

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/combat/Burrow.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,23 @@ private void onPlayerMove(PlayerMoveEvent event) {
102102
}
103103

104104
// Beacon and Indestructibles
105-
if (MaterialUtil.SOLID_INDESTRUCTIBLES.contains(burrowBlock.getType()) || burrowBlock.getType() == XMaterial.BEACON.get()) {
105+
if (MaterialUtil.SOLID_INDESTRUCTIBLES.get().contains(burrowBlock.getType()) || burrowBlock.getType() == XMaterial.BEACON.get()) {
106106
player.damage(damageWhenMovingInBurrow);
107107
if (shouldTeleportUp) teleportUpAndCenter(player, burrowBlock.getLocation());
108108
return;
109109
}
110110

111111
// Occluding blocks that do not lower the player into themselves
112-
if (burrowBlock.getType().isOccluding() && !MaterialUtil.SINK_IN_BLOCKS.contains(burrowBlock.getType())) {
113-
if (!allowSlabs || !MaterialUtil.SLAB_LIKE.contains(burrowBlock.getType())) {
112+
if (burrowBlock.getType().isOccluding() && !MaterialUtil.SINK_IN_BLOCKS.get().contains(burrowBlock.getType())) {
113+
if (!allowSlabs || !MaterialUtil.SLAB_LIKE.get().contains(burrowBlock.getType())) {
114114
player.damage(damageWhenMovingInBurrow);
115115
if (shouldTeleportUp) teleportUpAndCenter(player, burrowBlock.getLocation());
116116
}
117117
return;
118118
}
119119

120120
// Anvil
121-
if (MaterialUtil.ANVILS.contains(burrowBlock.getType())) {
121+
if (MaterialUtil.ANVILS.get().contains(burrowBlock.getType())) {
122122
player.damage(damageWhenMovingInBurrow);
123123
if (breakAnvilInsteadOfTP) {
124124
burrowBlock.setType(XMaterial.AIR.get());
@@ -129,7 +129,7 @@ private void onPlayerMove(PlayerMoveEvent event) {
129129
}
130130

131131
// Ender chest & Blocks that are slightly lower in height
132-
if (burrowBlock.getType() == XMaterial.ENDER_CHEST.get() || MaterialUtil.SINK_IN_BLOCKS.contains(burrowBlock.getType())) {
132+
if (burrowBlock.getType() == XMaterial.ENDER_CHEST.get() || MaterialUtil.SINK_IN_BLOCKS.get().contains(burrowBlock.getType())) {
133133
if (playerLocation.getY() - playerLocation.getBlockY() < 0.875) {
134134
player.damage(damageWhenMovingInBurrow);
135135
if (shouldTeleportUp) teleportUpAndCenter(player, burrowBlock.getLocation());

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/dupepreventions/BlockEntityDupe.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public BlockEntityDupe() {
3535

3636
if (config.getBoolean(configPath + ".carpets.prevent", true)) {
3737
boolean remove = config.getBoolean(configPath + ".carpets.delete", true);
38-
for (Material material : MaterialUtil.CARPETS) {
38+
for (Material material : MaterialUtil.CARPETS.get()) {
3939
materials.put(material, remove);
4040
}
4141
}
4242

4343
if (config.getBoolean(configPath + ".rails.prevent", true)) {
4444
boolean remove = config.getBoolean(configPath + ".rails.delete", true);
45-
for (Material material : MaterialUtil.RAILS) {
45+
for (Material material : MaterialUtil.RAILS.get()) {
4646
materials.put(material, remove);
4747
}
4848
}

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/IllegalItemModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private void onChunkLoad(ChunkLoadEvent event) {
145145
for (int z = 0; z < 16; z++) {
146146
for (int y = minY; y < maxY; y++) {
147147
Block block = chunk.getBlock(x, y, z);
148-
if (!MaterialUtil.INVENTORY_HOLDERS.contains(block.getType())) continue;
148+
if (!MaterialUtil.INVENTORY_HOLDERS.get().contains(block.getType())) continue;
149149

150150
if (removeContainers) {
151151
if (legalityOf(((InventoryHolder) block.getState()).getInventory()) != ItemLegality.LEGAL)

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/IllegalPotions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public IllegalPotions() {
2424

2525
@Override
2626
public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) {
27-
if (itemStack == null || !MaterialUtil.POTIONS.contains(itemStack.getType()) || !itemStack.hasItemMeta()) {
27+
if (itemStack == null || !MaterialUtil.POTIONS.get().contains(itemStack.getType()) || !itemStack.hasItemMeta()) {
2828
return ItemLegality.LEGAL;
2929
}
3030

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/PlayerHeads.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public PlayerHeads() {
2727
return ItemLegality.LEGAL;
2828
}
2929

30-
if (MaterialUtil.PLAYER_HEADS.contains(itemStack.getType())) {
30+
if (MaterialUtil.PLAYER_HEADS.get().contains(itemStack.getType())) {
3131
return ItemLegality.ILLEGAL;
3232
}
3333

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/enchantments/IncompatibleEnchants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public boolean shouldEnable() {
6161

6262
@Override
6363
public @NotNull ItemLegality legalityOf(@Nullable ItemStack itemStack) {
64-
if (itemStack == null || MaterialUtil.AIR.contains(itemStack.getType())) {
64+
if (itemStack == null || MaterialUtil.AIR.get().contains(itemStack.getType())) {
6565
return ItemLegality.LEGAL;
6666
}
6767

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/CommandItems.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public CommandItems() {
2828
return ItemLegality.LEGAL;
2929
}
3030

31-
if (!checkStored && MaterialUtil.INVENTORY_HOLDERS.contains(itemStack.getType())) {
31+
if (!checkStored && MaterialUtil.INVENTORY_HOLDERS.get().contains(itemStack.getType())) {
3232
return ItemLegality.LEGAL;
3333
}
3434

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/illegals/items/nbt/NBTFilledStorageItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public NBTFilledStorageItem() {
3535
this.stored_items_tag = config.getString(configPath + ".tag", "BlockEntityTag",
3636
"The exact name of the nbt tag that signals items are stored inside.");
3737
this.checkStored = config.getBoolean(configPath + ".check-stored-items", false);
38-
this.storageTypes = config.getList(configPath + ".storage-types", MaterialUtil.INVENTORY_HOLDERS.stream()
38+
this.storageTypes = config.getList(configPath + ".storage-types", MaterialUtil.INVENTORY_HOLDERS.get().stream()
3939
.filter(material -> !MaterialTags.SHULKER_BOXES.isTagged(material)).map(Enum::name).sorted().toList())
4040
.stream()
4141
.map(configuredType -> {

AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/lagpreventions/KeepStashLoaded.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public KeepStashLoaded() {
6363
this.onlyTileEntities = config.getBoolean(configPath + ".only-check-tile-entities", true, """
6464
Set to false if you want to check more blocks than just tile entities.\s
6565
Makes the overall speed of the module faster if set to true.""");
66-
this.storageTypes = config.getList(configPath + ".container-types", MaterialUtil.INVENTORY_HOLDERS
66+
this.storageTypes = config.getList(configPath + ".container-types", MaterialUtil.INVENTORY_HOLDERS.get()
6767
.stream()
6868
.map(Enum::name)
6969
.collect(Collectors.toList()))

0 commit comments

Comments
 (0)