forked from SteamWar/SteamWar
Cleanup BauSystem
This commit is contained in:
@@ -19,16 +19,32 @@
|
||||
|
||||
package de.steamwar.bausystem.utils;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.core.VersionDependent;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public interface PlaceItemWrapper {
|
||||
Map<Material, Material> ITEM_MATERIAL_TO_BLOCK_MATERIAL = new HashMap<>();
|
||||
Map<Material, Material> BLOCK_MATERIAL_TO_WALL_BLOCK_MATERIAL = new HashMap<>();
|
||||
@UtilityClass
|
||||
public class PlaceItemWrapper {
|
||||
public static final Map<Material, Material> ITEM_MATERIAL_TO_BLOCK_MATERIAL = new HashMap<>();
|
||||
public static final Map<Material, Material> BLOCK_MATERIAL_TO_WALL_BLOCK_MATERIAL = new HashMap<>();
|
||||
|
||||
PlaceItemWrapper impl = VersionDependent.getVersionImpl(BauSystem.getInstance());
|
||||
static {
|
||||
for (Material material : Material.values()) {
|
||||
if (!material.isBlock()) continue;
|
||||
if (material.isLegacy()) continue;
|
||||
BlockData blockData = material.createBlockData();
|
||||
Material placementMaterial = blockData.getPlacementMaterial();
|
||||
if (material == placementMaterial) continue;
|
||||
if (placementMaterial == Material.AIR) continue;
|
||||
if (placementMaterial.isItem() && !placementMaterial.isBlock()) {
|
||||
ITEM_MATERIAL_TO_BLOCK_MATERIAL.put(placementMaterial, material);
|
||||
}
|
||||
if (material.name().contains("WALL")) {
|
||||
BLOCK_MATERIAL_TO_WALL_BLOCK_MATERIAL.put(placementMaterial, material);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user