Changed super pickaxe mode command to /sp.

This commit is contained in:
sk89q 2011-02-18 15:23:22 -08:00
parent b311b0b88a
commit 28941b86ba
4 changed files with 3 additions and 141 deletions

View File

@ -221,10 +221,10 @@ commands:
description: Toggle the super pickaxe pickaxe function
usage: /<command>
aliases: [',']
pickaxe:
superpickaxe:
description: Select super pickaxe mode
usage: /<command>
aliases: ['pa', 'spa']
aliases: ['pickaxe', 'sp']
mask:
description: Set the brush mask
usage: /<command> [mask]

View File

@ -1,67 +0,0 @@
// $Id$
/*
* WorldEdit
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.commands;
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.LocalPlayer;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.tools.Brush;
import com.sk89q.worldedit.tools.ReplacingBrush;
public class BrushModeCommands {
@Command(
aliases = {"normal", "s"},
usage = "",
desc = "Normal brush mode",
min = 0,
max = 0
)
@CommandPermissions({"worldedit.brush.mode.normal"})
public static void normal(CommandContext args, WorldEdit we,
LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException {
session.setRightClickMode(null);
session.setArmSwingMode(new Brush(true));
player.print("Normal brush mode set.");
}
@Command(
aliases = {"replace", "r"},
usage = "",
desc = "Replace existing blocks only",
min = 0,
max = 0
)
@CommandPermissions({"worldedit.brush.mode.replace"})
public static void replace(CommandContext args, WorldEdit we,
LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException {
session.setRightClickMode(null);
session.setArmSwingMode(new ReplacingBrush());
player.print("Replacing brush mode equipped.");
}
}

View File

@ -52,7 +52,7 @@ public class ToolUtilCommands {
}
@Command(
aliases = {"pickaxe", "pa", "spa"},
aliases = {"superpickaxe", "pickaxe", "sp"},
desc = "Select super pickaxe mode"
)
@NestedCommand({SuperPickaxeCommands.class})

View File

@ -1,71 +0,0 @@
// $Id$
/*
* WorldEdit
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.tools;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.bags.BlockBag;
import com.sk89q.worldedit.tools.brushes.BrushShape;
/**
* Builds a sphere at the place being looked at.
*
* @author sk89q
*/
public class ReplacingBrush implements Tool {
public boolean act(ServerInterface server, LocalConfiguration config,
LocalPlayer player, LocalSession session, WorldVector clicked) {
WorldVector target = player.getBlockTrace(500);
if (target == null) {
player.printError("No block in sight!");
return true;
}
BlockBag bag = session.getBlockBag(player);
BrushShape shape = session.getBrushShape();
if (shape == null) {
player.printError("Select a brush first.");
return true;
}
ReplacingExistingEditSession editSession =
new ReplacingExistingEditSession(server, target.getWorld(),
session.getBlockChangeLimit(), bag);
editSession.enableReplacing();
try {
shape.build(editSession, target);
} catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached.");
} finally {
if (bag != null) {
bag.flushChanges();
}
editSession.enableReplacing();
session.remember(editSession);
}
return true;
}
}