diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java index d518da511..9072ef36c 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/VoxelSniper.java @@ -15,9 +15,17 @@ import org.bukkit.plugin.java.JavaPlugin; */ public class VoxelSniper extends JavaPlugin { private static VoxelSniper instance; - private SniperManager sniperManager = new SniperManager(this); private final VoxelSniperListener voxelSniperListener = new VoxelSniperListener(this); + private SniperManager sniperManager = new SniperManager(this); private VoxelSniperConfiguration voxelSniperConfiguration; + private Brushes brushManager = new Brushes(); + + /** + * @return {@link VoxelSniper} + */ + public static VoxelSniper getInstance() { + return VoxelSniper.instance; + } /** * Returns {@link com.thevoxelbox.voxelsniper.Brushes} for current instance. @@ -28,15 +36,6 @@ public class VoxelSniper extends JavaPlugin { return brushManager; } - private Brushes brushManager = new Brushes(); - - /** - * @return {@link VoxelSniper} - */ - public static VoxelSniper getInstance() { - return VoxelSniper.instance; - } - /** * Returns object for accessing global VoxelSniper options. * @@ -67,7 +66,7 @@ public class VoxelSniper extends JavaPlugin { return voxelSniperListener.onCommand((Player) sender, arguments, command.getName()); } - getLogger().info("Only Players can execute commands."); + getLogger().info("Only players can execute VoxelSniper commands."); return true; } diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelUndoCommand.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelUndoCommand.java index 6a71efa71..ad7601a75 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelUndoCommand.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/command/VoxelUndoCommand.java @@ -1,5 +1,6 @@ package com.thevoxelbox.voxelsniper.command; +import com.boydti.fawe.config.BBC; import com.thevoxelbox.voxelsniper.Sniper; import com.thevoxelbox.voxelsniper.VoxelSniper; import com.thevoxelbox.voxelsniper.api.command.VoxelCommand; @@ -21,12 +22,12 @@ public class VoxelUndoCommand extends VoxelCommand { int amount = Integer.parseInt(args[0]); sniper.undo(amount); } catch (NumberFormatException exception) { - player.sendMessage("Error while parsing amount of undo. Number format exception."); + player.sendMessage(BBC.getPrefix() + "Number expected; string given."); } } else { sniper.undo(); } - plugin.getLogger().info("Player \"" + player.getName() + "\" used /u"); +// plugin.getLogger().info("Player \"" + player.getName() + "\" used /u"); return true; } } 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 deleted file mode 100644 index 8f8de97d2..000000000 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.command; - -import com.boydti.fawe.config.BBC; -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.entity.Player; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * General WorldEdit commands. - */ -public class GeneralCommands { - - private final WorldEdit worldEdit; - - /** - * Create a new instance. - * - * @param worldEdit reference to WorldEdit - */ - public GeneralCommands(WorldEdit worldEdit) { - checkNotNull(worldEdit); - this.worldEdit = worldEdit; - } - - @Command( - aliases = { "/limit" }, - usage = "[limit]", - desc = "Modify block change limit", - min = 0, - max = 1 - ) - @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"); - - int limit = args.argsLength() == 0 ? config.defaultChangeLimit : Math.max(-1, args.getInteger(0)); - if (!mayDisable && config.maxChangeLimit > -1) { - if (limit > config.maxChangeLimit) { - player.printError(BBC.getPrefix() + "Your maximum allowable limit is " + config.maxChangeLimit + "."); - return; - } - } - - session.setBlockChangeLimit(limit); - - if (limit != config.defaultChangeLimit) { - player.print(BBC.getPrefix() + "Block change limit set to " + limit + ". (Use //limit to go back to the default.)"); - } else { - player.print(BBC.getPrefix() + "Block change limit set to " + limit + "."); - } - } - - @Command( - aliases = { "/timeout" }, - usage = "[time]", - desc = "Modify evaluation timeout time.", - min = 0, - max = 1 - ) - @CommandPermissions("worldedit.timeout") - public void timeout(Player player, LocalSession session, CommandContext args) throws WorldEditException { - - LocalConfiguration config = worldEdit.getConfiguration(); - boolean mayDisable = player.hasPermission("worldedit.timeout.unrestricted"); - - int limit = args.argsLength() == 0 ? config.calculationTimeout : Math.max(-1, args.getInteger(0)); - if (!mayDisable && config.maxCalculationTimeout > -1) { - if (limit > config.maxCalculationTimeout) { - player.printError(BBC.getPrefix() + "Your maximum allowable timeout is " + config.maxCalculationTimeout + " ms."); - return; - } - } - - session.setTimeout(limit); - - if (limit != config.calculationTimeout) { - player.print(BBC.getPrefix() + "Timeout time set to " + limit + " ms. (Use //timeout to go back to the default.)"); - } else { - player.print(BBC.getPrefix() + "Timeout time set to " + limit + " ms."); - } - } - - @Command( - aliases = { "/drawsel" }, - usage = "[on|off]", - desc = "Toggle drawing the current selection", - min = 0, - max = 1 - ) - @CommandPermissions("worldedit.drawsel") - public void drawSelection(Player player, LocalSession session, CommandContext args) throws WorldEditException { - - if (!WorldEdit.getInstance().getConfiguration().serverSideCUI) { - throw new DisallowedUsageException("This functionality is disabled in the configuration!"); - } - String newState = args.getString(0, null); - if (session.shouldUseServerCUI()) { - if ("on".equals(newState)) { - player.printError(BBC.getPrefix() + "Server CUI already enabled."); - return; - } - - session.setUseServerCUI(false); - session.updateServerCUI(player); - player.print("Server CUI disabled."); - } else { - if ("off".equals(newState)) { - player.printError(BBC.getPrefix() + "Server CUI already disabled."); - return; - } - - session.setUseServerCUI(true); - session.updateServerCUI(player); - player.print("Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32."); - } - } - -} 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 efde0d097..f2454cff2 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 @@ -10,6 +10,7 @@ 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.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.entity.Player; @@ -239,6 +240,71 @@ public class OptionsCommands { } } + @Command( + aliases = { "/timeout" }, + usage = "[time]", + desc = "Modify evaluation timeout time.", + min = 0, + max = 1 + ) + @CommandPermissions("worldedit.timeout") + public void timeout(Player player, LocalSession session, CommandContext args) throws WorldEditException { + + LocalConfiguration config = worldEdit.getConfiguration(); + boolean mayDisable = player.hasPermission("worldedit.timeout.unrestricted"); + + int limit = args.argsLength() == 0 ? config.calculationTimeout : Math.max(-1, args.getInteger(0)); + if (!mayDisable && config.maxCalculationTimeout > -1) { + if (limit > config.maxCalculationTimeout) { + player.printError(BBC.getPrefix() + "Your maximum allowable timeout is " + config.maxCalculationTimeout + " ms."); + return; + } + } + + session.setTimeout(limit); + + if (limit != config.calculationTimeout) { + player.print(BBC.getPrefix() + "Timeout time set to " + limit + " ms. (Use //timeout to go back to the default.)"); + } else { + player.print(BBC.getPrefix() + "Timeout time set to " + limit + " ms."); + } + } + + @Command( + aliases = { "/drawsel" }, + usage = "[on|off]", + desc = "Toggle drawing the current selection", + min = 0, + max = 1 + ) + @CommandPermissions("worldedit.drawsel") + public void drawSelection(Player player, LocalSession session, CommandContext args) throws WorldEditException { + + if (!WorldEdit.getInstance().getConfiguration().serverSideCUI) { + throw new DisallowedUsageException(BBC.getPrefix() + "This functionality is disabled in the configuration!"); + } + String newState = args.getString(0, null); + if (session.shouldUseServerCUI()) { + if ("on".equals(newState)) { + player.printError(BBC.getPrefix() + "Server CUI already enabled."); + return; + } + + session.setUseServerCUI(false); + session.updateServerCUI(player); + player.print(BBC.getPrefix() + "Server CUI disabled."); + } else { + if ("off".equals(newState)) { + player.printError(BBC.getPrefix() + "Server CUI already disabled."); + return; + } + + session.setUseServerCUI(true); + session.updateServerCUI(player); + player.print(BBC.getPrefix() + "Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32."); + } + } + @Command( aliases = {"/searchitem", "/l", "/search", "searchitem"}, usage = "", diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java index fbb4fb163..90871c4c1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/util/DocumentationPrinter.java @@ -64,7 +64,6 @@ public final class DocumentationPrinter { classes.add(BiomeCommands.class); classes.add(ChunkCommands.class); classes.add(ClipboardCommands.class); - classes.add(GeneralCommands.class); classes.add(GenerationCommands.class); classes.add(HistoryCommands.class); classes.add(NavigationCommands.class);