From 26e3e569889a3d5332c5f0a022e3df5859fc6ddb Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 11 Dec 2020 17:02:54 +0000 Subject: [PATCH] Don't allow blocks as brushes fixes #748 --- .../src/main/java/com/sk89q/worldedit/LocalSession.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 5094f4827..e215d5339 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -1066,13 +1066,13 @@ public class LocalSession implements TextureHolder { private transient boolean loadDefaults = true; public Tool getTool(BaseItem item, Player player) { + loadDefaults(player, false); if (Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES && item.getNativeItem() != null) { BrushTool tool = BrushCache.getTool(player, this, item); if (tool != null) { return tool; } } - loadDefaults(player, false); return getTool(item.getType()); } @@ -1122,6 +1122,9 @@ public class LocalSession implements TextureHolder { } public BrushTool getBrushTool(BaseItem item, Player player, boolean create) throws InvalidToolBindException { + if (item.getType().hasBlockType()) { + throw new InvalidToolBindException(item.getType(), "Blocks can't be used"); + } Tool tool = getTool(item, player); if (!(tool instanceof BrushTool)) { if (create) {