本文整理汇总了Java中com.sk89q.worldedit.regions.RegionSelector类的典型用法代码示例。如果您正苦于以下问题:Java RegionSelector类的具体用法?Java RegionSelector怎么用?Java RegionSelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegionSelector类属于com.sk89q.worldedit.regions包,在下文中一共展示了RegionSelector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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());
}
}
示例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);
}
示例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));
}
}
示例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;
}
示例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);
}
示例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);
}
示例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()));
}
}
示例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);
}
示例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();
}
}
示例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));
}
示例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;
}
示例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;
}
示例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);
}
}