本文整理汇总了Java中com.sk89q.worldedit.LocalSession.setTool方法的典型用法代码示例。如果您正苦于以下问题:Java LocalSession.setTool方法的具体用法?Java LocalSession.setTool怎么用?Java LocalSession.setTool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.LocalSession
的用法示例。
在下文中一共展示了LocalSession.setTool方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: primary
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"primary"},
usage = "[brush-arguments]",
desc = "Set the right click brush",
help = "Set the right click brush",
min = 1
)
public void primary(Player player, LocalSession session, CommandContext args) throws WorldEditException {
BaseBlock item = player.getBlockInHand();
BrushTool tool = session.getBrushTool(player, false);
session.setTool(item, null, player);
String cmd = "brush " + args.getJoinedStrings(0);
CommandEvent event = new CommandEvent(player, cmd);
CommandManager.getInstance().handleCommandOnCurrentThread(event);
BrushTool newTool = session.getBrushTool(item, player, false);
if (newTool != null && tool != null) {
newTool.setSecondary(tool.getSecondary());
}
}
示例2: secondary
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"secondary"},
usage = "[brush-arguments]",
desc = "Set the left click brush",
help = "Set the left click brush",
min = 1
)
public void secondary(Player player, LocalSession session, CommandContext args) throws WorldEditException {
BaseBlock item = player.getBlockInHand();
BrushTool tool = session.getBrushTool(player, false);
session.setTool(item, null, player);
String cmd = "brush " + args.getJoinedStrings(0);
CommandEvent event = new CommandEvent(player, cmd);
CommandManager.getInstance().handleCommandOnCurrentThread(event);
BrushTool newTool = session.getBrushTool(item, player, false);
if (newTool != null && tool != null) {
newTool.setPrimary(tool.getPrimary());
}
}
示例3: floodFill
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"floodfill", "flood"},
usage = "<pattern> <range>",
desc = "Flood fill tool",
min = 2,
max = 2
)
@CommandPermissions("worldedit.tool.flood-fill")
public void floodFill(Player player, EditSession editSession, LocalSession session, Pattern pattern, double range) throws WorldEditException {
LocalConfiguration config = we.getConfiguration();
if (range > config.maxSuperPickaxeSize) {
BBC.TOOL_RANGE_ERROR.send(player, config.maxSuperPickaxeSize);
return;
}
session.setTool(new FloodFillTool((int) range, pattern), player);
BBC.TOOL_FLOOD_FILL.send(player, ItemType.toHeldName(player.getItemInHand()));
}
示例4: longrangebuildtool
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"lrbuild", "/lrbuild"},
usage = "<leftclick block> <rightclick block>",
desc = "Long-range building tool",
min = 2,
max = 2
)
@CommandPermissions("worldedit.tool.lrbuild")
public void longrangebuildtool(Player player, LocalSession session, CommandContext args) throws WorldEditException {
BaseBlock secondary = we.getBlock(player, args.getString(0));
BaseBlock primary = we.getBlock(player, args.getString(1));
session.setTool(new LongRangeBuildTool(primary, secondary), player);
BBC.TOOL_LRBUILD_BOUND.send(player, ItemType.toHeldName(player.getItemInHand()));
BBC.TOOL_LRBUILD_INFO.send(player, ItemType.toName(secondary.getType()), ItemType.toName(primary.getType()));
}
示例5: loadBrush
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"loadbrush", "load"},
desc = "load a brush",
usage = "[name]",
min = 1
)
@CommandPermissions("worldedit.brush.load")
public void loadBrush(Player player, LocalSession session, String name) throws WorldEditException, IOException {
name = FileSystems.getDefault().getPath(name).getFileName().toString();
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), "brushes");
name = name.endsWith(".jsgz") ? name : name + ".jsgz";
File file = new File(folder, player.getUniqueId() + File.separator + name);
if (!file.exists()) {
file = new File(folder, name);
}
if (!file.exists()) {
File[] files = folder.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return false;
}
});
BBC.BRUSH_NOT_FOUND.send(player, name);
return;
}
try (DataInputStream in = new DataInputStream(new GZIPInputStream(new FileInputStream(file)))) {
String json = in.readUTF();
BrushTool tool = BrushTool.fromString(player, session, json);
BaseBlock item = player.getBlockInHand();
session.setTool(item, tool, player);
BBC.BRUSH_EQUIPPED.send(player, name);
} catch (Throwable e) {
e.printStackTrace();
BBC.BRUSH_INCOMPATIBLE.send(player);
}
}
示例6: none
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"none", "/none"},
usage = "",
desc = "Unbind a bound tool from your current item",
min = 0,
max = 0
)
public void none(Player player, LocalSession session, CommandContext args) throws WorldEditException {
session.setTool(null, player);
BBC.TOOL_NONE.send(player);
}
示例7: process
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Override
public BrushSettings process(CommandLocals locals, BrushSettings settings) throws Command.CommandException, WorldEditException {
Actor actor = locals.get(Actor.class);
LocalSession session = worldEdit.getSessionManager().get(actor);
session.setTool(null, (Player) actor);
BrushTool tool = session.getBrushTool((Player) actor);
if (tool != null) {
tool.setPrimary(settings);
tool.setSecondary(settings);
BBC.BRUSH_EQUIPPED.send(actor, ((String) locals.get("arguments")).split(" ")[1]);
}
return null;
}
示例8: info
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"info", "/info"},
usage = "",
desc = "Block information tool",
min = 0,
max = 0
)
@CommandPermissions("worldedit.tool.info")
public void info(Player player, LocalSession session, CommandContext args) throws WorldEditException {
session.setTool(new QueryTool(), player);
BBC.TOOL_INFO.send(player, ItemType.toHeldName(player.getItemInHand()));
}
示例9: inspectBrush
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"inspect"},
usage = "",
desc = "Inspect edits within a radius",
help =
"Chooses the inspect brush",
min = 0,
max = 0
)
@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, ItemType.toHeldName(player.getItemInHand()));
}
示例10: tree
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"tree"},
usage = "[type]",
desc = "Tree generator tool",
min = 0,
max = 1
)
@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(new TreeGenerator(type)), player);
BBC.TOOL_TREE.send(player, ItemType.toHeldName(player.getItemInHand()));
}
示例11: repl
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"repl"},
usage = "<block>",
desc = "Block replacer tool",
min = 1,
max = 1
)
@CommandPermissions("worldedit.tool.replacer")
public void repl(Player player, LocalSession session, CommandContext args) throws WorldEditException {
BaseBlock targetBlock = we.getBlock(player, args.getString(0));
session.setTool(new BlockReplacer(targetBlock), player);
BBC.TOOL_REPL.send(player, ItemType.toHeldName(player.getItemInHand()));
}
示例12: cycler
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"cycler"},
usage = "",
desc = "Block data cycler tool",
min = 0,
max = 0
)
@CommandPermissions("worldedit.tool.data-cycler")
public void cycler(Player player, LocalSession session, CommandContext args) throws WorldEditException {
session.setTool(new BlockDataCyler(), player);
BBC.TOOL_CYCLER.send(player, ItemType.toHeldName(player.getItemInHand()));
}
示例13: deltree
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"deltree"},
usage = "",
desc = "Floating tree remover tool",
min = 0,
max = 0
)
@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, ItemType.toHeldName(player.getItemInHand()));
}
示例14: farwand
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"farwand"},
usage = "",
desc = "Wand at a distance tool",
min = 0,
max = 0
)
@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, ItemType.toHeldName(player.getItemInHand()));
}