diff --git a/bukkit/src/main/java/com/boydti/fawe/bukkit/listener/BrushListener.java b/bukkit/src/main/java/com/boydti/fawe/bukkit/listener/BrushListener.java index ae709da6..9e41c462 100644 --- a/bukkit/src/main/java/com/boydti/fawe/bukkit/listener/BrushListener.java +++ b/bukkit/src/main/java/com/boydti/fawe/bukkit/listener/BrushListener.java @@ -1,5 +1,6 @@ package com.boydti.fawe.bukkit.listener; +import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.object.brush.MovableTool; import com.boydti.fawe.object.brush.ResettableTool; @@ -46,12 +47,16 @@ public class BrushListener implements Listener { } ScrollTool scrollable = (ScrollTool) tool; if (scrollable.increment(player, ri)) { - final PlayerInventory inv = bukkitPlayer.getInventory(); - final ItemStack item = inv.getItem(slot); - final ItemStack newItem = inv.getItem(oldSlot); - inv.setItem(slot, newItem); - inv.setItem(oldSlot, item); - bukkitPlayer.updateInventory(); + if (Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES) { + bukkitPlayer.getInventory().setHeldItemSlot(oldSlot); + } else { + final PlayerInventory inv = bukkitPlayer.getInventory(); + final ItemStack item = inv.getItem(slot); + final ItemStack newItem = inv.getItem(oldSlot); + inv.setItem(slot, newItem); + inv.setItem(oldSlot, item); + bukkitPlayer.updateInventory(); + } } } } diff --git a/core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java b/core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java index ed810c51..36e26575 100644 --- a/core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java +++ b/core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java @@ -580,6 +580,9 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool if (mode == VisualMode.NONE) { return; } + BrushSettings current = getContext(); + Brush brush = current.getBrush(); + if (brush == null) return; FawePlayer fp = FawePlayer.wrap(player); EditSession editSession = new EditSessionBuilder(player.getWorld()) .player(fp) @@ -599,9 +602,8 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool break; } case OUTLINE: { - BrushSettings current = getContext(); new PatternTraverser(current).reset(editSession); - current.getBrush().build(editSession, position, current.getMaterial(), current.getSize()); + brush.build(editSession, position, current.getMaterial(), current.getSize()); break; } }