From 01be53ed655364f9573b05a52eb26c89a5e9b974 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 19 Jun 2023 15:36:47 +0200 Subject: [PATCH] fix: add missing BlockType constructor (#2306) - Deprecate public BlockType constructors - People really should not be initialising their own block types. This can and most likely will cause issues. - Fixes #2290 --- .../worldedit/world/block/BlockType.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 01a5d5c8a..e5a466e29 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -78,13 +78,35 @@ public class BlockType implements Keyed, Pattern { this.id = i == -1 ? id : id.substring(0, i); this.settings = new BlockTypesCache.Settings(this, id, internalId, states); } + //FAWE end + //FAWE start + /** + * @deprecated You should not be initialising your own BlockTypes, use {@link BlockTypes#get(String)} instead. If there is + * a specific requirement to actually create new block types, please contact the FAWE devs to discuss. Use + * {@link BlockTypes#get(String)} instead. + */ + @Deprecated(since = "TODO") + //FAWE end + public BlockType(String id) { + this(id, null); + } + + //FAWE start + /** + * @deprecated You should not be initialising your own BlockTypes, use {@link BlockTypes#get(String)} instead. If there is + * a specific requirement to actually create new block types, please contact the FAWE devs to discuss. Use + * {@link BlockTypes#get(String)} instead. + */ + @Deprecated(since = "TODO") + //FAWE end public BlockType(String id, Function values) { // If it has no namespace, assume minecraft. if (!id.contains(":")) { id = "minecraft:" + id; } this.id = id; + //FAWE start //TODO fix the line below this.settings = new BlockTypesCache.Settings(this, id, 0, null); }