• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RegionSelector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sk89q.worldedit.regions.RegionSelector的典型用法代码示例。如果您正苦于以下问题:Java RegionSelector类的具体用法?Java RegionSelector怎么用?Java RegionSelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RegionSelector类属于com.sk89q.worldedit.regions包,在下文中一共展示了RegionSelector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
@Override
public Selector getSelector() {
	SpongeWorld world = this.worldedit.getWorld(player.getWorld());
	RegionSelector selector = this.session.getRegionSelector(world);
	
	if (selector instanceof CuboidRegionSelector) {
		return new EWCuboidSelector(this.worldedit, this.player, this.session, (CuboidRegionSelector) this.session.getRegionSelector(world));
       } else if (selector instanceof ExtendingCuboidRegionSelector) {
       	return new EWExtendSelector(this.worldedit, this.player, this.session, (ExtendingCuboidRegionSelector) this.session.getRegionSelector(world));
       } else if (selector instanceof Polygonal2DRegionSelector) {
       	return new EWPolygonalSelector(this.worldedit, this.player, this.session, (Polygonal2DRegionSelector) this.session.getRegionSelector(world));
       } else if (selector instanceof EllipsoidRegionSelector) {
       	return new EWEllipsoidSelector(this.worldedit, this.player, this.session, (EllipsoidRegionSelector) this.session.getRegionSelector(world));
       } else if (selector instanceof SphereRegionSelector) {
       	return new EWSphereSelector(this.worldedit, this.player, this.session, (SphereRegionSelector) this.session.getRegionSelector(world));
       } else if (selector instanceof CylinderRegionSelector) {
       	return new EWCylinderSelector(this.worldedit, this.player, this.session, (CylinderRegionSelector) this.session.getRegionSelector(world));
       }
	return null;
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:21,代码来源:EWSubjectSelection.java


示例2: getType

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
@Override
public SelectionRegion.Type getType() {
	SpongeWorld world = this.worldedit.getWorld(player.getWorld());
	if (world == null) return SelectionRegion.Types.CUBOID;
	
       RegionSelector selector = this.session.getRegionSelector(world);
	if (selector instanceof ExtendingCuboidRegionSelector) {
		return SelectionRegion.Types.EXTEND;
	} else if (selector instanceof Polygonal2DRegionSelector) {
		return SelectionRegion.Types.POLYGONAL;
	} else if (selector instanceof EllipsoidRegionSelector) {
		return SelectionRegion.Types.ELLIPSOID;
	} else if (selector instanceof SphereRegionSelector) {
		return SelectionRegion.Types.SPHERE;
	} else if (selector instanceof CylinderRegionSelector) {
		return SelectionRegion.Types.CYLINDER;
	}
	return SelectionRegion.Types.CUBOID;
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:20,代码来源:EWSubjectSelection.java


示例3: revertVisuals

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
public void revertVisuals(Player player, GPPlayerData playerData, UUID claimUniqueId) {
    final LocalSession session = this.getLocalSession(player.getName());
    if (session == null || !session.hasCUISupport()) {
        return;
    }
    final World world = this.getWorld(player.getWorld());
    final RegionSelector region = session.getRegionSelector(world);
    final GPActor actor = this.getOrCreateActor(player);
    region.clear();
    session.dispatchCUISelection(actor);
    if (claimUniqueId != null) {
        actor.dispatchCUIEvent(new MultiSelectionClearEvent(claimUniqueId));
    } else {
        actor.dispatchCUIEvent(new MultiSelectionClearEvent());
    }
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:17,代码来源:WorldEditApiProvider.java


示例4: CuboidRegionSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
/**
 * Create a copy of another selector.
 *
 * @param oldSelector another selector
 */
public CuboidRegionSelector(RegionSelector oldSelector) {
    this(checkNotNull(oldSelector).getIncompleteRegion().getWorld());

    if (oldSelector instanceof CuboidRegionSelector) {
        final CuboidRegionSelector cuboidRegionSelector = (CuboidRegionSelector) oldSelector;

        position1 = cuboidRegionSelector.position1;
        position2 = cuboidRegionSelector.position2;
    } else {
        final Region oldRegion;
        try {
            oldRegion = oldSelector.getRegion();
        } catch (IncompleteRegionException e) {
            return;
        }

        position1 = oldRegion.getMinimumPoint().toBlockVector();
        position2 = oldRegion.getMaximumPoint().toBlockVector();
    }
    region.setPos1(position1);
    region.setPos2(position2);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:28,代码来源:CuboidRegionSelector.java


示例5: EllipsoidRegionSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
/**
 * Create a new selector from the given selector.
 *
 * @param oldSelector the old selector
 */
public EllipsoidRegionSelector(RegionSelector oldSelector) {
    this(checkNotNull(oldSelector).getIncompleteRegion().getWorld());
    if (oldSelector instanceof EllipsoidRegionSelector) {
        final EllipsoidRegionSelector ellipsoidRegionSelector = (EllipsoidRegionSelector) oldSelector;

        region = new EllipsoidRegion(ellipsoidRegionSelector.getIncompleteRegion());
    } else {
        Region oldRegion;
        try {
            oldRegion = oldSelector.getRegion();
        } catch (IncompleteRegionException e) {
            return;
        }

        BlockVector pos1 = oldRegion.getMinimumPoint().toBlockVector();
        BlockVector pos2 = oldRegion.getMaximumPoint().toBlockVector();

        Vector center = pos1.add(pos2).divide(2).floor();
        region.setCenter(center);
        region.setRadius(pos2.subtract(center));
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:28,代码来源:EllipsoidRegionSelector.java


示例6: EWSelectionRegion

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
public EWSelectionRegion(SpongeWorldEdit worldedit, Player player, LocalSession session, RegionSelector selector, Region region) {
	this.worldedit = worldedit;
	this.player = player;
	this.session = session;
	this.selector = selector;
	this.region = region;
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:8,代码来源:EWSelectionRegion.java


示例7: getRegionSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
public RegionSelector getRegionSelector(Player player) {
    final LocalSession session = getLocalSession(player.getName());
    if (session == null) {
        return null;
    }

    World world = session.getSelectionWorld();
    if (world == null) {
        world = this.getWorld(player.getWorld());
    }
    return session.getRegionSelector(world);
}
 
开发者ID:MinecraftPortCentral,项目名称:GriefPrevention,代码行数:13,代码来源:WorldEditApiProvider.java


示例8: setSelection

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
/**
 * Set the player's WorldEdit selection to the following CuboidRegion
 *
 * @param region
 */
public void setSelection(final RegionWrapper region) {
    final Player player = this.getPlayer();
    Vector top = region.getTopVector();
    top.mutY(getWorld().getMaxY());
    final RegionSelector selector = new CuboidRegionSelector(player.getWorld(), region.getBottomVector(), top);
    this.getSession().setRegionSelector(player.getWorld(), selector);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:13,代码来源:FawePlayer.java


示例9: CylinderRegionSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
/**
 * Create a new selector from the given one.
 *
 * @param oldSelector the old selector
 */
public CylinderRegionSelector(RegionSelector oldSelector) {
    this(checkNotNull(oldSelector).getIncompleteRegion().getWorld());

    if (oldSelector instanceof CylinderRegionSelector) {
        final CylinderRegionSelector cylSelector = (CylinderRegionSelector) oldSelector;

        region = new CylinderRegion(cylSelector.region);
    } else {
        final Region oldRegion;
        try {
            oldRegion = oldSelector.getRegion();
        } catch (IncompleteRegionException e) {
            return;
        }

        Vector pos1 = oldRegion.getMinimumPoint();
        Vector pos2 = oldRegion.getMaximumPoint();

        Vector center = pos1.add(pos2).divide(2).floor();
        region.setCenter(center.toVector2D());
        region.setRadius(pos2.toVector2D().subtract(center.toVector2D()));

        region.setMaximumY(Math.max(pos1.getBlockY(), pos2.getBlockY()));
        region.setMinimumY(Math.min(pos1.getBlockY(), pos2.getBlockY()));
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:32,代码来源:CylinderRegionSelector.java


示例10: ExtendingCuboidRegionSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
/**
 * Create a new selector from another one.
 *
 * @param oldSelector the other selector
 */
public ExtendingCuboidRegionSelector(RegionSelector oldSelector) {
    super(oldSelector);

    if (position1 == null || position2 == null) {
        return;
    }

    position1 = region.getMinimumPoint().toBlockVector();
    position2 = region.getMaximumPoint().toBlockVector();
    region.setPos1(position1);
    region.setPos2(position2);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:18,代码来源:ExtendingCuboidRegionSelector.java


示例11: ConvexPolyhedralRegionSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
/**
 * Create a new selector.
 *
 * @param oldSelector the old selector
 */
public ConvexPolyhedralRegionSelector(RegionSelector oldSelector) {
    checkNotNull(oldSelector);

    if (oldSelector instanceof ConvexPolyhedralRegionSelector) {
        final ConvexPolyhedralRegionSelector convexPolyhedralRegionSelector = (ConvexPolyhedralRegionSelector) oldSelector;

        pos1 = convexPolyhedralRegionSelector.pos1;
        region = new ConvexPolyhedralRegion(convexPolyhedralRegionSelector.region);
    } else {
        final Region oldRegion;
        try {
            oldRegion = oldSelector.getRegion();
        } catch (IncompleteRegionException e) {
            region = new ConvexPolyhedralRegion(oldSelector.getIncompleteRegion().getWorld());
            return;
        }

        final int minY = oldRegion.getMinimumPoint().getBlockY();
        final int maxY = oldRegion.getMaximumPoint().getBlockY();

        region = new ConvexPolyhedralRegion(oldRegion.getWorld());

        for (final BlockVector2D pt : new ArrayList<BlockVector2D>(oldRegion.polygonize(Integer.MAX_VALUE))) {
            region.addVertex(pt.toVector(minY));
            region.addVertex(pt.toVector(maxY));
        }

        learnChanges();
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:36,代码来源:ConvexPolyhedralRegionSelector.java


示例12: SphereRegionSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
/**
 * Create a new selector from another one
 *
 * @param oldSelector the old selector
 */
public SphereRegionSelector(RegionSelector oldSelector) {
    super(oldSelector);
    final Vector radius = region.getRadius();
    final double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ());
    region.setRadius(new Vector(radiusScalar, radiusScalar, radiusScalar));
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:12,代码来源:SphereRegionSelector.java


示例13: getRegionSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
/**
 * Get the region selector for defining the selection. If the selection
 * was defined for a different world, the old selection will be discarded.
 *
 * @param world the world
 * @return position the position
 */
public RegionSelector getRegionSelector(World world) {
    checkNotNull(world);
    try {
        if (selector.getWorld() == null || !selector.getWorld().equals(world)) {
            selector.setWorld(world);
            selector.clear();
        }
    } catch (Throwable ignore) {
        selector.clear();
    }
    return selector;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:20,代码来源:LocalSession.java


示例14: setRegionSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
/**
 * Set the region selector.
 *
 * @param world    the world
 * @param selector the selector
 */
public void setRegionSelector(World world, RegionSelector selector) {
    checkNotNull(world);
    checkNotNull(selector);
    selector.setWorld(world);
    this.selector = selector;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:13,代码来源:LocalSession.java


示例15: getRegion

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
private Region getRegion(Player player) {
    WorldEditPlugin worldEdit = getWorldEdit();
    LocalWorld world = BukkitUtil.getLocalWorld(player.getWorld());
    RegionSelector selector = worldEdit.getSession(player)
            .getRegionSelector(world);
    try {
        return selector.getRegion();
    } catch (IncompleteRegionException exc) {
        throw new WERegionIncomplete(dac);
    }
}
 
开发者ID:Loscillo,项目名称:DACv2-temp,代码行数:12,代码来源:SetWECommands.java


示例16: setSelection

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
private void setSelection(Player sender, Arena arena,
        WESelector selectorType, Region region) {
    WorldEditPlugin worldEdit = getWorldEdit();
    LocalWorld world = BukkitUtil.getLocalWorld(arena.getWorld());
    Shape shape = region.getShape();

    RegionSelector sel = selectorType.create(dac, world, shape);
    LocalSession session = worldEdit.getSession(sender);
    session.setRegionSelector(world, sel);
    session.dispatchCUISelection(worldEdit.wrapPlayer(sender));
}
 
开发者ID:Loscillo,项目名称:DACv2-temp,代码行数:12,代码来源:SelectCommands.java


示例17: EWSelector

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
public EWSelector(SpongeWorldEdit worldedit, Player player, LocalSession session, RegionSelector selector) {
	this.worldedit = worldedit;
	this.player = player;
	this.session = session;
	this.selector = selector;
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:7,代码来源:EWSelector.java


示例18: EWCuboidSelectionRegion

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
public EWCuboidSelectionRegion(SpongeWorldEdit worldedit, Player player, LocalSession session, RegionSelector selector, CuboidRegion region) {
	super(worldedit, player, session, selector, region);
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:4,代码来源:EWCuboidSelectionRegion.java


示例19: EWCylinderSelectionRegion

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
public EWCylinderSelectionRegion(SpongeWorldEdit worldedit, Player player, LocalSession session, RegionSelector selector, CylinderRegion region) {
	super(worldedit, player, session, selector, region);
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:4,代码来源:EWCylinderSelectionRegion.java


示例20: EWPolygonalSelectionRegion

import com.sk89q.worldedit.regions.RegionSelector; //导入依赖的package包/类
public EWPolygonalSelectionRegion(SpongeWorldEdit worldedit, Player player, LocalSession session, RegionSelector selector, Polygonal2DRegion region) {
	super(worldedit, player, session, selector, region);
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:4,代码来源:EWPolygonalSelectionRegion.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ChannelListeners类代码示例发布时间:2022-05-22
下一篇:
Java AggregationKind类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap