From 5d7f0b14189a29ec65ece4d90bff3fdd0f7d4d85 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 29 Jun 2017 01:01:44 +1000 Subject: [PATCH] save brushes globally --- .../sk89q/worldedit/command/BrushOptionsCommands.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java b/core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java index c8314465..66361d74 100644 --- a/core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java +++ b/core/src/main/java/com/sk89q/worldedit/command/BrushOptionsCommands.java @@ -56,17 +56,24 @@ public class BrushOptionsCommands extends MethodCommands { @Command( aliases = {"/savebrush"}, usage = "[name]", - desc = "Save your current brush", + desc = "Save your current brush\n" + + "prefix with ../ to save globally", min = 1 ) @CommandPermissions("worldedit.brush.save") public void saveBrush(Player player, LocalSession session, String name) throws WorldEditException, IOException { BrushTool tool = session.getBrushTool(player); if (tool != null) { + boolean root = name.startsWith("../"); name = FileSystems.getDefault().getPath(name).getFileName().toString(); File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes"); name = name.endsWith(".jsgz") ? name : name + ".jsgz"; - File file = new File(folder, player.getUniqueId() + File.separator + name); + File file; + if (root && player.hasPermission("worldedit.brush.save.other")) { + file = new File(folder, name); + } else { + file = new File(folder, player.getUniqueId() + File.separator + name); + } File parent = file.getParentFile(); if (!parent.exists()) { parent.mkdirs();