From 971ae0402017a9a0bee1c5597a448a4dd9ad9b00 Mon Sep 17 00:00:00 2001 From: Lilly Tempest <46890129+RainbowDashLabs@users.noreply.github.com> Date: Thu, 4 Nov 2021 21:29:40 +0100 Subject: [PATCH] Fix incompatibility between WorldEdit and FAWE for LocalSession#getTool (#1399) --- .../java/com/sk89q/worldedit/LocalSession.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index c7efa7cf3..e4ef0fa94 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -1120,6 +1120,24 @@ public class LocalSession implements TextureHolder { //FAWE end } + /** + * Get the tool assigned to the item. + * + * @param item the item type + * @return the tool, which may be {@code null} + * @deprecated This method is deprecated and only for compatibility with WorldEdit. Use {@link #getTool(BaseItem, Player)} + * instead. + */ + @Nullable + @Deprecated + public Tool getTool(ItemType item) { + //FAWE start + synchronized (this.tools) { + return tools.get(item.getInternalId()); + } + //FAWE end + } + //FAWE start @Nullable public Tool getTool(Player player) {