当前位置: 首页>>代码示例>>Java>>正文


Java LocalSession.getSelection方法代码示例

本文整理汇总了Java中com.sk89q.worldedit.LocalSession.getSelection方法的典型用法代码示例。如果您正苦于以下问题:Java LocalSession.getSelection方法的具体用法?Java LocalSession.getSelection怎么用?Java LocalSession.getSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sk89q.worldedit.LocalSession的用法示例。


在下文中一共展示了LocalSession.getSelection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: outset

import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
        aliases = {"/outset"},
        usage = "<amount>",
        desc = "Outset the selection area",
        help =
                "Expands the selection by the given amount in all directions.\n" +
                        "Flags:\n" +
                        "  -h only expand horizontally\n" +
                        "  -v only expand vertically\n",
        flags = "hv",
        min = 1,
        max = 1
)
@Logging(REGION)
@CommandPermissions("worldedit.selection.outset")
public void outset(Player player, LocalSession session, CommandContext args) throws WorldEditException {
    Region region = session.getSelection(player.getWorld());
    region.expand(getChangesForEachDir(args));
    session.getRegionSelector(player.getWorld()).learnChanges();
    session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
    BBC.SELECTION_OUTSET.send(player);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:23,代码来源:SelectionCommands.java

示例2: inset

import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
        aliases = {"/inset"},
        usage = "<amount>",
        desc = "Inset the selection area",
        help =
                "Contracts the selection by the given amount in all directions.\n" +
                        "Flags:\n" +
                        "  -h only contract horizontally\n" +
                        "  -v only contract vertically\n",
        flags = "hv",
        min = 1,
        max = 1
)
@Logging(REGION)
@CommandPermissions("worldedit.selection.inset")
public void inset(Player player, LocalSession session, CommandContext args) throws WorldEditException {
    Region region = session.getSelection(player.getWorld());
    region.contract(getChangesForEachDir(args));
    session.getRegionSelector(player.getWorld()).learnChanges();
    session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
    BBC.SELECTION_INSET.send(player);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:23,代码来源:SelectionCommands.java

示例3: shift

import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
        aliases = {"/shift"},
        usage = "<amount> [direction]",
        desc = "Shift the selection area",
        min = 1,
        max = 2
)
@Logging(REGION)
@CommandPermissions("worldedit.selection.shift")
public void shift(Player player, LocalSession session, CommandContext args) throws WorldEditException {
    List<Vector> dirs = new ArrayList<Vector>();
    int change = args.getInteger(0);
    if (args.argsLength() == 2) {
        if (args.getString(1).contains(",")) {
            for (String s : args.getString(1).split(",")) {
                dirs.add(we.getDirection(player, s.toLowerCase()));
            }
        } else {
            dirs.add(we.getDirection(player, args.getString(1).toLowerCase()));
        }
    } else {
        dirs.add(we.getDirection(player, "me"));
    }

    try {
        Region region = session.getSelection(player.getWorld());

        for (Vector dir : dirs) {
            region.shift(dir.multiply(change));
        }

        session.getRegionSelector(player.getWorld()).learnChanges();

        session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
        BBC.SELECTION_SHIFT.send(player);
    } catch (RegionOperationException e) {
        player.printError(e.getMessage());
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:40,代码来源:SelectionCommands.java

示例4: getSelection

import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
/**
 * Gets a selection from a {@link ArgumentStack}.
 *
 * @param context the context
 * @param selection the annotation
 * @return a selection
 * @throws IncompleteRegionException if no selection is available
 * @throws ParameterException on other error
 */
@BindingMatch(classifier = Selection.class,
        type = Region.class,
        behavior = BindingBehavior.PROVIDES)
public Object getSelection(ArgumentStack context, Selection selection) throws IncompleteRegionException, ParameterException {
    Player sender = getPlayer(context);
    LocalSession session = worldEdit.getSessionManager().get(sender);
    return session.getSelection(FawePlayer.wrap(sender).getWorldForEditing());
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:18,代码来源:WorldEditBinding.java


注:本文中的com.sk89q.worldedit.LocalSession.getSelection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。