diff --git a/core/src/main/java/com/boydti/fawe/object/brush/CommandBrush.java b/core/src/main/java/com/boydti/fawe/object/brush/CommandBrush.java index 8b48b2c9..af05b651 100644 --- a/core/src/main/java/com/boydti/fawe/object/brush/CommandBrush.java +++ b/core/src/main/java/com/boydti/fawe/object/brush/CommandBrush.java @@ -20,12 +20,10 @@ import com.sk89q.worldedit.util.Location; public class CommandBrush implements Brush { private final String command; - private final Player player; private final int radius; private final BrushTool tool; - public CommandBrush(Player player, BrushTool tool, String command, double radius) { - this.player = player; + public CommandBrush(BrushTool tool, String command, double radius) { this.command = command; this.radius = (int) radius; this.tool = tool; @@ -40,13 +38,14 @@ public class CommandBrush implements Brush { .replace("{world}", editSession.getQueue().getWorldName()) .replace("{size}", radius + ""); + FawePlayer fp = editSession.getPlayer(); + Player player = fp.getPlayer(); WorldVectorFace face = player.getBlockTraceFace(256, true); if (face == null) { position = position.add(0, 1, 1); } else { position = face.getFaceVector(); } - FawePlayer fp = FawePlayer.wrap(player); fp.setSelection(selector); PlayerWrapper wePlayer = new SilentPlayerWrapper(new LocationMaskedPlayerWrapper(player, new Location(player.getExtent(), position))); String[] cmds = replaced.split(";"); diff --git a/core/src/main/java/com/boydti/fawe/object/brush/CopyPastaBrush.java b/core/src/main/java/com/boydti/fawe/object/brush/CopyPastaBrush.java index 9accc6bd..258c2742 100644 --- a/core/src/main/java/com/boydti/fawe/object/brush/CopyPastaBrush.java +++ b/core/src/main/java/com/boydti/fawe/object/brush/CopyPastaBrush.java @@ -1,6 +1,7 @@ package com.boydti.fawe.object.brush; import com.boydti.fawe.config.BBC; +import com.boydti.fawe.object.FawePlayer; import com.boydti.fawe.object.clipboard.ResizableClipboardBuilder; import com.boydti.fawe.object.exception.FaweException; import com.boydti.fawe.object.function.NullRegionFunction; @@ -11,7 +12,6 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Masks; @@ -25,17 +25,15 @@ import com.sk89q.worldedit.session.ClipboardHolder; public class CopyPastaBrush implements DoubleActionBrush { private final DoubleActionBrushTool tool; - private final LocalSession session; - private final Player player; - public CopyPastaBrush(Player player, LocalSession session, DoubleActionBrushTool tool) { + public CopyPastaBrush(DoubleActionBrushTool tool) { this.tool = tool; - this.session = session; - this.player = player; } @Override public void build(DoubleActionBrushTool.BrushAction action, final EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { + FawePlayer fp = editSession.getPlayer(); + LocalSession session = fp.getSession(); switch (action) { case SECONDARY: { Mask mask = tool.getMask(); @@ -74,7 +72,7 @@ public class CopyPastaBrush implements DoubleActionBrush { ClipboardHolder holder = new ClipboardHolder(clipboard, editSession.getWorld().getWorldData()); session.setClipboard(holder); int blocks = builder.size(); - player.print(BBC.getPrefix() + BBC.COMMAND_COPY.format(blocks)); + BBC.COMMAND_COPY.send(fp, blocks); return; } case PRIMARY: { @@ -90,7 +88,7 @@ public class CopyPastaBrush implements DoubleActionBrush { .build(); Operations.completeLegacy(operation); } catch (EmptyClipboardException e) { - player.print(BBC.getPrefix() + BBC.BRUSH_PASTE_NONE.s()); + BBC.BRUSH_PASTE_NONE.send(fp); } } } diff --git a/core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java b/core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java index 6533053a..52a8de1f 100644 --- a/core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java +++ b/core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java @@ -22,6 +22,10 @@ public final class Masks { private Masks() { } + public static boolean isNull(Mask mask) { + return mask == null || mask == ALWAYS_TRUE; + } + /** * Return a 3D mask that always returns true; *