mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 04:46:40 +00:00
Overhauled the tool system. All tools can now be bound to any held item so you can have multiple tools out a time. New masks framework allows making a filter of blocks to change. Brushes are now powerful as well.
This commit is contained in:
@ -30,28 +30,29 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.superpickaxe.brushes.ClipboardBrushShape;
|
||||
import com.sk89q.worldedit.superpickaxe.brushes.CylinderBrushShape;
|
||||
import com.sk89q.worldedit.superpickaxe.brushes.HollowCylinderBrushShape;
|
||||
import com.sk89q.worldedit.superpickaxe.brushes.SphereBrushShape;
|
||||
import com.sk89q.worldedit.superpickaxe.brushes.HollowSphereBrushShape;
|
||||
import com.sk89q.worldedit.patterns.Pattern;
|
||||
import com.sk89q.worldedit.tools.Brush;
|
||||
import com.sk89q.worldedit.tools.brushes.ClipboardBrush;
|
||||
import com.sk89q.worldedit.tools.brushes.CylinderBrush;
|
||||
import com.sk89q.worldedit.tools.brushes.HollowCylinderBrush;
|
||||
import com.sk89q.worldedit.tools.brushes.HollowSphereBrush;
|
||||
import com.sk89q.worldedit.tools.brushes.SphereBrush;
|
||||
|
||||
/**
|
||||
* Brush shape commands.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class BrushShapeCommands {
|
||||
public class BrushCommands {
|
||||
@Command(
|
||||
aliases = {"/sb", "/sphereb"},
|
||||
aliases = {"sphere", "s"},
|
||||
usage = "<block> [radius]",
|
||||
flags = "h",
|
||||
desc = "Choose the sphere brush",
|
||||
min = 1,
|
||||
max = 2
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.drawing.brush.sphere"})
|
||||
@CommandPermissions({"worldedit.brush.sphere"})
|
||||
public static void sphereBrush(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
@ -64,27 +65,31 @@ public class BrushShapeCommands {
|
||||
+ config.maxBrushRadius);
|
||||
return;
|
||||
}
|
||||
|
||||
BaseBlock targetBlock = we.getBlock(player, args.getString(0));
|
||||
|
||||
Brush tool = session.getBrushTool(player.getItemInHand());
|
||||
Pattern fill = we.getBlockPattern(player, args.getString(0));
|
||||
tool.setFill(fill);
|
||||
tool.setSize(radius);
|
||||
|
||||
if (args.hasFlag('h')) {
|
||||
session.setBrushShape(new HollowSphereBrushShape(targetBlock, radius));
|
||||
tool.setBrush(new HollowSphereBrush());
|
||||
} else {
|
||||
session.setBrushShape(new SphereBrushShape(targetBlock, radius));
|
||||
tool.setBrush(new SphereBrush());
|
||||
}
|
||||
|
||||
player.print("Sphere brush shape equipped.");
|
||||
|
||||
player.print(String.format("Sphere brush shape equipped (%d).",
|
||||
radius));
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"/cb", "/cylb"},
|
||||
aliases = {"cylinder", "cyl", "c"},
|
||||
usage = "<block> [radius] [height]",
|
||||
flags = "h",
|
||||
desc = "Choose the cylinder brush",
|
||||
min = 1,
|
||||
max = 2
|
||||
max = 3
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.drawing.brush.cylinder"})
|
||||
@CommandPermissions({"worldedit.brush.cylinder"})
|
||||
public static void cylinderBrush(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
@ -98,33 +103,37 @@ public class BrushShapeCommands {
|
||||
return;
|
||||
}
|
||||
|
||||
int height = args.argsLength() > 1 ? args.getInteger(1) : 1;
|
||||
int height = args.argsLength() > 2 ? args.getInteger(2) : 1;
|
||||
if (height > config.maxBrushRadius) {
|
||||
player.printError("Maximum allowed brush radius/height: "
|
||||
+ config.maxBrushRadius);
|
||||
return;
|
||||
}
|
||||
|
||||
BaseBlock targetBlock = we.getBlock(player, args.getString(0));
|
||||
|
||||
Brush tool = session.getBrushTool(player.getItemInHand());
|
||||
Pattern fill = we.getBlockPattern(player, args.getString(0));
|
||||
tool.setFill(fill);
|
||||
tool.setSize(radius);
|
||||
|
||||
if (args.hasFlag('h')) {
|
||||
session.setBrushShape(new HollowCylinderBrushShape(targetBlock, radius, height));
|
||||
tool.setBrush(new HollowCylinderBrush(height));
|
||||
} else {
|
||||
session.setBrushShape(new CylinderBrushShape(targetBlock, radius, height));
|
||||
tool.setBrush(new CylinderBrush(height));
|
||||
}
|
||||
|
||||
player.print("Cylinder brush shape equipped.");
|
||||
player.print(String.format("Cylinder brush shape equipped (%d by %d).",
|
||||
radius, height));
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"/cbb", "/copyb"},
|
||||
aliases = {"clipboard", "copy"},
|
||||
usage = "",
|
||||
flags = "a",
|
||||
desc = "Choose the clipboard brush",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.drawing.brush.clipboard"})
|
||||
@CommandPermissions({"worldedit.brush.clipboard"})
|
||||
public static void clipboardBrush(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
@ -147,8 +156,9 @@ public class BrushShapeCommands {
|
||||
+ config.maxBrushRadius);
|
||||
return;
|
||||
}
|
||||
|
||||
session.setBrushShape(new ClipboardBrushShape(clipboard, args.hasFlag('a')));
|
||||
|
||||
Brush tool = session.getBrushTool(player.getItemInHand());
|
||||
tool.setBrush(new ClipboardBrush(clipboard, args.hasFlag('a')));
|
||||
|
||||
player.print("Clipboard brush shape equipped.");
|
||||
}
|
67
src/com/sk89q/worldedit/commands/BrushModeCommands.java
Normal file
67
src/com/sk89q/worldedit/commands/BrushModeCommands.java
Normal file
@ -0,0 +1,67 @@
|
||||
// $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.");
|
||||
}
|
||||
}
|
@ -23,7 +23,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.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.patterns.Pattern;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
|
||||
/**
|
||||
@ -44,7 +44,7 @@ public class GenerationCommands {
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
BaseBlock block = we.getBlock(player, args.getString(0));
|
||||
Pattern block = we.getBlockPattern(player, args.getString(0));
|
||||
int radius = Math.max(1, args.getInteger(1));
|
||||
int height = args.argsLength() > 2 ? args.getInteger(2) : 1;
|
||||
|
||||
@ -65,7 +65,7 @@ public class GenerationCommands {
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
BaseBlock block = we.getBlock(player, args.getString(0));
|
||||
Pattern block = we.getBlockPattern(player, args.getString(0));
|
||||
int radius = Math.max(1, args.getInteger(1));
|
||||
int height = args.argsLength() > 2 ? args.getInteger(2) : 1;
|
||||
|
||||
@ -86,7 +86,7 @@ public class GenerationCommands {
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
BaseBlock block = we.getBlock(player, args.getString(0));
|
||||
Pattern block = we.getBlockPattern(player, args.getString(0));
|
||||
int radius = Math.max(1, args.getInteger(1));
|
||||
boolean raised = args.argsLength() > 2
|
||||
? (args.getString(2).equalsIgnoreCase("true")
|
||||
@ -115,7 +115,7 @@ public class GenerationCommands {
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
BaseBlock block = we.getBlock(player, args.getString(0));
|
||||
Pattern block = we.getBlockPattern(player, args.getString(0));
|
||||
int radius = Math.max(1, args.getInteger(1));
|
||||
boolean raised = args.argsLength() > 2
|
||||
? (args.getString(2).equalsIgnoreCase("true")
|
||||
|
@ -25,8 +25,8 @@ import com.sk89q.minecraft.util.commands.CommandContext;
|
||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.filters.GaussianKernel;
|
||||
import com.sk89q.worldedit.filters.HeightMapFilter;
|
||||
import com.sk89q.worldedit.filtering.GaussianKernel;
|
||||
import com.sk89q.worldedit.filtering.HeightMapFilter;
|
||||
import com.sk89q.worldedit.patterns.*;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldEdit
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
* 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
|
||||
@ -22,37 +22,17 @@ 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.minecraft.util.commands.NestedCommand;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.superpickaxe.*;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
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.AreaPickaxe;
|
||||
import com.sk89q.worldedit.tools.RecursivePickaxe;
|
||||
import com.sk89q.worldedit.tools.SinglePickaxe;
|
||||
|
||||
/**
|
||||
* Super pickaxe commands.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class SuperPickaxeCommands {
|
||||
@Command(
|
||||
aliases = {"/", ","},
|
||||
usage = "",
|
||||
desc = "Toggle the super pickaxe pickaxe function",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.pickaxe"})
|
||||
public static void togglePickaxe(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
if (session.toggleSuperPickAxe()) {
|
||||
player.print("Super pick axe enabled.");
|
||||
} else {
|
||||
player.print("Super pick axe disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
public class SuperPickaxeCommands {
|
||||
@Command(
|
||||
aliases = {"single"},
|
||||
usage = "",
|
||||
@ -60,12 +40,12 @@ public class SuperPickaxeCommands {
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.pickaxe"})
|
||||
@CommandPermissions({"worldedit.superpickaxe"})
|
||||
public static void single(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
session.setLeftClickMode(new SinglePickaxe());
|
||||
session.setSuperPickaxe(new SinglePickaxe());
|
||||
session.enableSuperPickAxe();
|
||||
player.print("Mode changed. Left click with a pickaxe. // to disable.");
|
||||
}
|
||||
@ -77,7 +57,7 @@ public class SuperPickaxeCommands {
|
||||
min = 1,
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.pickaxe.area"})
|
||||
@CommandPermissions({"worldedit.superpickaxe.area"})
|
||||
public static void area(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
@ -90,19 +70,19 @@ public class SuperPickaxeCommands {
|
||||
return;
|
||||
}
|
||||
|
||||
session.setLeftClickMode(new AreaPickaxe(range));
|
||||
session.setSuperPickaxe(new AreaPickaxe(range));
|
||||
session.enableSuperPickAxe();
|
||||
player.print("Mode changed. Left click with a pickaxe. // to disable.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"recur"},
|
||||
aliases = {"recur", "recursive"},
|
||||
usage = "<radius>",
|
||||
desc = "Enable the recursive super pickaxe pickaxe mode",
|
||||
min = 1,
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.pickaxe.recursive"})
|
||||
@CommandPermissions({"worldedit.superpickaxe.recursive"})
|
||||
public static void recursive(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
@ -115,143 +95,8 @@ public class SuperPickaxeCommands {
|
||||
return;
|
||||
}
|
||||
|
||||
session.setLeftClickMode(new RecursivePickaxe(range));
|
||||
session.setSuperPickaxe(new RecursivePickaxe(range));
|
||||
session.enableSuperPickAxe();
|
||||
player.print("Mode changed. Left click with a pickaxe. // to disable.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"none"},
|
||||
usage = "",
|
||||
desc = "Turn off all superpickaxe alternate modes",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
public static void none(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
session.setArmSwingMode(null);
|
||||
session.setRightClickMode(null);
|
||||
player.print("Now no longer equipping a tool.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"info"},
|
||||
usage = "",
|
||||
desc = "Block information tool",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.info"})
|
||||
public static void info(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
session.setArmSwingMode(null);
|
||||
session.setRightClickMode(new QueryTool());
|
||||
player.print("Info tool equipped. Right click with a pickaxe.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"tree"},
|
||||
usage = "[type]",
|
||||
desc = "Tree generator tool",
|
||||
min = 0,
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.tree"})
|
||||
public static void tree(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
TreeGenerator.TreeType type = args.argsLength() > 0 ?
|
||||
type = TreeGenerator.lookup(args.getString(0))
|
||||
: TreeGenerator.TreeType.TREE;
|
||||
|
||||
if (type == null) {
|
||||
player.printError("Tree type '" + args.getString(0) + "' is unknown.");
|
||||
return;
|
||||
}
|
||||
|
||||
session.setArmSwingMode(null);
|
||||
session.setRightClickMode(new TreePlanter(new TreeGenerator(type)));
|
||||
player.print("Tree tool equipped. Right click grass with a pickaxe.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"repl"},
|
||||
usage = "<block>",
|
||||
desc = "Block replacer tool",
|
||||
min = 1,
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.replacer"})
|
||||
public static void repl(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
BaseBlock targetBlock = we.getBlock(player, args.getString(0));
|
||||
session.setArmSwingMode(null);
|
||||
session.setRightClickMode(new BlockReplacer(targetBlock));
|
||||
player.print("Block replacer tool equipped. Right click with a pickaxe.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"cycler"},
|
||||
usage = "",
|
||||
desc = "Block data cycler tool",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.data-cycler"})
|
||||
public static void cycler(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
session.setArmSwingMode(null);
|
||||
session.setRightClickMode(new BlockDataCyler());
|
||||
player.print("Block cycler tool equipped. Right click with a pickaxe.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"/brush"},
|
||||
usage = "",
|
||||
flags = "r",
|
||||
desc = "Build from far away",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.drawing.brush"})
|
||||
public static void brush(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
boolean nonReplacing = args.hasFlag('r');
|
||||
|
||||
session.setRightClickMode(null);
|
||||
session.setArmSwingMode(new Brush(nonReplacing));
|
||||
if (nonReplacing) {
|
||||
player.print("Non-replacing brush tool equipped.");
|
||||
} else {
|
||||
player.print("Brush tool equipped. Swing with a pickaxe.");
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"/rbrush"},
|
||||
usage = "",
|
||||
desc = "Brush tool that will only replace blocks",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe.drawing.brush"})
|
||||
public static void rbrush(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
session.setRightClickMode(null);
|
||||
session.setArmSwingMode(new ReplacingBrush());
|
||||
player.print("Replacing brush tool equipped. Swing with a pickaxe.");
|
||||
}
|
||||
}
|
||||
|
130
src/com/sk89q/worldedit/commands/ToolCommands.java
Normal file
130
src/com/sk89q/worldedit/commands/ToolCommands.java
Normal file
@ -0,0 +1,130 @@
|
||||
// $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.minecraft.util.commands.NestedCommand;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.tools.*;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
|
||||
public class ToolCommands {
|
||||
@Command(
|
||||
aliases = {"none"},
|
||||
usage = "",
|
||||
desc = "Turn off all superpickaxe alternate modes",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
public static void none(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
session.setTool(player.getItemInHand(), null);
|
||||
player.print("Now no longer equipping a tool.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"info"},
|
||||
usage = "",
|
||||
desc = "Block information tool",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions({"worldedit.tool.info"})
|
||||
public static void info(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
session.setTool(player.getItemInHand(), new QueryTool());
|
||||
player.print("Info tool equipped. Right click with a pickaxe.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"tree"},
|
||||
usage = "[type]",
|
||||
desc = "Tree generator tool",
|
||||
min = 0,
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions({"worldedit.tool.tree"})
|
||||
public static void tree(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
TreeGenerator.TreeType type = args.argsLength() > 0 ?
|
||||
type = TreeGenerator.lookup(args.getString(0))
|
||||
: TreeGenerator.TreeType.TREE;
|
||||
|
||||
if (type == null) {
|
||||
player.printError("Tree type '" + args.getString(0) + "' is unknown.");
|
||||
return;
|
||||
}
|
||||
|
||||
session.setTool(player.getItemInHand(), new TreePlanter(new TreeGenerator(type)));
|
||||
player.print("Tree tool equipped. Right click grass with a pickaxe.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"repl"},
|
||||
usage = "<block>",
|
||||
desc = "Block replacer tool",
|
||||
min = 1,
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions({"worldedit.tool.replacer"})
|
||||
public static void repl(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
BaseBlock targetBlock = we.getBlock(player, args.getString(0));
|
||||
session.setTool(player.getItemInHand(), new BlockReplacer(targetBlock));
|
||||
player.print("Block replacer tool equipped. Right click with a pickaxe.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"cycler"},
|
||||
usage = "",
|
||||
desc = "Block data cycler tool",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions({"worldedit.tool.data-cycler"})
|
||||
public static void cycler(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
session.setTool(player.getItemInHand(), new BlockDataCyler());
|
||||
player.print("Block cycler tool equipped. Right click with a pickaxe.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"brush", "b"},
|
||||
desc = "Brush tool"
|
||||
)
|
||||
@NestedCommand({BrushCommands.class})
|
||||
public static void brush(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
}
|
||||
}
|
93
src/com/sk89q/worldedit/commands/ToolUtilCommands.java
Normal file
93
src/com/sk89q/worldedit/commands/ToolUtilCommands.java
Normal file
@ -0,0 +1,93 @@
|
||||
// $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.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.minecraft.util.commands.NestedCommand;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.masks.Mask;
|
||||
|
||||
/**
|
||||
* Tool commands.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class ToolUtilCommands {
|
||||
@Command(
|
||||
aliases = {"/", ","},
|
||||
usage = "",
|
||||
desc = "Toggle the super pickaxe pickaxe function",
|
||||
min = 0,
|
||||
max = 0
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe"})
|
||||
public static void togglePickaxe(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
if (session.toggleSuperPickAxe()) {
|
||||
player.print("Super pick axe enabled.");
|
||||
} else {
|
||||
player.print("Super pick axe disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"pickaxe", "pa", "spa"},
|
||||
desc = "Select super pickaxe mode"
|
||||
)
|
||||
@NestedCommand({SuperPickaxeCommands.class})
|
||||
public static void pickaxe(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"tool", "t"},
|
||||
desc = "Select a tool to bind"
|
||||
)
|
||||
@NestedCommand({ToolCommands.class})
|
||||
public static void tool(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"mask"},
|
||||
usage = "[mask]",
|
||||
desc = "Set the brush mask",
|
||||
min = 0,
|
||||
max = 1
|
||||
)
|
||||
public static void mask(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
if (args.argsLength() == 0) {
|
||||
session.getBrushTool(player.getItemInHand()).setMask(null);
|
||||
player.print("Brush mask disabled.");
|
||||
} else {
|
||||
Mask mask = we.getBlockMask(player, args.getString(0));
|
||||
session.getBrushTool(player.getItemInHand()).setMask(mask);
|
||||
player.print("Brush mask set.");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user