9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2026-01-04 15:41:38 +00:00

添加指定特定方块作为bukkit material的选项

This commit is contained in:
XiaoMoMi
2025-10-12 16:34:54 +08:00
parent 6d119763b8
commit 48bb0bb3f0
4 changed files with 22 additions and 2 deletions

View File

@@ -417,9 +417,20 @@ public final class BukkitBlockManager extends AbstractBlockManager {
@SuppressWarnings("unchecked")
private void deceiveBukkitRegistry() {
try {
Material material;
try {
material = Material.valueOf(Config.deceiveBukkitMaterial().value().toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
this.plugin.logger().warn(Config.deceiveBukkitMaterial() + " is not a valid material", e);
material = Material.STONE;
}
if (!material.isBlock()) {
this.plugin.logger().warn(Config.deceiveBukkitMaterial() + " is not a valid bukkit block material");
material = Material.STONE;
}
Map<Object, Material> magicMap = (Map<Object, Material>) CraftBukkitReflections.field$CraftMagicNumbers$BLOCK_MATERIAL.get(null);
for (DelegatingBlock customBlock : this.customBlocks) {
magicMap.put(customBlock, Material.STONE);
magicMap.put(customBlock, material);
}
} catch (ReflectiveOperationException e) {
this.plugin.logger().warn("Failed to deceive bukkit magic blocks", e);