Java Code Examples for com.sk89q.worldedit.LocalSession#setRegionSelector()
The following examples show how to use
com.sk89q.worldedit.LocalSession#setRegionSelector() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorldEditApiProvider.java From GriefPrevention with MIT License | 5 votes |
public void visualizeClaim(Claim claim, Vector3i pos1, Vector3i pos2, Player player, GPPlayerData playerData, boolean investigating) { // revert any current visuals if investigating if (investigating) { this.revertVisuals(player, playerData, null); } final LocalSession session = this.getLocalSession(player.getName()); if (session == null || !session.hasCUISupport()) { return; } final Vector point1 = this.createVector(pos1); final Vector point2 = this.createVector(pos2); final CuboidRegionSelector regionSelector = new CuboidRegionSelector(session.getSelectionWorld(), point1, point2); final GPActor actor = this.getOrCreateActor(player); session.setRegionSelector(this.getWorld(player.getWorld()), regionSelector); actor.dispatchCUIEvent(new MultiSelectionCuboidEvent(claim.getUniqueId())); actor.dispatchCUIEvent(new MultiSelectionPointEvent(0, point1, regionSelector.getArea())); if (playerData.claimResizing != null) { actor.dispatchCUIEvent(new MultiSelectionPointEvent(1)); } else { actor.dispatchCUIEvent(new MultiSelectionPointEvent(1, point2, regionSelector.getArea())); } if (investigating || playerData.lastShovelLocation == null) { actor.dispatchCUIEvent(new MultiSelectionColorEvent(MultiSelectionColors.RED, MultiSelectionColors.getClaimColor(claim), "", "")); } actor.dispatchCUIEvent(new MultiSelectionGridEvent(10)); }
Example 2
Source File: WorldEditApiProvider.java From GriefPrevention with MIT License | 5 votes |
public void visualizeClaims(Set<Claim> claims, Player player, GPPlayerData playerData, boolean investigating) { for (Claim claim : claims) { if (((GPClaim) claim).children.size() > 0) { visualizeClaims(((GPClaim) claim).getInternalChildren(true), player, playerData, investigating); } final LocalSession session = this.getLocalSession(player.getName()); if (session == null || !session.hasCUISupport()) { return; } final Vector point1 = this.createVector(claim.getLesserBoundaryCorner().getBlockPosition()); final Vector point2 = this.createVector(claim.getGreaterBoundaryCorner().getBlockPosition()); final CuboidRegionSelector regionSelector = new CuboidRegionSelector(session.getSelectionWorld(), point1, point2); final GPActor actor = this.getOrCreateActor(player); session.setRegionSelector(this.getWorld(player.getWorld()), regionSelector); actor.dispatchCUIEvent(new MultiSelectionCuboidEvent(claim.getUniqueId())); actor.dispatchCUIEvent(new MultiSelectionPointEvent(0, point1, regionSelector.getArea())); if (playerData.claimResizing != null) { actor.dispatchCUIEvent(new MultiSelectionPointEvent(1)); } else { actor.dispatchCUIEvent(new MultiSelectionPointEvent(1, point2, regionSelector.getArea())); } if (investigating) { actor.dispatchCUIEvent(new MultiSelectionColorEvent(MultiSelectionColors.RED, MultiSelectionColors.getClaimColor(claim), "", "")); } actor.dispatchCUIEvent(new MultiSelectionGridEvent(10)); } }