From 20cb11435734f495e1e5e7bf93f40bfda86adf20 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 13 Apr 2019 20:45:04 +0200 Subject: [PATCH] Reorder commands --- .../worldedit/command/GeneralCommands.java | 143 +----------------- .../worldedit/command/OptionsCommands.java | 5 +- .../worldedit/command/WorldEditCommands.java | 25 --- 3 files changed, 2 insertions(+), 171 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index 954281c67..8f8de97d2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -20,18 +20,12 @@ package com.sk89q.worldedit.command; import com.boydti.fawe.config.BBC; -import com.google.common.collect.Sets; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.worldedit.*; import com.sk89q.worldedit.extension.input.DisallowedUsageException; -import com.sk89q.worldedit.world.item.ItemType; -import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.entity.Player; -import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.function.mask.Mask; -import com.sk89q.worldedit.util.command.parametric.Optional; import static com.google.common.base.Preconditions.checkNotNull; @@ -61,7 +55,7 @@ public class GeneralCommands { ) @CommandPermissions("worldedit.limit") public void limit(Player player, LocalSession session, CommandContext args) throws WorldEditException { - + LocalConfiguration config = worldEdit.getConfiguration(); boolean mayDisable = player.hasPermission("worldedit.limit.unrestricted"); @@ -112,36 +106,6 @@ public class GeneralCommands { } } - @Command( - aliases = { "/fast" }, - usage = "[on|off]", - desc = "Toggle fast mode", - min = 0, - max = 1 - ) - @CommandPermissions("worldedit.fast") - public void fast(Player player, LocalSession session, CommandContext args) throws WorldEditException { - - String newState = args.getString(0, null); - if (session.hasFastMode()) { - if ("on".equals(newState)) { - player.printError(BBC.getPrefix() + "Fast mode already enabled."); - return; - } - - session.setFastMode(false); - player.print("Fast mode disabled."); - } else { - if ("off".equals(newState)) { - player.printError(BBC.getPrefix() + "Fast mode already disabled."); - return; - } - - session.setFastMode(true); - player.print("Fast mode enabled. Lighting in the affected chunks may be wrong and/or you may need to rejoin to see changes."); - } - } - @Command( aliases = { "/drawsel" }, usage = "[on|off]", @@ -177,109 +141,4 @@ public class GeneralCommands { } } - @Command( - aliases = { "/gmask", "gmask" }, - usage = "[mask]", - desc = "Set the global mask", - min = 0, - max = -1 - ) - @CommandPermissions("worldedit.global-mask") - public void gmask(Player player, LocalSession session, @Optional Mask mask) throws WorldEditException { - if (mask == null) { - session.setMask((Mask) null); - player.print("Global mask disabled."); - } else { - session.setMask(mask); - player.print("Global mask set."); - } - } - - @Command( - aliases = { "/toggleplace", "toggleplace" }, - usage = "", - desc = "Switch between your position and pos1 for placement", - min = 0, - max = 0 - ) - public void togglePlace(Player player, LocalSession session) throws WorldEditException { - - if (session.togglePlacementPosition()) { - player.print("Now placing at pos #1."); - } else { - player.print("Now placing at the block you stand in."); - } - } - - @Command( - aliases = { "/searchitem", "/l", "/search", "searchitem" }, - usage = "", - flags = "bi", - desc = "Search for an item", - help = - "Searches for an item.\n" + - "Flags:\n" + - " -b only search for blocks\n" + - " -i only search for items", - min = 1, - max = 1 - ) - public void searchItem(Actor actor, CommandContext args) throws WorldEditException { - - String query = args.getString(0).trim().toLowerCase(); - boolean blocksOnly = args.hasFlag('b'); - boolean itemsOnly = args.hasFlag('i'); - - ItemType type = ItemTypes.get(query); - - if (type != null) { - actor.print(type.getId() + " (" + type.getName() + ")"); - } else { - if (query.length() <= 2) { - actor.printError(BBC.getPrefix() + "Enter a longer search string (len > 2)."); - return; - } - - if (!blocksOnly && !itemsOnly) { - actor.print(BBC.getPrefix() + "Searching for: " + query); - } else if (blocksOnly && itemsOnly) { - actor.printError(BBC.getPrefix() + "You cannot use both the 'b' and 'i' flags simultaneously."); - return; - } else if (blocksOnly) { - actor.print(BBC.getPrefix() + "Searching for blocks: " + query); - } else { - actor.print(BBC.getPrefix() + "Searching for items: " + query); - } - - int found = 0; - - for (ItemType searchType : ItemType.REGISTRY) { - if (found >= 15) { - actor.print(BBC.getPrefix() + "Too many results!"); - break; - } - - if (blocksOnly && !searchType.hasBlockType()) { - continue; - } - - if (itemsOnly && searchType.hasBlockType()) { - continue; - } - - for (String alias : Sets.newHashSet(searchType.getId(), searchType.getName())) { - if (alias.contains(query)) { - actor.print(BBC.getPrefix() + searchType.getId() + " (" + searchType.getName() + ")"); - ++found; - break; - } - } - } - - if (found == 0) { - actor.printError(BBC.getPrefix() + "No items found."); - } - } - } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/OptionsCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/OptionsCommands.java index cefd48a4a..efde0d097 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/OptionsCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/OptionsCommands.java @@ -9,10 +9,7 @@ import com.google.common.collect.Sets; import com.sk89q.minecraft.util.commands.Command; import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandPermissions; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.*; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.entity.Player; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java index 2d0310cd2..f2e07ffff 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/WorldEditCommands.java @@ -116,31 +116,6 @@ public class WorldEditCommands { actor.print(BBC.getPrefix() + "Reloaded WorldEdit " + we.getVersion() + " and FAWE (" + Fawe.get().getVersion() + ")"); } -// @Command(aliases = {"report"}, desc = "Writes a report on WorldEdit", flags = "p", max = 0) -// @CommandPermissions({"worldedit.report"}) -// public void report(Actor actor, CommandContext args) throws WorldEditException { -// ReportList report = new ReportList("Report"); -// report.add(new SystemInfoReport()); -// report.add(new ConfigReport()); -// String result = report.toString(); -// -// try { -// File dest = new File(we.getWorkingDirectoryFile(we.getConfiguration().saveDir), "report.txt"); -// Files.write(result, dest, Charset.forName("UTF-8")); -// actor.print("WorldEdit report written to " + dest.getAbsolutePath()); -// } catch (IOException e) { -// actor.printError("Failed to write report: " + e.getMessage()); -// } -// -// if (args.hasFlag('p')) { -// actor.checkPermission("worldedit.report.pastebin"); -// ActorCallbackPaste.pastebin( -// we.getSupervisor(), actor, result, "WorldEdit report: %s.report", -// WorldEdit.getInstance().getPlatformManager().getCommandManager().getExceptionConverter() -// ); -// } -// } - @Command( aliases = {"debugpaste"}, usage = "",