mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 12:36:40 +00:00
Major command changes that don't work yet.
This commit is contained in:
@ -21,16 +21,10 @@ package com.sk89q.worldedit.command;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.brush.InspectBrush;
|
||||
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.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.command.tool.BlockDataCyler;
|
||||
import com.sk89q.worldedit.command.tool.BlockReplacer;
|
||||
@ -38,20 +32,22 @@ import com.sk89q.worldedit.command.tool.DistanceWand;
|
||||
import com.sk89q.worldedit.command.tool.FloatingTreeRemover;
|
||||
import com.sk89q.worldedit.command.tool.FloodFillTool;
|
||||
import com.sk89q.worldedit.command.tool.LongRangeBuildTool;
|
||||
import com.sk89q.worldedit.command.tool.NavigationWand;
|
||||
import com.sk89q.worldedit.command.tool.QueryTool;
|
||||
import com.sk89q.worldedit.command.tool.SelectionWand;
|
||||
import com.sk89q.worldedit.command.tool.TreePlanter;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.util.command.parametric.Optional;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.util.HandSide;
|
||||
import com.sk89q.worldedit.util.TreeGenerator;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import org.enginehub.piston.annotation.Command;
|
||||
import org.enginehub.piston.annotation.CommandContainer;
|
||||
import org.enginehub.piston.annotation.param.Arg;
|
||||
|
||||
@Command(aliases = {"brush", "br", "tool"}, desc = "Bind functions to held items: [More Info](https://goo.gl/xPnPxj)")
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class ToolCommands {
|
||||
private final WorldEdit we;
|
||||
|
||||
@ -60,132 +56,169 @@ public class ToolCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"info", "/info"},
|
||||
usage = "",
|
||||
desc = "Block information tool",
|
||||
min = 0,
|
||||
max = 0
|
||||
name = "none",
|
||||
desc = "Unbind a bound tool from your current item"
|
||||
)
|
||||
public void none(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
session.setTool(player.getItemInHand(HandSide.MAIN_HAND).getType(), null);
|
||||
player.print("Tool unbound from your current item.");
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/selwand",
|
||||
aliases = "selwand",
|
||||
desc = "Selection wand tool"
|
||||
)
|
||||
@CommandPermissions("worldedit.setwand")
|
||||
public void selwand(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
final ItemType itemType = player.getItemInHand(HandSide.MAIN_HAND).getType();
|
||||
session.setTool(itemType, new SelectionWand());
|
||||
player.print("Selection wand bound to " + itemType.getName() + ".");
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/navwand",
|
||||
aliases = "navwand",
|
||||
desc = "Navigation wand tool"
|
||||
)
|
||||
@CommandPermissions("worldedit.setwand")
|
||||
public void navwand(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new NavigationWand());
|
||||
player.print("Navigation wand bound to " + itemStack.getType().getName() + ".");
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "info",
|
||||
desc = "Block information tool"
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.info")
|
||||
public void info(Player player, LocalSession session) throws WorldEditException {
|
||||
session.setTool(new QueryTool(), player);
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new QueryTool());
|
||||
BBC.TOOL_INFO.send(player, itemStack.getType().getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"inspect"},
|
||||
usage = "",
|
||||
desc = "Inspect edits within a radius",
|
||||
help =
|
||||
"Chooses the inspect brush",
|
||||
min = 0,
|
||||
max = 0
|
||||
name = "inspect",
|
||||
desc = "Inspect edits within a radius"
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.inspect")
|
||||
public void inspectBrush(Player player, LocalSession session, @Optional("1") double radius) throws WorldEditException {
|
||||
session.setTool(new InspectBrush(), player);
|
||||
BBC.TOOL_INSPECT.send(player, player.getItemInHand(HandSide.MAIN_HAND).getType().getName());
|
||||
public void inspectBrush(Player player, LocalSession session,
|
||||
@Arg(desc = "The radius of the brush", def = "1")
|
||||
double radius) throws WorldEditException {
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new InspectBrush());
|
||||
BBC.TOOL_INSPECT.send(player, itemStack.getType().getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"tree"},
|
||||
usage = "[type]",
|
||||
desc = "Tree generator tool",
|
||||
min = 0,
|
||||
max = 1
|
||||
name = "tree",
|
||||
desc = "Tree generator tool"
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.tree")
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tree(Player player, LocalSession session, @Optional("tree") TreeGenerator.TreeType type, CommandContext args) throws WorldEditException {
|
||||
session.setTool(new TreePlanter(type), player);
|
||||
BBC.TOOL_TREE.send(player, player.getItemInHand(HandSide.MAIN_HAND).getType().getName());
|
||||
public void tree(Player player, LocalSession session,
|
||||
@Arg(desc = "Type of tree to generate", def = "tree")
|
||||
TreeGenerator.TreeType type) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new TreePlanter(type));
|
||||
BBC.TOOL_TREE.send(player, itemStack.getType().getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"repl"},
|
||||
usage = "<pattern>",
|
||||
desc = "Block replacer tool",
|
||||
min = 1,
|
||||
max = 1
|
||||
name = "repl",
|
||||
desc = "Block replacer tool"
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.replacer")
|
||||
public void repl(Player player, LocalSession session, Pattern pattern) throws WorldEditException {
|
||||
session.setTool(new BlockReplacer(pattern), player);
|
||||
BBC.TOOL_REPL.send(player, player.getItemInHand(HandSide.MAIN_HAND).getType().getName());
|
||||
public void repl(Player player, LocalSession session,
|
||||
@Arg(desc = "The pattern of blocks to place")
|
||||
Pattern pattern) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new BlockReplacer(pattern));
|
||||
BBC.TOOL_REPL.send(player, itemStack.getType().getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"cycler"},
|
||||
usage = "",
|
||||
desc = "Block data cycler tool",
|
||||
min = 0,
|
||||
max = 0
|
||||
name = "cycler",
|
||||
desc = "Block data cycler tool"
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.data-cycler")
|
||||
public void cycler(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
session.setTool(new BlockDataCyler(), player);
|
||||
BBC.TOOL_CYCLER.send(player, player.getItemInHand(HandSide.MAIN_HAND).getType().getName());
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new BlockDataCyler());
|
||||
BBC.TOOL_CYCLER.send(player, itemStack.getType().getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"floodfill", "flood"},
|
||||
usage = "<pattern> <range>",
|
||||
desc = "Flood fill tool",
|
||||
min = 2,
|
||||
max = 2
|
||||
name = "floodfill",
|
||||
aliases = { "flood" },
|
||||
desc = "Flood fill tool"
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.flood-fill")
|
||||
public void floodFill(Player player, EditSession editSession, LocalSession session, Pattern pattern, int range) throws WorldEditException {
|
||||
public void floodFill(Player player, LocalSession session,
|
||||
@Arg(desc = "The pattern to flood fill")
|
||||
Pattern pattern,
|
||||
@Arg(desc = "The range to perform the fill")
|
||||
int range) throws WorldEditException {
|
||||
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
if (range > config.maxSuperPickaxeSize) {
|
||||
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
|
||||
return;
|
||||
}
|
||||
session.setTool(new FloodFillTool(range, pattern), player);
|
||||
BBC.TOOL_FLOOD_FILL.send(player, player.getItemInHand(HandSide.MAIN_HAND).getType().getName());
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new FloodFillTool(range, pattern));
|
||||
BBC.TOOL_FLOOD_FILL.send(player, itemStack.getType().getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"deltree"},
|
||||
usage = "",
|
||||
desc = "Floating tree remover tool",
|
||||
min = 0,
|
||||
max = 0
|
||||
name = "deltree",
|
||||
desc = "Floating tree remover tool"
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.deltree")
|
||||
public void deltree(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
session.setTool(new FloatingTreeRemover(), player);
|
||||
BBC.TOOL_DELTREE.send(player, player.getItemInHand(HandSide.MAIN_HAND).getType().getName());
|
||||
public void deltree(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new FloatingTreeRemover());
|
||||
BBC.TOOL_DELTREE.send(player, itemStack.getType().getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"farwand"},
|
||||
usage = "",
|
||||
desc = "Wand at a distance tool",
|
||||
min = 0,
|
||||
max = 0
|
||||
name = "farwand",
|
||||
desc = "Wand at a distance tool"
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.farwand")
|
||||
public void farwand(Player player, LocalSession session, CommandContext args) throws WorldEditException {
|
||||
session.setTool(new DistanceWand(), player);
|
||||
BBC.TOOL_FARWAND.send(player, player.getItemInHand(HandSide.MAIN_HAND).getType().getName());
|
||||
public void farwand(Player player, LocalSession session) throws WorldEditException {
|
||||
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
session.setTool(itemStack.getType(), new DistanceWand());
|
||||
BBC.TOOL_FARWAND.send(player, itemStack.getType().getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"lrbuild", "/lrbuild"},
|
||||
usage = "<leftclick block> <rightclick block>",
|
||||
desc = "Long-range building tool",
|
||||
min = 2,
|
||||
max = 2
|
||||
name = "lrbuild",
|
||||
aliases = { "/lrbuild" },
|
||||
desc = "Long-range building tool"
|
||||
)
|
||||
@CommandPermissions("worldedit.tool.lrbuild")
|
||||
public void longrangebuildtool(Player player, LocalSession session, Pattern secondary, Pattern primary) throws WorldEditException {
|
||||
session.setTool(new LongRangeBuildTool(primary, secondary), player);
|
||||
BBC.TOOL_LRBUILD_BOUND.send(player, player.getItemInHand(HandSide.MAIN_HAND).getType().getName());
|
||||
public void longrangebuildtool(Player player, LocalSession session,
|
||||
@Arg(desc = "Pattern to set on left-click")
|
||||
Pattern primary,
|
||||
@Arg(desc = "Pattern to set on right-click")
|
||||
Pattern secondary) throws WorldEditException {
|
||||
BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
|
||||
session.setTool(itemStack.getType(), new LongRangeBuildTool(primary, secondary));
|
||||
BBC.TOOL_LRBUILD_BOUND.send(player, itemStack.getType().getName());
|
||||
BBC.TOOL_LRBUILD_INFO.send(player, secondary, primary);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user