Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-27 03:12:37 +01:00
Converted API over to use new World.
This breaks backwards compatibility for all getWorld() methods, but shim methods were added for binary compatibility with method calls that use LocalWorld.
Dieser Commit ist enthalten in:
Ursprung
63a2ca824d
Commit
24f8fbc92a
@ -21,6 +21,12 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
|
import com.sk89q.util.StringUtil;
|
||||||
|
import com.sk89q.worldedit.LocalPlayer;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
import com.sk89q.worldedit.WorldVector;
|
||||||
|
import com.sk89q.worldedit.internal.LocalWorldAdapter;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.event.Event.Result;
|
import org.bukkit.event.Event.Result;
|
||||||
@ -33,12 +39,6 @@ import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
|||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import com.sk89q.util.StringUtil;
|
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.WorldVector;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles all events thrown in relation to a Player
|
* Handles all events thrown in relation to a Player
|
||||||
*/
|
*/
|
||||||
@ -119,14 +119,13 @@ public class WorldEditListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final LocalPlayer player = plugin.wrapPlayer(event.getPlayer());
|
final LocalPlayer player = plugin.wrapPlayer(event.getPlayer());
|
||||||
final LocalWorld world = player.getWorld();
|
final World world = player.getWorld();
|
||||||
final WorldEdit we = plugin.getWorldEdit();
|
final WorldEdit we = plugin.getWorldEdit();
|
||||||
|
|
||||||
Action action = event.getAction();
|
Action action = event.getAction();
|
||||||
if (action == Action.LEFT_CLICK_BLOCK) {
|
if (action == Action.LEFT_CLICK_BLOCK) {
|
||||||
final Block clickedBlock = event.getClickedBlock();
|
final Block clickedBlock = event.getClickedBlock();
|
||||||
final WorldVector pos = new WorldVector(world, clickedBlock.getX(),
|
final WorldVector pos = new WorldVector(LocalWorldAdapter.wrap(world), clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ());
|
||||||
clickedBlock.getY(), clickedBlock.getZ());
|
|
||||||
|
|
||||||
if (we.handleBlockLeftClick(player, pos)) {
|
if (we.handleBlockLeftClick(player, pos)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -160,7 +159,7 @@ public class WorldEditListener implements Listener {
|
|||||||
|
|
||||||
} else if (action == Action.RIGHT_CLICK_BLOCK) {
|
} else if (action == Action.RIGHT_CLICK_BLOCK) {
|
||||||
final Block clickedBlock = event.getClickedBlock();
|
final Block clickedBlock = event.getClickedBlock();
|
||||||
final WorldVector pos = new WorldVector(world, clickedBlock.getX(),
|
final WorldVector pos = new WorldVector(LocalWorldAdapter.wrap(world), clickedBlock.getX(),
|
||||||
clickedBlock.getY(), clickedBlock.getZ());
|
clickedBlock.getY(), clickedBlock.getZ());
|
||||||
|
|
||||||
if (we.handleBlockRightClick(player, pos)) {
|
if (we.handleBlockRightClick(player, pos)) {
|
||||||
|
@ -70,6 +70,7 @@ import com.sk89q.worldedit.util.Countable;
|
|||||||
import com.sk89q.worldedit.util.TreeGenerator;
|
import com.sk89q.worldedit.util.TreeGenerator;
|
||||||
import com.sk89q.worldedit.util.collection.DoubleArrayList;
|
import com.sk89q.worldedit.util.collection.DoubleArrayList;
|
||||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -100,7 +101,7 @@ public class EditSession implements Extent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ProtectedField")
|
@SuppressWarnings("ProtectedField")
|
||||||
protected final LocalWorld world;
|
protected final World world;
|
||||||
private final ChangeSet changeSet = new BlockOptimizedHistory();
|
private final ChangeSet changeSet = new BlockOptimizedHistory();
|
||||||
|
|
||||||
private final FastModeExtent fastModeExtent;
|
private final FastModeExtent fastModeExtent;
|
||||||
@ -147,7 +148,7 @@ public class EditSession implements Extent {
|
|||||||
* @param blockBag an optional {@link BlockBag} to use, otherwise null
|
* @param blockBag an optional {@link BlockBag} to use, otherwise null
|
||||||
* @param event the event to call with the extent
|
* @param event the event to call with the extent
|
||||||
*/
|
*/
|
||||||
EditSession(EventBus eventBus, LocalWorld world, int maxBlocks, @Nullable BlockBag blockBag, EditSessionEvent event) {
|
EditSession(EventBus eventBus, World world, int maxBlocks, @Nullable BlockBag blockBag, EditSessionEvent event) {
|
||||||
checkNotNull(eventBus);
|
checkNotNull(eventBus);
|
||||||
checkNotNull(world);
|
checkNotNull(world);
|
||||||
checkArgument(maxBlocks >= -1, "maxBlocks >= -1 required");
|
checkArgument(maxBlocks >= -1, "maxBlocks >= -1 required");
|
||||||
@ -164,7 +165,7 @@ public class EditSession implements Extent {
|
|||||||
extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE);
|
extent = wrapExtent(extent, eventBus, event, Stage.BEFORE_CHANGE);
|
||||||
extent = quirkExtent = new BlockQuirkExtent(extent, world);
|
extent = quirkExtent = new BlockQuirkExtent(extent, world);
|
||||||
extent = validator = new DataValidatorExtent(extent, world);
|
extent = validator = new DataValidatorExtent(extent, world);
|
||||||
extent = blockBagExtent = new BlockBagExtent(extent, world, blockBag);
|
extent = blockBagExtent = new BlockBagExtent(extent, blockBag);
|
||||||
|
|
||||||
// This extent can be skipped by calling rawSetBlock()
|
// This extent can be skipped by calling rawSetBlock()
|
||||||
extent = reorderExtent = new MultiStageReorder(extent, false);
|
extent = reorderExtent = new MultiStageReorder(extent, false);
|
||||||
@ -193,7 +194,7 @@ public class EditSession implements Extent {
|
|||||||
*
|
*
|
||||||
* @return the world
|
* @return the world
|
||||||
*/
|
*/
|
||||||
public LocalWorld getWorld() {
|
public World getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit;
|
|||||||
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
import com.sk89q.worldedit.event.extent.EditSessionEvent;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
@ -35,16 +36,26 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class EditSessionFactory {
|
public class EditSessionFactory {
|
||||||
|
|
||||||
/**
|
@Deprecated
|
||||||
* Construct an edit session with a maximum number of blocks.
|
|
||||||
*
|
|
||||||
* @param world the world
|
|
||||||
* @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit
|
|
||||||
*/
|
|
||||||
public EditSession getEditSession(LocalWorld world, int maxBlocks) {
|
public EditSession getEditSession(LocalWorld world, int maxBlocks) {
|
||||||
|
return getEditSession((World) world, maxBlocks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct an edit session with a maximum number of blocks.
|
||||||
|
*
|
||||||
|
* @param world the world
|
||||||
|
* @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit
|
||||||
|
*/
|
||||||
|
public EditSession getEditSession(World world, int maxBlocks) {
|
||||||
throw new IllegalArgumentException("This class is being removed");
|
throw new IllegalArgumentException("This class is being removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public EditSession getEditSession(LocalWorld world, int maxBlocks, LocalPlayer player) {
|
||||||
|
return getEditSession((World) world, maxBlocks, player);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an edit session with a maximum number of blocks.
|
* Construct an edit session with a maximum number of blocks.
|
||||||
*
|
*
|
||||||
@ -52,10 +63,15 @@ public class EditSessionFactory {
|
|||||||
* @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit
|
* @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit
|
||||||
* @param player the player that the {@link EditSession} is for
|
* @param player the player that the {@link EditSession} is for
|
||||||
*/
|
*/
|
||||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, LocalPlayer player) {
|
public EditSession getEditSession(World world, int maxBlocks, LocalPlayer player) {
|
||||||
throw new IllegalArgumentException("This class is being removed");
|
throw new IllegalArgumentException("This class is being removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag) {
|
||||||
|
return getEditSession((World) world, maxBlocks, blockBag);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an edit session with a maximum number of blocks and a block bag.
|
* Construct an edit session with a maximum number of blocks and a block bag.
|
||||||
*
|
*
|
||||||
@ -63,10 +79,15 @@ public class EditSessionFactory {
|
|||||||
* @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit
|
* @param maxBlocks the maximum number of blocks that can be changed, or -1 to use no limit
|
||||||
* @param blockBag an optional {@link BlockBag} to use, otherwise null
|
* @param blockBag an optional {@link BlockBag} to use, otherwise null
|
||||||
*/
|
*/
|
||||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag) {
|
public EditSession getEditSession(World world, int maxBlocks, BlockBag blockBag) {
|
||||||
throw new IllegalArgumentException("This class is being removed");
|
throw new IllegalArgumentException("This class is being removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag, LocalPlayer player) {
|
||||||
|
return getEditSession((World) world, maxBlocks, blockBag, player);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an edit session with a maximum number of blocks and a block bag.
|
* Construct an edit session with a maximum number of blocks and a block bag.
|
||||||
*
|
*
|
||||||
@ -75,7 +96,7 @@ public class EditSessionFactory {
|
|||||||
* @param blockBag an optional {@link BlockBag} to use, otherwise null
|
* @param blockBag an optional {@link BlockBag} to use, otherwise null
|
||||||
* @param player the player that the {@link EditSession} is for
|
* @param player the player that the {@link EditSession} is for
|
||||||
*/
|
*/
|
||||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag, LocalPlayer player) {
|
public EditSession getEditSession(World world, int maxBlocks, BlockBag blockBag, LocalPlayer player) {
|
||||||
throw new IllegalArgumentException("This class is being removed");
|
throw new IllegalArgumentException("This class is being removed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,22 +118,22 @@ public class EditSessionFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EditSession getEditSession(LocalWorld world, int maxBlocks) {
|
public EditSession getEditSession(World world, int maxBlocks) {
|
||||||
return new EditSession(eventBus, world, maxBlocks, null, new EditSessionEvent(world, null, maxBlocks, null));
|
return new EditSession(eventBus, world, maxBlocks, null, new EditSessionEvent(world, null, maxBlocks, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, LocalPlayer player) {
|
public EditSession getEditSession(World world, int maxBlocks, LocalPlayer player) {
|
||||||
return new EditSession(eventBus, world, maxBlocks, null, new EditSessionEvent(world, player, maxBlocks, null));
|
return new EditSession(eventBus, world, maxBlocks, null, new EditSessionEvent(world, player, maxBlocks, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag) {
|
public EditSession getEditSession(World world, int maxBlocks, BlockBag blockBag) {
|
||||||
return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, null, maxBlocks, null));
|
return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, null, maxBlocks, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EditSession getEditSession(LocalWorld world, int maxBlocks, BlockBag blockBag, LocalPlayer player) {
|
public EditSession getEditSession(World world, int maxBlocks, BlockBag blockBag, LocalPlayer player) {
|
||||||
return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, player, maxBlocks, null));
|
return new EditSession(eventBus, world, maxBlocks, blockBag, new EditSessionEvent(world, player, maxBlocks, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import com.sk89q.worldedit.command.tool.BlockTool;
|
|||||||
import com.sk89q.worldedit.command.tool.BrushTool;
|
import com.sk89q.worldedit.command.tool.BrushTool;
|
||||||
import com.sk89q.worldedit.command.tool.SinglePickaxe;
|
import com.sk89q.worldedit.command.tool.SinglePickaxe;
|
||||||
import com.sk89q.worldedit.command.tool.Tool;
|
import com.sk89q.worldedit.command.tool.Tool;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
||||||
@ -36,6 +37,7 @@ import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
import com.sk89q.worldedit.session.request.Request;
|
import com.sk89q.worldedit.session.request.Request;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
import com.sk89q.worldedit.world.snapshot.Snapshot;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -175,6 +177,11 @@ public class LocalSession {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public RegionSelector getRegionSelector(LocalWorld world) {
|
||||||
|
return getRegionSelector((World) world);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the region selector for defining the selection. If the selection
|
* Get the region selector for defining the selection. If the selection
|
||||||
* was defined for a different world, the old selection will be discarded.
|
* was defined for a different world, the old selection will be discarded.
|
||||||
@ -182,7 +189,7 @@ public class LocalSession {
|
|||||||
* @param world
|
* @param world
|
||||||
* @return position
|
* @return position
|
||||||
*/
|
*/
|
||||||
public RegionSelector getRegionSelector(LocalWorld world) {
|
public RegionSelector getRegionSelector(World world) {
|
||||||
if (selector.getIncompleteRegion().getWorld() == null) {
|
if (selector.getIncompleteRegion().getWorld() == null) {
|
||||||
selector = new CuboidRegionSelector(world);
|
selector = new CuboidRegionSelector(world);
|
||||||
} else if (!selector.getIncompleteRegion().getWorld().equals(world)) {
|
} else if (!selector.getIncompleteRegion().getWorld().equals(world)) {
|
||||||
@ -203,13 +210,18 @@ public class LocalSession {
|
|||||||
return selector;
|
return selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void setRegionSelector(LocalWorld world, RegionSelector selector) {
|
||||||
|
setRegionSelector((World) world, selector);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the region selector.
|
* Set the region selector.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @param selector
|
* @param selector
|
||||||
*/
|
*/
|
||||||
public void setRegionSelector(LocalWorld world, RegionSelector selector) {
|
public void setRegionSelector(World world, RegionSelector selector) {
|
||||||
selector.getIncompleteRegion().setWorld(world);
|
selector.getIncompleteRegion().setWorld(world);
|
||||||
this.selector = selector;
|
this.selector = selector;
|
||||||
}
|
}
|
||||||
@ -224,13 +236,18 @@ public class LocalSession {
|
|||||||
return selector.isDefined();
|
return selector.isDefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public boolean isSelectionDefined(LocalWorld world) {
|
||||||
|
return isSelectionDefined((World) world);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the region is fully defined for the specified world.
|
* Returns true if the region is fully defined for the specified world.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isSelectionDefined(LocalWorld world) {
|
public boolean isSelectionDefined(World world) {
|
||||||
if (selector.getIncompleteRegion().getWorld() == null || !selector.getIncompleteRegion().getWorld().equals(world)) {
|
if (selector.getIncompleteRegion().getWorld() == null || !selector.getIncompleteRegion().getWorld().equals(world)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -248,6 +265,11 @@ public class LocalSession {
|
|||||||
return selector.getRegion();
|
return selector.getRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Region getSelection(LocalWorld world) throws IncompleteRegionException {
|
||||||
|
return getSelection((World) world);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the selection region. If you change the region, you should
|
* Get the selection region. If you change the region, you should
|
||||||
* call learnRegionChanges(). If the selection is defined in
|
* call learnRegionChanges(). If the selection is defined in
|
||||||
@ -258,7 +280,7 @@ public class LocalSession {
|
|||||||
* @return region
|
* @return region
|
||||||
* @throws IncompleteRegionException
|
* @throws IncompleteRegionException
|
||||||
*/
|
*/
|
||||||
public Region getSelection(LocalWorld world) throws IncompleteRegionException {
|
public Region getSelection(World world) throws IncompleteRegionException {
|
||||||
if (selector.getIncompleteRegion().getWorld() == null || !selector.getIncompleteRegion().getWorld().equals(world)) {
|
if (selector.getIncompleteRegion().getWorld() == null || !selector.getIncompleteRegion().getWorld().equals(world)) {
|
||||||
throw new IncompleteRegionException();
|
throw new IncompleteRegionException();
|
||||||
}
|
}
|
||||||
@ -270,7 +292,7 @@ public class LocalSession {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public LocalWorld getSelectionWorld() {
|
public World getSelectionWorld() {
|
||||||
return selector.getIncompleteRegion().getWorld();
|
return selector.getIncompleteRegion().getWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,7 +566,7 @@ public class LocalSession {
|
|||||||
* @param player
|
* @param player
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
public void dispatchCUIEvent(LocalPlayer player, CUIEvent event) {
|
public void dispatchCUIEvent(Actor player, CUIEvent event) {
|
||||||
if (hasCUISupport) {
|
if (hasCUISupport) {
|
||||||
player.dispatchCUIEvent(event);
|
player.dispatchCUIEvent(event);
|
||||||
}
|
}
|
||||||
@ -585,7 +607,7 @@ public class LocalSession {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void describeCUI(LocalPlayer player) {
|
public void describeCUI(Actor player) {
|
||||||
if (!hasCUISupport) {
|
if (!hasCUISupport) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -19,30 +19,23 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.command;
|
package com.sk89q.worldedit.command;
|
||||||
|
|
||||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.sk89q.minecraft.util.commands.Command;
|
import com.sk89q.minecraft.util.commands.Command;
|
||||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||||
import com.sk89q.minecraft.util.commands.Logging;
|
import com.sk89q.minecraft.util.commands.Logging;
|
||||||
import com.sk89q.worldedit.BiomeType;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.EditSession;
|
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
|
||||||
import com.sk89q.worldedit.LocalSession;
|
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
|
||||||
import com.sk89q.worldedit.Vector2D;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
|
||||||
import com.sk89q.worldedit.masks.BiomeTypeMask;
|
import com.sk89q.worldedit.masks.BiomeTypeMask;
|
||||||
import com.sk89q.worldedit.masks.InvertedMask;
|
import com.sk89q.worldedit.masks.InvertedMask;
|
||||||
import com.sk89q.worldedit.masks.Mask;
|
import com.sk89q.worldedit.masks.Mask;
|
||||||
import com.sk89q.worldedit.regions.FlatRegion;
|
import com.sk89q.worldedit.regions.FlatRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
|
||||||
|
|
||||||
public class BiomeCommands {
|
public class BiomeCommands {
|
||||||
|
|
||||||
@ -116,7 +109,7 @@ public class BiomeCommands {
|
|||||||
BiomeType biome = player.getWorld().getBiome(player.getPosition().toVector2D());
|
BiomeType biome = player.getWorld().getBiome(player.getPosition().toVector2D());
|
||||||
player.print("Biome: " + biome.getName());
|
player.print("Biome: " + biome.getName());
|
||||||
} else {
|
} else {
|
||||||
LocalWorld world = player.getWorld();
|
World world = player.getWorld();
|
||||||
Region region = session.getSelection(world);
|
Region region = session.getSelection(world);
|
||||||
Set<BiomeType> biomes = new HashSet<BiomeType>();
|
Set<BiomeType> biomes = new HashSet<BiomeType>();
|
||||||
|
|
||||||
@ -180,7 +173,7 @@ public class BiomeCommands {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int affected = 0;
|
int affected = 0;
|
||||||
LocalWorld world = player.getWorld();
|
World world = player.getWorld();
|
||||||
Region region = session.getSelection(world);
|
Region region = session.getSelection(world);
|
||||||
|
|
||||||
if (region instanceof FlatRegion) {
|
if (region instanceof FlatRegion) {
|
||||||
|
@ -19,19 +19,17 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.command;
|
package com.sk89q.worldedit.command;
|
||||||
|
|
||||||
import com.sk89q.minecraft.util.commands.Command;
|
import com.sk89q.minecraft.util.commands.*;
|
||||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
|
||||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
|
||||||
import com.sk89q.minecraft.util.commands.Logging;
|
|
||||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.*;
|
|
||||||
|
|
||||||
import com.sk89q.minecraft.util.commands.NestedCommand;
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.BlockID;
|
import com.sk89q.worldedit.blocks.BlockID;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
|
import static com.sk89q.minecraft.util.commands.Logging.LogMode.PLACEMENT;
|
||||||
|
import static com.sk89q.minecraft.util.commands.Logging.LogMode.REGION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clipboard commands.
|
* Clipboard commands.
|
||||||
@ -103,7 +101,7 @@ public class ClipboardCommands {
|
|||||||
EditSession editSession) throws WorldEditException {
|
EditSession editSession) throws WorldEditException {
|
||||||
|
|
||||||
BaseBlock block = new BaseBlock(BlockID.AIR);
|
BaseBlock block = new BaseBlock(BlockID.AIR);
|
||||||
LocalWorld world = player.getWorld();
|
World world = player.getWorld();
|
||||||
|
|
||||||
if (args.argsLength() > 0) {
|
if (args.argsLength() > 0) {
|
||||||
block = we.getBlock(player, args.getString(0));
|
block = we.getBlock(player, args.getString(0));
|
||||||
@ -176,7 +174,7 @@ public class ClipboardCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args.hasFlag('s')) {
|
if (args.hasFlag('s')) {
|
||||||
LocalWorld world = player.getWorld();
|
World world = player.getWorld();
|
||||||
Vector pos2 = pos.add(clipboard.getSize().subtract(1, 1, 1));
|
Vector pos2 = pos.add(clipboard.getSize().subtract(1, 1, 1));
|
||||||
if (!atOrigin) {
|
if (!atOrigin) {
|
||||||
pos2 = pos2.add(clipboard.getOffset());
|
pos2 = pos2.add(clipboard.getOffset());
|
||||||
|
@ -36,13 +36,13 @@ import com.sk89q.worldedit.CuboidClipboard;
|
|||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
import com.sk89q.worldedit.LocalPlayer;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.Vector2D;
|
import com.sk89q.worldedit.Vector2D;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.BlockType;
|
import com.sk89q.worldedit.blocks.BlockType;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||||
import com.sk89q.worldedit.regions.selector.ConvexPolyhedralRegionSelector;
|
import com.sk89q.worldedit.regions.selector.ConvexPolyhedralRegionSelector;
|
||||||
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||||
@ -215,7 +215,7 @@ public class SelectionCommands {
|
|||||||
|
|
||||||
final Vector min;
|
final Vector min;
|
||||||
final Vector max;
|
final Vector max;
|
||||||
final LocalWorld world = player.getWorld();
|
final World world = player.getWorld();
|
||||||
if (args.hasFlag('s')) {
|
if (args.hasFlag('s')) {
|
||||||
Region region = session.getSelection(world);
|
Region region = session.getSelection(world);
|
||||||
|
|
||||||
@ -733,7 +733,7 @@ public class SelectionCommands {
|
|||||||
public void select(CommandContext args, LocalSession session, LocalPlayer player,
|
public void select(CommandContext args, LocalSession session, LocalPlayer player,
|
||||||
EditSession editSession) throws WorldEditException {
|
EditSession editSession) throws WorldEditException {
|
||||||
|
|
||||||
final LocalWorld world = player.getWorld();
|
final World world = player.getWorld();
|
||||||
if (args.argsLength() == 0) {
|
if (args.argsLength() == 0) {
|
||||||
session.getRegionSelector(world).clear();
|
session.getRegionSelector(world).clear();
|
||||||
session.dispatchCUISelection(player);
|
session.dispatchCUISelection(player);
|
||||||
|
@ -27,6 +27,7 @@ import com.sk89q.worldedit.patterns.Pattern;
|
|||||||
import com.sk89q.worldedit.patterns.SingleBlockPattern;
|
import com.sk89q.worldedit.patterns.SingleBlockPattern;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -176,7 +177,7 @@ public class UtilityCommands {
|
|||||||
|
|
||||||
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
|
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
|
||||||
we.checkMaxRadius(size);
|
we.checkMaxRadius(size);
|
||||||
LocalWorld world = player.getWorld();
|
World world = player.getWorld();
|
||||||
int height = args.argsLength() > 1 ? Math.min((world.getMaxY() + 1), args.getInteger(1) + 2) : (world.getMaxY() + 1);
|
int height = args.argsLength() > 1 ? Math.min((world.getMaxY() + 1), args.getInteger(1) + 2) : (world.getMaxY() + 1);
|
||||||
|
|
||||||
int affected = editSession.removeAbove(
|
int affected = editSession.removeAbove(
|
||||||
@ -198,7 +199,7 @@ public class UtilityCommands {
|
|||||||
|
|
||||||
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
|
int size = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : 1;
|
||||||
we.checkMaxRadius(size);
|
we.checkMaxRadius(size);
|
||||||
LocalWorld world = player.getWorld();
|
World world = player.getWorld();
|
||||||
int height = args.argsLength() > 1 ? Math.min((world.getMaxY() + 1), args.getInteger(1) + 2) : (world.getMaxY() + 1);
|
int height = args.argsLength() > 1 ? Math.min((world.getMaxY() + 1), args.getInteger(1) + 2) : (world.getMaxY() + 1);
|
||||||
|
|
||||||
int affected = editSession.removeBelow(session.getPlacementPosition(player), size, height);
|
int affected = editSession.removeBelow(session.getPlacementPosition(player), size, height);
|
||||||
@ -398,7 +399,7 @@ public class UtilityCommands {
|
|||||||
killed = player.getWorld().killMobs(session.getPlacementPosition(player), radius, flags.flags);
|
killed = player.getWorld().killMobs(session.getPlacementPosition(player), radius, flags.flags);
|
||||||
} else {
|
} else {
|
||||||
killed = 0;
|
killed = 0;
|
||||||
for (LocalWorld world : we.getServer().getWorlds()) {
|
for (World world : we.getServer().getWorlds()) {
|
||||||
killed += world.killMobs(new Vector(), radius, flags.flags);
|
killed += world.killMobs(new Vector(), radius, flags.flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -486,7 +487,7 @@ public class UtilityCommands {
|
|||||||
Vector origin = session.getPlacementPosition(player);
|
Vector origin = session.getPlacementPosition(player);
|
||||||
removed = player.getWorld().removeEntities(type, origin, radius);
|
removed = player.getWorld().removeEntities(type, origin, radius);
|
||||||
} else {
|
} else {
|
||||||
for (LocalWorld world : we.getServer().getWorlds()) {
|
for (World world : we.getServer().getWorlds()) {
|
||||||
removed += world.removeEntities(type, new Vector(), radius);
|
removed += world.removeEntities(type, new Vector(), radius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.command.tool.brush;
|
package com.sk89q.worldedit.command.tool.brush;
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.internal.LocalWorldAdapter;
|
||||||
import com.sk89q.worldedit.math.convolution.HeightMap;
|
import com.sk89q.worldedit.math.convolution.HeightMap;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
@ -43,10 +44,9 @@ public class SmoothBrush implements Brush {
|
|||||||
this.naturalOnly = naturalOnly;
|
this.naturalOnly = naturalOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
|
public void build(EditSession editSession, Vector pos, Pattern mat, double size) throws MaxChangedBlocksException {
|
||||||
throws MaxChangedBlocksException {
|
|
||||||
double rad = size;
|
double rad = size;
|
||||||
WorldVector min = new WorldVector(editSession.getWorld(), pos.subtract(rad, rad, rad));
|
WorldVector min = new WorldVector(LocalWorldAdapter.wrap(editSession.getWorld()), pos.subtract(rad, rad, rad));
|
||||||
Vector max = pos.add(rad, rad + 10, rad);
|
Vector max = pos.add(rad, rad + 10, rad);
|
||||||
Region region = new CuboidRegion(editSession.getWorld(), min, max);
|
Region region = new CuboidRegion(editSession.getWorld(), min, max);
|
||||||
HeightMap heightMap = new HeightMap(editSession, region, naturalOnly);
|
HeightMap heightMap = new HeightMap(editSession, region, naturalOnly);
|
||||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.entity;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reference to an instance of an entity that exists in an {@link Extent}
|
* A reference to an instance of an entity that exists in an {@link Extent}
|
||||||
@ -217,6 +218,6 @@ public interface Entity {
|
|||||||
*
|
*
|
||||||
* @return the world
|
* @return the world
|
||||||
*/
|
*/
|
||||||
LocalWorld getWorld();
|
World getWorld();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
package com.sk89q.worldedit.event.extent;
|
package com.sk89q.worldedit.event.extent;
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.event.Event;
|
import com.sk89q.worldedit.event.Event;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ import static com.sk89q.worldedit.EditSession.Stage;
|
|||||||
*/
|
*/
|
||||||
public class EditSessionEvent extends Event {
|
public class EditSessionEvent extends Event {
|
||||||
|
|
||||||
private final LocalWorld world;
|
private final World world;
|
||||||
private final Actor actor;
|
private final Actor actor;
|
||||||
private final int maxBlocks;
|
private final int maxBlocks;
|
||||||
private final Stage stage;
|
private final Stage stage;
|
||||||
@ -73,7 +73,7 @@ public class EditSessionEvent extends Event {
|
|||||||
* @param maxBlocks the maximum number of block changes
|
* @param maxBlocks the maximum number of block changes
|
||||||
* @param stage the stage
|
* @param stage the stage
|
||||||
*/
|
*/
|
||||||
public EditSessionEvent(LocalWorld world, Actor actor, int maxBlocks, Stage stage) {
|
public EditSessionEvent(World world, Actor actor, int maxBlocks, Stage stage) {
|
||||||
checkNotNull(world);
|
checkNotNull(world);
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.actor = actor;
|
this.actor = actor;
|
||||||
@ -95,7 +95,7 @@ public class EditSessionEvent extends Event {
|
|||||||
*
|
*
|
||||||
* @return the world
|
* @return the world
|
||||||
*/
|
*/
|
||||||
public LocalWorld getWorld() {
|
public World getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,12 +19,11 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extension.input;
|
package com.sk89q.worldedit.extension.input;
|
||||||
|
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extension.registry.MaskRegistry;
|
import com.sk89q.worldedit.extension.registry.MaskRegistry;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ public class ParserContext {
|
|||||||
|
|
||||||
private @Nullable Extent extent;
|
private @Nullable Extent extent;
|
||||||
private @Nullable LocalSession session;
|
private @Nullable LocalSession session;
|
||||||
private @Nullable LocalWorld world;
|
private @Nullable World world;
|
||||||
private @Nullable Actor actor;
|
private @Nullable Actor actor;
|
||||||
private boolean restricted = true;
|
private boolean restricted = true;
|
||||||
private boolean preferringWildcard;
|
private boolean preferringWildcard;
|
||||||
@ -80,11 +79,11 @@ public class ParserContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link LocalWorld} set on this context.
|
* Get the {@link World} set on this context.
|
||||||
*
|
*
|
||||||
* @return a world
|
* @return a world
|
||||||
*/
|
*/
|
||||||
public @Nullable LocalWorld getWorld() {
|
public @Nullable World getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ public class ParserContext {
|
|||||||
*
|
*
|
||||||
* @param world a world, or null if none is available
|
* @param world a world, or null if none is available
|
||||||
*/
|
*/
|
||||||
public void setWorld(@Nullable LocalWorld world) {
|
public void setWorld(@Nullable World world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,13 +143,13 @@ public class ParserContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link LocalWorld} set on this context.
|
* Get the {@link World} set on this context.
|
||||||
*
|
*
|
||||||
* @return a world
|
* @return a world
|
||||||
* @throws InputParseException thrown if no {@link LocalWorld} is set
|
* @throws InputParseException thrown if no {@link World} is set
|
||||||
*/
|
*/
|
||||||
public LocalWorld requireWorld() throws InputParseException {
|
public World requireWorld() throws InputParseException {
|
||||||
LocalWorld world = getWorld();
|
World world = getWorld();
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
throw new InputParseException("No world is known");
|
throw new InputParseException("No world is known");
|
||||||
}
|
}
|
||||||
@ -161,7 +160,7 @@ public class ParserContext {
|
|||||||
* Get the {@link Actor} set on this context.
|
* Get the {@link Actor} set on this context.
|
||||||
*
|
*
|
||||||
* @return an actor
|
* @return an actor
|
||||||
* @throws InputParseException thrown if no {@link LocalPlayer} is set
|
* @throws InputParseException thrown if no {@link Actor} is set
|
||||||
*/
|
*/
|
||||||
public Actor requireActor() throws InputParseException {
|
public Actor requireActor() throws InputParseException {
|
||||||
Actor actor = getActor();
|
Actor actor = getActor();
|
||||||
|
@ -22,7 +22,7 @@ package com.sk89q.worldedit.extension.platform;
|
|||||||
import com.sk89q.minecraft.util.commands.Command;
|
import com.sk89q.minecraft.util.commands.Command;
|
||||||
import com.sk89q.minecraft.util.commands.CommandsManager;
|
import com.sk89q.minecraft.util.commands.CommandsManager;
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
import com.sk89q.worldedit.LocalPlayer;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -38,7 +38,7 @@ public abstract class AbstractPlatform implements Platform {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LocalWorld> getWorlds() {
|
public List<? extends World> getWorlds() {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import com.sk89q.worldedit.blocks.ItemID;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
import com.sk89q.worldedit.util.TargetBlock;
|
import com.sk89q.worldedit.util.TargetBlock;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void findFreePosition(WorldVector searchPos) {
|
public void findFreePosition(WorldVector searchPos) {
|
||||||
LocalWorld world = searchPos.getWorld();
|
World world = searchPos.getWorld();
|
||||||
int x = searchPos.getBlockX();
|
int x = searchPos.getBlockX();
|
||||||
int y = Math.max(0, searchPos.getBlockY());
|
int y = Math.max(0, searchPos.getBlockY());
|
||||||
int origY = y;
|
int origY = y;
|
||||||
@ -126,7 +127,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOnGround(WorldVector searchPos) {
|
public void setOnGround(WorldVector searchPos) {
|
||||||
LocalWorld world = searchPos.getWorld();
|
World world = searchPos.getWorld();
|
||||||
int x = searchPos.getBlockX();
|
int x = searchPos.getBlockX();
|
||||||
int y = Math.max(0, searchPos.getBlockY());
|
int y = Math.max(0, searchPos.getBlockY());
|
||||||
int z = searchPos.getBlockZ();
|
int z = searchPos.getBlockZ();
|
||||||
@ -155,7 +156,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
|
|||||||
final int x = pos.getBlockX();
|
final int x = pos.getBlockX();
|
||||||
int y = Math.max(0, pos.getBlockY());
|
int y = Math.max(0, pos.getBlockY());
|
||||||
final int z = pos.getBlockZ();
|
final int z = pos.getBlockZ();
|
||||||
final LocalWorld world = pos.getWorld();
|
final World world = pos.getWorld();
|
||||||
|
|
||||||
byte free = 0;
|
byte free = 0;
|
||||||
byte spots = 0;
|
byte spots = 0;
|
||||||
@ -196,7 +197,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
|
|||||||
final int x = pos.getBlockX();
|
final int x = pos.getBlockX();
|
||||||
int y = Math.max(0, pos.getBlockY() - 1);
|
int y = Math.max(0, pos.getBlockY() - 1);
|
||||||
final int z = pos.getBlockZ();
|
final int z = pos.getBlockZ();
|
||||||
final LocalWorld world = pos.getWorld();
|
final World world = pos.getWorld();
|
||||||
|
|
||||||
byte free = 0;
|
byte free = 0;
|
||||||
|
|
||||||
@ -247,7 +248,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
|
|||||||
int initialY = Math.max(0, pos.getBlockY());
|
int initialY = Math.max(0, pos.getBlockY());
|
||||||
int y = Math.max(0, pos.getBlockY() + 2);
|
int y = Math.max(0, pos.getBlockY() + 2);
|
||||||
int z = pos.getBlockZ();
|
int z = pos.getBlockZ();
|
||||||
LocalWorld world = getPosition().getWorld();
|
World world = getPosition().getWorld();
|
||||||
|
|
||||||
// No free space above
|
// No free space above
|
||||||
if (world.getBlockType(new Vector(x, y, z)) != 0) {
|
if (world.getBlockType(new Vector(x, y, z)) != 0) {
|
||||||
@ -281,7 +282,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
|
|||||||
int y = Math.max(0, pos.getBlockY() + 1);
|
int y = Math.max(0, pos.getBlockY() + 1);
|
||||||
final int z = pos.getBlockZ();
|
final int z = pos.getBlockZ();
|
||||||
final int maxY = Math.min(getWorld().getMaxY() + 1, initialY + distance);
|
final int maxY = Math.min(getWorld().getMaxY() + 1, initialY + distance);
|
||||||
final LocalWorld world = getPosition().getWorld();
|
final World world = getPosition().getWorld();
|
||||||
|
|
||||||
while (y <= world.getMaxY() + 2) {
|
while (y <= world.getMaxY() + 2) {
|
||||||
if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) {
|
if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) {
|
||||||
@ -383,7 +384,7 @@ public abstract class AbstractPlayerActor implements Actor, Player {
|
|||||||
public boolean passThroughForwardWall(int range) {
|
public boolean passThroughForwardWall(int range) {
|
||||||
int searchDist = 0;
|
int searchDist = 0;
|
||||||
TargetBlock hitBlox = new TargetBlock(this, range, 0.2);
|
TargetBlock hitBlox = new TargetBlock(this, range, 0.2);
|
||||||
LocalWorld world = getPosition().getWorld();
|
World world = getPosition().getWorld();
|
||||||
BlockWorldVector block;
|
BlockWorldVector block;
|
||||||
boolean firstBlock = true;
|
boolean firstBlock = true;
|
||||||
int freeToFind = 2;
|
int freeToFind = 2;
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extension.platform;
|
package com.sk89q.worldedit.extension.platform;
|
||||||
|
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.WorldEditPermissionException;
|
import com.sk89q.worldedit.WorldEditPermissionException;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
import com.sk89q.worldedit.internal.cui.CUIEvent;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public interface Actor {
|
|||||||
*
|
*
|
||||||
* @return the world
|
* @return the world
|
||||||
*/
|
*/
|
||||||
LocalWorld getWorld();
|
World getWorld();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a message.
|
* Print a message.
|
||||||
|
@ -24,7 +24,7 @@ import com.sk89q.minecraft.util.commands.CommandsManager;
|
|||||||
import com.sk89q.worldedit.BiomeTypes;
|
import com.sk89q.worldedit.BiomeTypes;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
import com.sk89q.worldedit.LocalPlayer;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ public interface Platform {
|
|||||||
*/
|
*/
|
||||||
int schedule(long delay, long period, Runnable task);
|
int schedule(long delay, long period, Runnable task);
|
||||||
|
|
||||||
List<LocalWorld> getWorlds();
|
List<? extends World> getWorlds();
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
void onCommandRegistration(List<Command> commands);
|
void onCommandRegistration(List<Command> commands);
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.extension.platform;
|
|||||||
import com.sk89q.minecraft.util.commands.Command;
|
import com.sk89q.minecraft.util.commands.Command;
|
||||||
import com.sk89q.minecraft.util.commands.CommandsManager;
|
import com.sk89q.minecraft.util.commands.CommandsManager;
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -70,7 +71,7 @@ class ServerInterfaceAdapter extends ServerInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LocalWorld> getWorlds() {
|
public List<? extends World> getWorlds() {
|
||||||
return platform.getWorlds();
|
return platform.getWorlds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ import com.sk89q.worldedit.extension.input.NoMatchException;
|
|||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses block input strings.
|
* Parses block input strings.
|
||||||
@ -79,7 +80,7 @@ class DefaultBlockParser extends InputParser<BaseBlock> {
|
|||||||
data = blockInHand.getData();
|
data = blockInHand.getData();
|
||||||
} else if ("pos1".equalsIgnoreCase(testID)) {
|
} else if ("pos1".equalsIgnoreCase(testID)) {
|
||||||
// Get the block type from the "primary position"
|
// Get the block type from the "primary position"
|
||||||
final LocalWorld world = context.requireWorld();
|
final World world = context.requireWorld();
|
||||||
final BlockVector primaryPosition;
|
final BlockVector primaryPosition;
|
||||||
try {
|
try {
|
||||||
primaryPosition = context.requireSession().getRegionSelector(world).getPrimaryPosition();
|
primaryPosition = context.requireSession().getRegionSelector(world).getPrimaryPosition();
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extent.inventory;
|
package com.sk89q.worldedit.extent.inventory;
|
||||||
|
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -37,7 +37,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class BlockBagExtent extends AbstractDelegateExtent {
|
public class BlockBagExtent extends AbstractDelegateExtent {
|
||||||
|
|
||||||
private final LocalWorld world;
|
|
||||||
private Map<Integer, Integer> missingBlocks = new HashMap<Integer, Integer>();
|
private Map<Integer, Integer> missingBlocks = new HashMap<Integer, Integer>();
|
||||||
private BlockBag blockBag;
|
private BlockBag blockBag;
|
||||||
|
|
||||||
@ -48,10 +47,8 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
|||||||
* @param world the world
|
* @param world the world
|
||||||
* @param blockBag the block bag
|
* @param blockBag the block bag
|
||||||
*/
|
*/
|
||||||
public BlockBagExtent(Extent extent, LocalWorld world, @Nullable BlockBag blockBag) {
|
public BlockBagExtent(Extent extent, @Nullable BlockBag blockBag) {
|
||||||
super(extent);
|
super(extent);
|
||||||
checkNotNull(world);
|
|
||||||
this.world = world;
|
|
||||||
this.blockBag = blockBag;
|
this.blockBag = blockBag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extent.validation;
|
package com.sk89q.worldedit.extent.validation;
|
||||||
|
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class DataValidatorExtent extends AbstractDelegateExtent {
|
public class DataValidatorExtent extends AbstractDelegateExtent {
|
||||||
|
|
||||||
private final LocalWorld world;
|
private final World world;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
@ -41,7 +41,7 @@ public class DataValidatorExtent extends AbstractDelegateExtent {
|
|||||||
* @param extent the extent
|
* @param extent the extent
|
||||||
* @param world the world
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
public DataValidatorExtent(Extent extent, LocalWorld world) {
|
public DataValidatorExtent(Extent extent, World world) {
|
||||||
super(extent);
|
super(extent);
|
||||||
checkNotNull(world);
|
checkNotNull(world);
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extent.world;
|
package com.sk89q.worldedit.extent.world;
|
||||||
|
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
@ -27,6 +26,7 @@ import com.sk89q.worldedit.blocks.BlockID;
|
|||||||
import com.sk89q.worldedit.blocks.BlockType;
|
import com.sk89q.worldedit.blocks.BlockType;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class BlockQuirkExtent extends AbstractDelegateExtent {
|
public class BlockQuirkExtent extends AbstractDelegateExtent {
|
||||||
|
|
||||||
private final LocalWorld world;
|
private final World world;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
@ -44,7 +44,7 @@ public class BlockQuirkExtent extends AbstractDelegateExtent {
|
|||||||
* @param extent the extent
|
* @param extent the extent
|
||||||
* @param world the world
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
public BlockQuirkExtent(Extent extent, LocalWorld world) {
|
public BlockQuirkExtent(Extent extent, World world) {
|
||||||
super(extent);
|
super(extent);
|
||||||
checkNotNull(world);
|
checkNotNull(world);
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extent.world;
|
package com.sk89q.worldedit.extent.world;
|
||||||
|
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class ChunkLoadingExtent extends AbstractDelegateExtent {
|
public class ChunkLoadingExtent extends AbstractDelegateExtent {
|
||||||
|
|
||||||
private final LocalWorld world;
|
private final World world;
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,7 +43,7 @@ public class ChunkLoadingExtent extends AbstractDelegateExtent {
|
|||||||
* @param world the world
|
* @param world the world
|
||||||
* @param enabled true to enable
|
* @param enabled true to enable
|
||||||
*/
|
*/
|
||||||
public ChunkLoadingExtent(Extent extent, LocalWorld world, boolean enabled) {
|
public ChunkLoadingExtent(Extent extent, World world, boolean enabled) {
|
||||||
super(extent);
|
super(extent);
|
||||||
checkNotNull(world);
|
checkNotNull(world);
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
@ -56,7 +56,7 @@ public class ChunkLoadingExtent extends AbstractDelegateExtent {
|
|||||||
* @param extent the extent
|
* @param extent the extent
|
||||||
* @param world the world
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
public ChunkLoadingExtent(Extent extent, LocalWorld world) {
|
public ChunkLoadingExtent(Extent extent, World world) {
|
||||||
this(extent, world, true);
|
this(extent, world, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,13 +20,13 @@
|
|||||||
package com.sk89q.worldedit.extent.world;
|
package com.sk89q.worldedit.extent.world;
|
||||||
|
|
||||||
import com.sk89q.worldedit.BlockVector2D;
|
import com.sk89q.worldedit.BlockVector2D;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||||
import com.sk89q.worldedit.function.operation.Operation;
|
import com.sk89q.worldedit.function.operation.Operation;
|
||||||
import com.sk89q.worldedit.function.operation.RunContext;
|
import com.sk89q.worldedit.function.operation.RunContext;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -38,7 +38,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||||||
*/
|
*/
|
||||||
public class FastModeExtent extends AbstractDelegateExtent {
|
public class FastModeExtent extends AbstractDelegateExtent {
|
||||||
|
|
||||||
private final LocalWorld world;
|
private final World world;
|
||||||
private final Set<BlockVector2D> dirtyChunks = new HashSet<BlockVector2D>();
|
private final Set<BlockVector2D> dirtyChunks = new HashSet<BlockVector2D>();
|
||||||
private boolean enabled = true;
|
private boolean enabled = true;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public class FastModeExtent extends AbstractDelegateExtent {
|
|||||||
*
|
*
|
||||||
* @param world the world
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
public FastModeExtent(LocalWorld world) {
|
public FastModeExtent(World world) {
|
||||||
this(world, true);
|
this(world, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ public class FastModeExtent extends AbstractDelegateExtent {
|
|||||||
* @param world the world
|
* @param world the world
|
||||||
* @param enabled true to enable fast mode
|
* @param enabled true to enable fast mode
|
||||||
*/
|
*/
|
||||||
public FastModeExtent(LocalWorld world, boolean enabled) {
|
public FastModeExtent(World world, boolean enabled) {
|
||||||
super(world);
|
super(world);
|
||||||
checkNotNull(world);
|
checkNotNull(world);
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
316
src/main/java/com/sk89q/worldedit/internal/LocalWorldAdapter.java
Normale Datei
316
src/main/java/com/sk89q/worldedit/internal/LocalWorldAdapter.java
Normale Datei
@ -0,0 +1,316 @@
|
|||||||
|
/*
|
||||||
|
* WorldEdit, a Minecraft world manipulation toolkit
|
||||||
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||||
|
* Copyright (C) WorldEdit team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
* Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sk89q.worldedit.internal;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||||
|
import com.sk89q.worldedit.function.mask.Mask;
|
||||||
|
import com.sk89q.worldedit.function.operation.Operation;
|
||||||
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps {@link World}s into {@link LocalWorld}.
|
||||||
|
*/
|
||||||
|
public class LocalWorldAdapter extends LocalWorld {
|
||||||
|
|
||||||
|
private final World world;
|
||||||
|
|
||||||
|
private LocalWorldAdapter(World world) {
|
||||||
|
checkNotNull(world);
|
||||||
|
this.world = world;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return world.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxY() {
|
||||||
|
return world.getMaxY();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidBlockType(int id) {
|
||||||
|
return world.isValidBlockType(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean usesBlockData(int id) {
|
||||||
|
return world.usesBlockData(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mask createLiquidMask() {
|
||||||
|
return world.createLiquidMask();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public int getBlockType(Vector pt) {
|
||||||
|
return world.getBlockType(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public int getBlockData(Vector pt) {
|
||||||
|
return world.getBlockData(pt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) {
|
||||||
|
return world.setBlock(position, block, notifyAndLight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean setBlockType(Vector position, int type) {
|
||||||
|
return world.setBlockType(position, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean setBlockTypeFast(Vector position, int type) {
|
||||||
|
return world.setBlockTypeFast(position, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public void setBlockData(Vector position, int data) {
|
||||||
|
world.setBlockData(position, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public void setBlockDataFast(Vector position, int data) {
|
||||||
|
world.setBlockDataFast(position, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean setTypeIdAndData(Vector position, int type, int data) {
|
||||||
|
return world.setTypeIdAndData(position, type, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean setTypeIdAndDataFast(Vector position, int type, int data) {
|
||||||
|
return world.setTypeIdAndDataFast(position, type, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBlockLightLevel(Vector position) {
|
||||||
|
return world.getBlockLightLevel(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean clearContainerBlockContents(Vector position) {
|
||||||
|
return world.clearContainerBlockContents(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BiomeType getBiome(Vector2D position) {
|
||||||
|
return world.getBiome(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBiome(Vector2D position, BiomeType biome) {
|
||||||
|
world.setBiome(position, biome);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dropItem(Vector position, BaseItemStack item, int count) {
|
||||||
|
world.dropItem(position, item, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dropItem(Vector position, BaseItemStack item) {
|
||||||
|
world.dropItem(position, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simulateBlockMine(Vector position) {
|
||||||
|
world.simulateBlockMine(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalEntity[] getEntities(Region region) {
|
||||||
|
return world.getEntities(region);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int killEntities(LocalEntity... entity) {
|
||||||
|
return world.killEntities(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public int killMobs(Vector origin, int radius) {
|
||||||
|
return world.killMobs(origin, radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public int killMobs(Vector origin, int radius, boolean killPets) {
|
||||||
|
return world.killMobs(origin, radius, killPets);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int killMobs(Vector origin, double radius, int flags) {
|
||||||
|
return world.killMobs(origin, radius, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int removeEntities(EntityType type, Vector origin, int radius) {
|
||||||
|
return world.removeEntities(type, origin, radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean regenerate(Region region, EditSession editSession) {
|
||||||
|
return world.regenerate(region, editSession);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean generateTree(TreeType type, EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
||||||
|
return world.generateTree(type, editSession, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean generateTree(EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
||||||
|
return world.generateTree(editSession, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean generateBigTree(EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
||||||
|
return world.generateBigTree(editSession, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean generateBirchTree(EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
||||||
|
return world.generateBirchTree(editSession, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean generateRedwoodTree(EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
||||||
|
return world.generateRedwoodTree(editSession, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean generateTallRedwoodTree(EditSession editSession, Vector position) throws MaxChangedBlocksException {
|
||||||
|
return world.generateTallRedwoodTree(editSession, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkLoadedChunk(Vector position) {
|
||||||
|
world.checkLoadedChunk(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fixAfterFastMode(Iterable<BlockVector2D> chunks) {
|
||||||
|
world.fixAfterFastMode(chunks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fixLighting(Iterable<BlockVector2D> chunks) {
|
||||||
|
world.fixLighting(chunks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean playEffect(Vector position, int type, int data) {
|
||||||
|
return world.playEffect(position, type, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queueBlockBreakEffect(ServerInterface server, Vector position, int blockId, double priority) {
|
||||||
|
return world.queueBlockBreakEffect(server, position, blockId, priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
return world.equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return world.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vector getMinimumPoint() {
|
||||||
|
return world.getMinimumPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Vector getMaximumPoint() {
|
||||||
|
return world.getMaximumPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseBlock getBlock(Vector position) {
|
||||||
|
return world.getBlock(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean copyFromWorld(Vector position, BaseBlock block) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean copyToWorld(Vector position, BaseBlock block) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseBlock getLazyBlock(Vector position) {
|
||||||
|
return world.getLazyBlock(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setBlock(Vector position, BaseBlock block) {
|
||||||
|
try {
|
||||||
|
return world.setBlock(position, block);
|
||||||
|
} catch (WorldEditException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public Operation commit() {
|
||||||
|
return world.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalWorldAdapter wrap(World world) {
|
||||||
|
return new LocalWorldAdapter(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.internal.cui;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
import com.sk89q.worldedit.LocalPlayer;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
|
|
||||||
public interface CUIRegion {
|
public interface CUIRegion {
|
||||||
|
|
||||||
@ -30,7 +31,7 @@ public interface CUIRegion {
|
|||||||
* value supplied by getProtocolVersion().
|
* value supplied by getProtocolVersion().
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void describeCUI(LocalSession session, LocalPlayer player);
|
public void describeCUI(LocalSession session, Actor player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends CUI events describing the region for
|
* Sends CUI events describing the region for
|
||||||
@ -38,7 +39,7 @@ public interface CUIRegion {
|
|||||||
* supplied by getProtocolVersion().
|
* supplied by getProtocolVersion().
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void describeLegacyCUI(LocalSession session, LocalPlayer player);
|
public void describeLegacyCUI(LocalSession session, Actor player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the CUI version that is required to send
|
* Returns the CUI version that is required to send
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.regions;
|
|||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.regions.iterator.RegionIterator;
|
import com.sk89q.worldedit.regions.iterator.RegionIterator;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -30,9 +31,9 @@ public abstract class AbstractRegion implements Region {
|
|||||||
/**
|
/**
|
||||||
* Stores the world.
|
* Stores the world.
|
||||||
*/
|
*/
|
||||||
protected LocalWorld world;
|
protected World world;
|
||||||
|
|
||||||
public AbstractRegion(LocalWorld world) {
|
public AbstractRegion(World world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,23 +47,33 @@ public abstract class AbstractRegion implements Region {
|
|||||||
*
|
*
|
||||||
* @return iterator of points inside the region
|
* @return iterator of points inside the region
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Iterator<BlockVector> iterator() {
|
public Iterator<BlockVector> iterator() {
|
||||||
return new RegionIterator(this);
|
return new RegionIterator(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalWorld getWorld() {
|
@Override
|
||||||
|
public World getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setWorld(LocalWorld world) {
|
public void setWorld(LocalWorld world) {
|
||||||
|
setWorld((World) world);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setWorld(World world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void shift(Vector change) throws RegionOperationException {
|
public void shift(Vector change) throws RegionOperationException {
|
||||||
expand(change);
|
expand(change);
|
||||||
contract(change);
|
contract(change);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public AbstractRegion clone() {
|
public AbstractRegion clone() {
|
||||||
try {
|
try {
|
||||||
return (AbstractRegion) super.clone();
|
return (AbstractRegion) super.clone();
|
||||||
@ -95,6 +106,7 @@ public abstract class AbstractRegion implements Region {
|
|||||||
*
|
*
|
||||||
* @return number of blocks
|
* @return number of blocks
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getArea() {
|
public int getArea() {
|
||||||
Vector min = getMinimumPoint();
|
Vector min = getMinimumPoint();
|
||||||
Vector max = getMaximumPoint();
|
Vector max = getMaximumPoint();
|
||||||
@ -109,6 +121,7 @@ public abstract class AbstractRegion implements Region {
|
|||||||
*
|
*
|
||||||
* @return width
|
* @return width
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
Vector min = getMinimumPoint();
|
Vector min = getMinimumPoint();
|
||||||
Vector max = getMaximumPoint();
|
Vector max = getMaximumPoint();
|
||||||
@ -121,6 +134,7 @@ public abstract class AbstractRegion implements Region {
|
|||||||
*
|
*
|
||||||
* @return height
|
* @return height
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
Vector min = getMinimumPoint();
|
Vector min = getMinimumPoint();
|
||||||
Vector max = getMaximumPoint();
|
Vector max = getMaximumPoint();
|
||||||
@ -133,6 +147,7 @@ public abstract class AbstractRegion implements Region {
|
|||||||
*
|
*
|
||||||
* @return length
|
* @return length
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getLength() {
|
public int getLength() {
|
||||||
Vector min = getMinimumPoint();
|
Vector min = getMinimumPoint();
|
||||||
Vector max = getMaximumPoint();
|
Vector max = getMaximumPoint();
|
||||||
@ -145,6 +160,7 @@ public abstract class AbstractRegion implements Region {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Set<Vector2D> getChunks() {
|
public Set<Vector2D> getChunks() {
|
||||||
final Set<Vector2D> chunks = new HashSet<Vector2D>();
|
final Set<Vector2D> chunks = new HashSet<Vector2D>();
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ import com.sk89q.worldedit.LocalWorld;
|
|||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.regions.polyhedron.Edge;
|
import com.sk89q.worldedit.regions.polyhedron.Edge;
|
||||||
import com.sk89q.worldedit.regions.polyhedron.Triangle;
|
import com.sk89q.worldedit.regions.polyhedron.Triangle;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
public class ConvexPolyhedralRegion extends AbstractRegion {
|
public class ConvexPolyhedralRegion extends AbstractRegion {
|
||||||
/**
|
/**
|
||||||
@ -72,6 +73,11 @@ public class ConvexPolyhedralRegion extends AbstractRegion {
|
|||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
*/
|
*/
|
||||||
|
public ConvexPolyhedralRegion(World world) {
|
||||||
|
super(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public ConvexPolyhedralRegion(LocalWorld world) {
|
public ConvexPolyhedralRegion(LocalWorld world) {
|
||||||
super(world);
|
super(world);
|
||||||
}
|
}
|
||||||
@ -79,7 +85,7 @@ public class ConvexPolyhedralRegion extends AbstractRegion {
|
|||||||
/**
|
/**
|
||||||
* Constructs an independent copy of the given region.
|
* Constructs an independent copy of the given region.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param region the region to copy
|
||||||
*/
|
*/
|
||||||
public ConvexPolyhedralRegion(ConvexPolyhedralRegion region) {
|
public ConvexPolyhedralRegion(ConvexPolyhedralRegion region) {
|
||||||
this(region.world);
|
this(region.world);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.regions;
|
package com.sk89q.worldedit.regions;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -47,6 +48,11 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
this(null, pos1, pos2);
|
this(null, pos1, pos2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public CuboidRegion(LocalWorld world, Vector pos1, Vector pos2) {
|
||||||
|
this((World) world, pos1, pos2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new instance of this cuboid using two corners of the cuboid.
|
* Construct a new instance of this cuboid using two corners of the cuboid.
|
||||||
*
|
*
|
||||||
@ -54,7 +60,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
* @param pos1 the first position
|
* @param pos1 the first position
|
||||||
* @param pos2 the second position
|
* @param pos2 the second position
|
||||||
*/
|
*/
|
||||||
public CuboidRegion(LocalWorld world, Vector pos1, Vector pos2) {
|
public CuboidRegion(World world, Vector pos1, Vector pos2) {
|
||||||
super(world);
|
super(world);
|
||||||
checkNotNull(pos1);
|
checkNotNull(pos1);
|
||||||
checkNotNull(pos2);
|
checkNotNull(pos2);
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.regions;
|
|||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.regions.iterator.FlatRegion3DIterator;
|
import com.sk89q.worldedit.regions.iterator.FlatRegion3DIterator;
|
||||||
import com.sk89q.worldedit.regions.iterator.FlatRegionIterator;
|
import com.sk89q.worldedit.regions.iterator.FlatRegionIterator;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -43,19 +44,28 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
|
|||||||
* Construct the region
|
* Construct the region
|
||||||
*/
|
*/
|
||||||
public CylinderRegion() {
|
public CylinderRegion() {
|
||||||
this((LocalWorld) null);
|
this((World) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public CylinderRegion(LocalWorld world) {
|
||||||
|
this((World) world);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Construct the region.
|
* Construct the region.
|
||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
*/
|
*/
|
||||||
public CylinderRegion(LocalWorld world) {
|
public CylinderRegion(World world) {
|
||||||
this(world, new Vector(), new Vector2D(), 0, 0);
|
this(world, new Vector(), new Vector2D(), 0, 0);
|
||||||
hasY = false;
|
hasY = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public CylinderRegion(LocalWorld world, Vector center, Vector2D radius, int minY, int maxY) {
|
||||||
|
this((World) world, center, radius, minY, maxY);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the region.
|
* Construct the region.
|
||||||
*
|
*
|
||||||
@ -65,7 +75,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
|
|||||||
* @param minY
|
* @param minY
|
||||||
* @param maxY
|
* @param maxY
|
||||||
*/
|
*/
|
||||||
public CylinderRegion(LocalWorld world, Vector center, Vector2D radius, int minY, int maxY) {
|
public CylinderRegion(World world, Vector center, Vector2D radius, int minY, int maxY) {
|
||||||
super(world);
|
super(world);
|
||||||
setCenter(center.toVector2D());
|
setCenter(center.toVector2D());
|
||||||
setRadius(radius);
|
setRadius(radius);
|
||||||
|
@ -24,6 +24,7 @@ import com.sk89q.worldedit.BlockVector2D;
|
|||||||
import com.sk89q.worldedit.LocalWorld;
|
import com.sk89q.worldedit.LocalWorld;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.Vector2D;
|
import com.sk89q.worldedit.Vector2D;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.storage.ChunkStore;
|
import com.sk89q.worldedit.world.storage.ChunkStore;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -38,7 +39,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
|||||||
*/
|
*/
|
||||||
private Vector center;
|
private Vector center;
|
||||||
/**
|
/**
|
||||||
* Stores the radiuses plus 0.5 on each axis.
|
* Stores the radii plus 0.5 on each axis.
|
||||||
*/
|
*/
|
||||||
private Vector radius;
|
private Vector radius;
|
||||||
/**
|
/**
|
||||||
@ -51,6 +52,11 @@ public class EllipsoidRegion extends AbstractRegion {
|
|||||||
this(null, pos1, pos2);
|
this(null, pos1, pos2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public EllipsoidRegion(LocalWorld world, Vector center, Vector radius) {
|
||||||
|
this((World) world, center, radius);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new instance of this ellipsoid region.
|
* Construct a new instance of this ellipsoid region.
|
||||||
*
|
*
|
||||||
@ -58,7 +64,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
|||||||
* @param center
|
* @param center
|
||||||
* @param radius
|
* @param radius
|
||||||
*/
|
*/
|
||||||
public EllipsoidRegion(LocalWorld world, Vector center, Vector radius) {
|
public EllipsoidRegion(World world, Vector center, Vector radius) {
|
||||||
super(world);
|
super(world);
|
||||||
this.center = center;
|
this.center = center;
|
||||||
setRadius(radius);
|
setRadius(radius);
|
||||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.regions;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class NullRegion implements Region {
|
public class NullRegion implements Region {
|
||||||
|
|
||||||
private LocalWorld world;
|
private World world;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vector getMinimumPoint() {
|
public Vector getMinimumPoint() {
|
||||||
@ -97,15 +98,20 @@ public class NullRegion implements Region {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalWorld getWorld() {
|
public World getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWorld(LocalWorld world) {
|
public void setWorld(World world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setWorld(LocalWorld world) {
|
||||||
|
setWorld((World) world);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NullRegion clone() {
|
public NullRegion clone() {
|
||||||
return new NullRegion();
|
return new NullRegion();
|
||||||
|
@ -30,6 +30,7 @@ import com.sk89q.worldedit.Vector;
|
|||||||
import com.sk89q.worldedit.Vector2D;
|
import com.sk89q.worldedit.Vector2D;
|
||||||
import com.sk89q.worldedit.regions.iterator.FlatRegion3DIterator;
|
import com.sk89q.worldedit.regions.iterator.FlatRegion3DIterator;
|
||||||
import com.sk89q.worldedit.regions.iterator.FlatRegionIterator;
|
import com.sk89q.worldedit.regions.iterator.FlatRegionIterator;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a 2D polygonal region.
|
* Represents a 2D polygonal region.
|
||||||
@ -48,7 +49,12 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
|||||||
* Construct the region
|
* Construct the region
|
||||||
*/
|
*/
|
||||||
public Polygonal2DRegion() {
|
public Polygonal2DRegion() {
|
||||||
this((LocalWorld) null);
|
this((World) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Polygonal2DRegion(LocalWorld world) {
|
||||||
|
this((World) world);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,11 +62,16 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
|||||||
*
|
*
|
||||||
* @param world
|
* @param world
|
||||||
*/
|
*/
|
||||||
public Polygonal2DRegion(LocalWorld world) {
|
public Polygonal2DRegion(World world) {
|
||||||
this(world, Collections.<BlockVector2D>emptyList(), 0, 0);
|
this(world, Collections.<BlockVector2D>emptyList(), 0, 0);
|
||||||
hasY = false;
|
hasY = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Polygonal2DRegion(LocalWorld world, List<BlockVector2D> points, int minY, int maxY) {
|
||||||
|
this((World) world, points, minY, maxY);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the region.
|
* Construct the region.
|
||||||
*
|
*
|
||||||
@ -69,7 +80,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
|||||||
* @param minY
|
* @param minY
|
||||||
* @param maxY
|
* @param maxY
|
||||||
*/
|
*/
|
||||||
public Polygonal2DRegion(LocalWorld world, List<BlockVector2D> points, int minY, int maxY) {
|
public Polygonal2DRegion(World world, List<BlockVector2D> points, int minY, int maxY) {
|
||||||
super(world);
|
super(world);
|
||||||
this.points = new ArrayList<BlockVector2D>(points);
|
this.points = new ArrayList<BlockVector2D>(points);
|
||||||
this.minY = minY;
|
this.minY = minY;
|
||||||
|
@ -24,6 +24,7 @@ import com.sk89q.worldedit.BlockVector2D;
|
|||||||
import com.sk89q.worldedit.LocalWorld;
|
import com.sk89q.worldedit.LocalWorld;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.Vector2D;
|
import com.sk89q.worldedit.Vector2D;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -135,13 +136,21 @@ public interface Region extends Iterable<BlockVector>, Cloneable {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public LocalWorld getWorld();
|
public World getWorld();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the world the selection is in
|
* Sets the world the selection is in
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
public void setWorld(World world);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the world the selection is in
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setWorld(LocalWorld world);
|
public void setWorld(LocalWorld world);
|
||||||
|
|
||||||
public Region clone();
|
public Region clone();
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.regions;
|
package com.sk89q.worldedit.regions;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -49,28 +50,37 @@ public interface RegionSelector {
|
|||||||
/**
|
/**
|
||||||
* Tell the player information about his/her primary selection.
|
* Tell the player information about his/her primary selection.
|
||||||
*
|
*
|
||||||
* @param player the player
|
* @param actor the actor
|
||||||
* @param session the session
|
* @param session the session
|
||||||
* @param position position
|
* @param position position
|
||||||
*/
|
*/
|
||||||
|
public void explainPrimarySelection(Actor actor, LocalSession session, Vector position);
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position);
|
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell the player information about his/her secondary selection.
|
* Tell the player information about his/her secondary selection.
|
||||||
*
|
*
|
||||||
* @param player the player
|
* @param actor the actor
|
||||||
* @param session the session
|
* @param session the session
|
||||||
* @param position position
|
* @param position position
|
||||||
*/
|
*/
|
||||||
|
public void explainSecondarySelection(Actor actor, LocalSession session, Vector position);
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position);
|
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The the player information about the region's changes. This may resend
|
* The the player information about the region's changes. This may resend
|
||||||
* all the defining region information if needed.
|
* all the defining region information if needed.
|
||||||
*
|
*
|
||||||
* @param player the player
|
* @param actor the actor
|
||||||
* @param session the session
|
* @param session the session
|
||||||
*/
|
*/
|
||||||
|
public void explainRegionAdjust(Actor actor, LocalSession session);
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void explainRegionAdjust(LocalPlayer player, LocalSession session);
|
public void explainRegionAdjust(LocalPlayer player, LocalSession session);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.regions.selector;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
||||||
import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
|
import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
|
||||||
import com.sk89q.worldedit.internal.cui.SelectionPolygonEvent;
|
import com.sk89q.worldedit.internal.cui.SelectionPolygonEvent;
|
||||||
@ -29,6 +30,7 @@ import com.sk89q.worldedit.regions.ConvexPolyhedralRegion;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
import com.sk89q.worldedit.regions.polyhedron.Triangle;
|
import com.sk89q.worldedit.regions.polyhedron.Triangle;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -44,13 +46,18 @@ public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions.
|
|||||||
private final ConvexPolyhedralRegion region;
|
private final ConvexPolyhedralRegion region;
|
||||||
private BlockVector pos1;
|
private BlockVector pos1;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public ConvexPolyhedralRegionSelector(@Nullable LocalWorld world, int maxVertices) {
|
||||||
|
this((World) world, maxVertices);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new selector.
|
* Create a new selector.
|
||||||
*
|
*
|
||||||
* @param world the world
|
* @param world the world
|
||||||
* @param maxVertices the maximum number of vertices, where a number below 0 means unbounded
|
* @param maxVertices the maximum number of vertices, where a number below 0 means unbounded
|
||||||
*/
|
*/
|
||||||
public ConvexPolyhedralRegionSelector(@Nullable LocalWorld world, int maxVertices) {
|
public ConvexPolyhedralRegionSelector(@Nullable World world, int maxVertices) {
|
||||||
this.maxVertices = maxVertices;
|
this.maxVertices = maxVertices;
|
||||||
region = new ConvexPolyhedralRegion(world);
|
region = new ConvexPolyhedralRegion(world);
|
||||||
}
|
}
|
||||||
@ -165,21 +172,21 @@ public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions.
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
session.describeCUI(player);
|
session.describeCUI(player);
|
||||||
|
|
||||||
player.print("Started new selection with vertex "+pos+".");
|
player.print("Started new selection with vertex "+pos+".");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
session.describeCUI(player);
|
session.describeCUI(player);
|
||||||
|
|
||||||
player.print("Added vertex "+pos+" to the selection.");
|
player.print("Added vertex "+pos+" to the selection.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
public void explainRegionAdjust(Actor player, LocalSession session) {
|
||||||
session.describeCUI(player);
|
session.describeCUI(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +202,7 @@ public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions.
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void describeCUI(LocalSession session, LocalPlayer player) {
|
public void describeCUI(LocalSession session, Actor player) {
|
||||||
Collection<Vector> vertices = region.getVertices();
|
Collection<Vector> vertices = region.getVertices();
|
||||||
Collection<Triangle> triangles = region.getTriangles();
|
Collection<Triangle> triangles = region.getTriangles();
|
||||||
|
|
||||||
@ -223,7 +230,7 @@ public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions.
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
|
public void describeLegacyCUI(LocalSession session, Actor player) {
|
||||||
if (isDefined()) {
|
if (isDefined()) {
|
||||||
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
|
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
|
||||||
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
|
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
|
||||||
@ -232,4 +239,19 @@ public class ConvexPolyhedralRegionSelector extends com.sk89q.worldedit.regions.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainPrimarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainSecondarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
||||||
|
explainRegionAdjust((Actor) player, session);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,13 @@
|
|||||||
package com.sk89q.worldedit.regions.selector;
|
package com.sk89q.worldedit.regions.selector;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
||||||
import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
|
import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -45,7 +47,12 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi
|
|||||||
* Create a new region selector with no world.
|
* Create a new region selector with no world.
|
||||||
*/
|
*/
|
||||||
public CuboidRegionSelector() {
|
public CuboidRegionSelector() {
|
||||||
this((LocalWorld) null);
|
this((World) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public CuboidRegionSelector(@Nullable LocalWorld world) {
|
||||||
|
this((World) world);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,7 +60,7 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi
|
|||||||
*
|
*
|
||||||
* @param world the world
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
public CuboidRegionSelector(@Nullable LocalWorld world) {
|
public CuboidRegionSelector(@Nullable World world) {
|
||||||
region = new CuboidRegion(world, new Vector(), new Vector());
|
region = new CuboidRegion(world, new Vector(), new Vector());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +92,11 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi
|
|||||||
region.setPos2(pos2);
|
region.setPos2(pos2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public CuboidRegionSelector(@Nullable LocalWorld world, Vector pos1, Vector pos2) {
|
||||||
|
this((World) world, pos1, pos2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new region selector with the given two positions.
|
* Create a new region selector with the given two positions.
|
||||||
*
|
*
|
||||||
@ -92,7 +104,7 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi
|
|||||||
* @param pos1 position 1
|
* @param pos1 position 1
|
||||||
* @param pos2 position 2
|
* @param pos2 position 2
|
||||||
*/
|
*/
|
||||||
public CuboidRegionSelector(@Nullable LocalWorld world, Vector pos1, Vector pos2) {
|
public CuboidRegionSelector(@Nullable World world, Vector pos1, Vector pos2) {
|
||||||
this(world);
|
this(world);
|
||||||
checkNotNull(world);
|
checkNotNull(world);
|
||||||
checkNotNull(pos1);
|
checkNotNull(pos1);
|
||||||
@ -126,7 +138,7 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
if (pos1 != null && pos2 != null) {
|
if (pos1 != null && pos2 != null) {
|
||||||
player.print("First position set to " + pos1 + " (" + region.getArea() + ").");
|
player.print("First position set to " + pos1 + " (" + region.getArea() + ").");
|
||||||
} else {
|
} else {
|
||||||
@ -137,7 +149,7 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
if (pos1 != null && pos2 != null) {
|
if (pos1 != null && pos2 != null) {
|
||||||
player.print("Second position set to " + pos2 + " (" + region.getArea() + ").");
|
player.print("Second position set to " + pos2 + " (" + region.getArea() + ").");
|
||||||
} else {
|
} else {
|
||||||
@ -148,7 +160,7 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
public void explainRegionAdjust(Actor player, LocalSession session) {
|
||||||
if (pos1 != null) {
|
if (pos1 != null) {
|
||||||
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos1, getArea()));
|
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos1, getArea()));
|
||||||
}
|
}
|
||||||
@ -232,7 +244,7 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void describeCUI(LocalSession session, LocalPlayer player) {
|
public void describeCUI(LocalSession session, Actor player) {
|
||||||
if (pos1 != null) {
|
if (pos1 != null) {
|
||||||
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos1, getArea()));
|
session.dispatchCUIEvent(player, new SelectionPointEvent(0, pos1, getArea()));
|
||||||
}
|
}
|
||||||
@ -243,7 +255,7 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
|
public void describeLegacyCUI(LocalSession session, Actor player) {
|
||||||
describeCUI(session, player);
|
describeCUI(session, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,5 +274,19 @@ public class CuboidRegionSelector extends com.sk89q.worldedit.regions.CuboidRegi
|
|||||||
return "cuboid";
|
return "cuboid";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainPrimarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainSecondarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
||||||
|
explainRegionAdjust((Actor) player, session);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,12 @@
|
|||||||
package com.sk89q.worldedit.regions.selector;
|
package com.sk89q.worldedit.regions.selector;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.internal.cui.*;
|
import com.sk89q.worldedit.internal.cui.*;
|
||||||
import com.sk89q.worldedit.regions.CylinderRegion;
|
import com.sk89q.worldedit.regions.CylinderRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
@ -45,12 +47,17 @@ public class CylinderRegionSelector extends com.sk89q.worldedit.regions.Cylinder
|
|||||||
format.setMaximumFractionDigits(3);
|
format.setMaximumFractionDigits(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public CylinderRegionSelector(@Nullable LocalWorld world) {
|
||||||
|
this((World) world);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new region selector.
|
* Create a new region selector.
|
||||||
*
|
*
|
||||||
* @param world the world
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
public CylinderRegionSelector(@Nullable LocalWorld world) {
|
public CylinderRegionSelector(@Nullable World world) {
|
||||||
region = new CylinderRegion(world);
|
region = new CylinderRegion(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,14 +141,14 @@ public class CylinderRegionSelector extends com.sk89q.worldedit.regions.Cylinder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
player.print("Starting a new cylindrical selection at " + pos + ".");
|
player.print("Starting a new cylindrical selection at " + pos + ".");
|
||||||
|
|
||||||
session.describeCUI(player);
|
session.describeCUI(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
Vector center = region.getCenter();
|
Vector center = region.getCenter();
|
||||||
if (!center.equals(Vector.ZERO)) {
|
if (!center.equals(Vector.ZERO)) {
|
||||||
player.print("Radius set to " + format.format(region.getRadius().getX()) + "/" + format.format(region.getRadius().getZ()) + " blocks. (" + region.getArea() + ").");
|
player.print("Radius set to " + format.format(region.getRadius().getX()) + "/" + format.format(region.getRadius().getZ()) + " blocks. (" + region.getArea() + ").");
|
||||||
@ -154,7 +161,7 @@ public class CylinderRegionSelector extends com.sk89q.worldedit.regions.Cylinder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
public void explainRegionAdjust(Actor player, LocalSession session) {
|
||||||
session.describeCUI(player);
|
session.describeCUI(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,13 +227,13 @@ public class CylinderRegionSelector extends com.sk89q.worldedit.regions.Cylinder
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void describeCUI(LocalSession session, LocalPlayer player) {
|
public void describeCUI(LocalSession session, Actor player) {
|
||||||
session.dispatchCUIEvent(player, new SelectionCylinderEvent(region.getCenter(), region.getRadius()));
|
session.dispatchCUIEvent(player, new SelectionCylinderEvent(region.getCenter(), region.getRadius()));
|
||||||
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
|
session.dispatchCUIEvent(player, new SelectionMinMaxEvent(region.getMinimumY(), region.getMaximumY()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
|
public void describeLegacyCUI(LocalSession session, Actor player) {
|
||||||
if (isDefined()) {
|
if (isDefined()) {
|
||||||
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
|
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
|
||||||
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
|
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
|
||||||
@ -250,4 +257,19 @@ public class CylinderRegionSelector extends com.sk89q.worldedit.regions.Cylinder
|
|||||||
return "cuboid";
|
return "cuboid";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainPrimarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainSecondarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
||||||
|
explainRegionAdjust((Actor) player, session);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,14 @@
|
|||||||
package com.sk89q.worldedit.regions.selector;
|
package com.sk89q.worldedit.regions.selector;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
||||||
import com.sk89q.worldedit.internal.cui.SelectionEllipsoidPointEvent;
|
import com.sk89q.worldedit.internal.cui.SelectionEllipsoidPointEvent;
|
||||||
import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
|
import com.sk89q.worldedit.internal.cui.SelectionPointEvent;
|
||||||
import com.sk89q.worldedit.regions.EllipsoidRegion;
|
import com.sk89q.worldedit.regions.EllipsoidRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -42,18 +44,23 @@ public class EllipsoidRegionSelector extends com.sk89q.worldedit.regions.Ellipso
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new selector.
|
* Create a new selector.
|
||||||
*
|
|
||||||
* @param world the world
|
|
||||||
*/
|
*/
|
||||||
|
public EllipsoidRegionSelector() {
|
||||||
|
this((World) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public EllipsoidRegionSelector(@Nullable LocalWorld world) {
|
public EllipsoidRegionSelector(@Nullable LocalWorld world) {
|
||||||
region = new EllipsoidRegion(world, new Vector(), new Vector());
|
this((World) world);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new selector.
|
* Create a new selector.
|
||||||
|
*
|
||||||
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
public EllipsoidRegionSelector() {
|
public EllipsoidRegionSelector(@Nullable World world) {
|
||||||
this((LocalWorld) null);
|
region = new EllipsoidRegion(world, new Vector(), new Vector());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,7 +125,7 @@ public class EllipsoidRegionSelector extends com.sk89q.worldedit.regions.Ellipso
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
if (isDefined()) {
|
if (isDefined()) {
|
||||||
player.print("Center position set to " + region.getCenter() + " (" + region.getArea() + ").");
|
player.print("Center position set to " + region.getCenter() + " (" + region.getArea() + ").");
|
||||||
} else {
|
} else {
|
||||||
@ -129,7 +136,7 @@ public class EllipsoidRegionSelector extends com.sk89q.worldedit.regions.Ellipso
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
if (isDefined()) {
|
if (isDefined()) {
|
||||||
player.print("Radius set to " + region.getRadius() + " (" + region.getArea() + ").");
|
player.print("Radius set to " + region.getRadius() + " (" + region.getArea() + ").");
|
||||||
} else {
|
} else {
|
||||||
@ -140,7 +147,7 @@ public class EllipsoidRegionSelector extends com.sk89q.worldedit.regions.Ellipso
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
public void explainRegionAdjust(Actor player, LocalSession session) {
|
||||||
session.describeCUI(player);
|
session.describeCUI(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,13 +208,13 @@ public class EllipsoidRegionSelector extends com.sk89q.worldedit.regions.Ellipso
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void describeCUI(LocalSession session, LocalPlayer player) {
|
public void describeCUI(LocalSession session, Actor player) {
|
||||||
session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(0, region.getCenter()));
|
session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(0, region.getCenter()));
|
||||||
session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(1, region.getRadius()));
|
session.dispatchCUIEvent(player, new SelectionEllipsoidPointEvent(1, region.getRadius()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
|
public void describeLegacyCUI(LocalSession session, Actor player) {
|
||||||
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
|
session.dispatchCUIEvent(player, new SelectionPointEvent(0, region.getMinimumPoint(), getArea()));
|
||||||
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
|
session.dispatchCUIEvent(player, new SelectionPointEvent(1, region.getMaximumPoint(), getArea()));
|
||||||
}
|
}
|
||||||
@ -232,4 +239,19 @@ public class EllipsoidRegionSelector extends com.sk89q.worldedit.regions.Ellipso
|
|||||||
return region.getCenter().toBlockVector();
|
return region.getCenter().toBlockVector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainPrimarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainSecondarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
||||||
|
explainRegionAdjust((Actor) player, session);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,10 @@
|
|||||||
package com.sk89q.worldedit.regions.selector;
|
package com.sk89q.worldedit.regions.selector;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -31,12 +33,17 @@ import javax.annotation.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class ExtendingCuboidRegionSelector extends CuboidRegionSelector {
|
public class ExtendingCuboidRegionSelector extends CuboidRegionSelector {
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public ExtendingCuboidRegionSelector(@Nullable LocalWorld world) {
|
||||||
|
this((World) world);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new selector.
|
* Create a new selector.
|
||||||
*
|
*
|
||||||
* @param world the world
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
public ExtendingCuboidRegionSelector(@Nullable LocalWorld world) {
|
public ExtendingCuboidRegionSelector(@Nullable World world) {
|
||||||
super(world);
|
super(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,17 +125,32 @@ public class ExtendingCuboidRegionSelector extends CuboidRegionSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
player.print("Started selection at " + pos + " (" + region.getArea() + ").");
|
player.print("Started selection at " + pos + " (" + region.getArea() + ").");
|
||||||
|
|
||||||
explainRegionAdjust(player, session);
|
explainRegionAdjust(player, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
player.print("Extended selection to encompass " + pos + " (" + region.getArea() + ").");
|
player.print("Extended selection to encompass " + pos + " (" + region.getArea() + ").");
|
||||||
|
|
||||||
explainRegionAdjust(player, session);
|
explainRegionAdjust(player, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainPrimarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainSecondarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
||||||
|
explainRegionAdjust((Actor) player, session);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.regions.selector;
|
package com.sk89q.worldedit.regions.selector;
|
||||||
|
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
||||||
import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent;
|
import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent;
|
||||||
import com.sk89q.worldedit.internal.cui.SelectionPoint2DEvent;
|
import com.sk89q.worldedit.internal.cui.SelectionPoint2DEvent;
|
||||||
@ -27,6 +28,7 @@ import com.sk89q.worldedit.internal.cui.SelectionShapeEvent;
|
|||||||
import com.sk89q.worldedit.regions.Polygonal2DRegion;
|
import com.sk89q.worldedit.regions.Polygonal2DRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -51,13 +53,18 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg
|
|||||||
this(world, 50);
|
this(world, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Polygonal2DRegionSelector(@Nullable LocalWorld world, int maxPoints) {
|
||||||
|
this((World) world, maxPoints);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new selector.
|
* Create a new selector.
|
||||||
*
|
*
|
||||||
* @param world the world
|
* @param world the world
|
||||||
* @param maxPoints the maximum number of points
|
* @param maxPoints the maximum number of points
|
||||||
*/
|
*/
|
||||||
public Polygonal2DRegionSelector(@Nullable LocalWorld world, int maxPoints) {
|
public Polygonal2DRegionSelector(@Nullable World world, int maxPoints) {
|
||||||
this.maxPoints = maxPoints;
|
this.maxPoints = maxPoints;
|
||||||
region = new Polygonal2DRegion(world);
|
region = new Polygonal2DRegion(world);
|
||||||
}
|
}
|
||||||
@ -101,6 +108,11 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public Polygonal2DRegionSelector(@Nullable LocalWorld world, List<BlockVector2D> points, int minY, int maxY) {
|
||||||
|
this((World) world, points, minY, maxY);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new selector.
|
* Create a new selector.
|
||||||
*
|
*
|
||||||
@ -109,7 +121,7 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg
|
|||||||
* @param minY the minimum Y
|
* @param minY the minimum Y
|
||||||
* @param maxY the maximum Y
|
* @param maxY the maximum Y
|
||||||
*/
|
*/
|
||||||
public Polygonal2DRegionSelector(@Nullable LocalWorld world, List<BlockVector2D> points, int minY, int maxY) {
|
public Polygonal2DRegionSelector(@Nullable World world, List<BlockVector2D> points, int minY, int maxY) {
|
||||||
checkNotNull(points);
|
checkNotNull(points);
|
||||||
|
|
||||||
final BlockVector2D pos2D = points.get(0);
|
final BlockVector2D pos2D = points.get(0);
|
||||||
@ -153,7 +165,7 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainPrimarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
player.print("Starting a new polygon at " + pos + ".");
|
player.print("Starting a new polygon at " + pos + ".");
|
||||||
|
|
||||||
session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID()));
|
session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID()));
|
||||||
@ -162,7 +174,7 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
player.print("Added point #" + region.size() + " at " + pos + ".");
|
player.print("Added point #" + region.size() + " at " + pos + ".");
|
||||||
|
|
||||||
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(region.size() - 1, pos, getArea()));
|
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(region.size() - 1, pos, getArea()));
|
||||||
@ -170,7 +182,7 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
public void explainRegionAdjust(Actor player, LocalSession session) {
|
||||||
session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID()));
|
session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID()));
|
||||||
describeCUI(session, player);
|
describeCUI(session, player);
|
||||||
}
|
}
|
||||||
@ -241,7 +253,7 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void describeCUI(LocalSession session, LocalPlayer player) {
|
public void describeCUI(LocalSession session, Actor player) {
|
||||||
final List<BlockVector2D> points = region.getPoints();
|
final List<BlockVector2D> points = region.getPoints();
|
||||||
for (int id = 0; id < points.size(); id++) {
|
for (int id = 0; id < points.size(); id++) {
|
||||||
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(id, points.get(id), getArea()));
|
session.dispatchCUIEvent(player, new SelectionPoint2DEvent(id, points.get(id), getArea()));
|
||||||
@ -251,7 +263,7 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void describeLegacyCUI(LocalSession session, LocalPlayer player) {
|
public void describeLegacyCUI(LocalSession session, Actor player) {
|
||||||
describeCUI(session, player);
|
describeCUI(session, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,4 +282,19 @@ public class Polygonal2DRegionSelector extends com.sk89q.worldedit.regions.Polyg
|
|||||||
return "polygon2d";
|
return "polygon2d";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainPrimarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainSecondarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
||||||
|
explainRegionAdjust((Actor) player, session);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,9 @@ import com.sk89q.worldedit.LocalPlayer;
|
|||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
import com.sk89q.worldedit.LocalWorld;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.regions.RegionSelector;
|
import com.sk89q.worldedit.regions.RegionSelector;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -32,12 +34,17 @@ import javax.annotation.Nullable;
|
|||||||
*/
|
*/
|
||||||
public class SphereRegionSelector extends EllipsoidRegionSelector {
|
public class SphereRegionSelector extends EllipsoidRegionSelector {
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public SphereRegionSelector(@Nullable LocalWorld world) {
|
||||||
|
this((World) world);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new selector.
|
* Create a new selector.
|
||||||
*
|
*
|
||||||
* @param world the world
|
* @param world the world
|
||||||
*/
|
*/
|
||||||
public SphereRegionSelector(@Nullable LocalWorld world) {
|
public SphereRegionSelector(@Nullable World world) {
|
||||||
super(world);
|
super(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +87,7 @@ public class SphereRegionSelector extends EllipsoidRegionSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector pos) {
|
public void explainSecondarySelection(Actor player, LocalSession session, Vector pos) {
|
||||||
if (isDefined()) {
|
if (isDefined()) {
|
||||||
player.print("Radius set to " + region.getRadius().getX() + " (" + region.getArea() + ").");
|
player.print("Radius set to " + region.getRadius().getX() + " (" + region.getArea() + ").");
|
||||||
} else {
|
} else {
|
||||||
@ -95,4 +102,19 @@ public class SphereRegionSelector extends EllipsoidRegionSelector {
|
|||||||
return "sphere";
|
return "sphere";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainPrimarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainPrimarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainSecondarySelection(LocalPlayer player, LocalSession session, Vector position) {
|
||||||
|
explainSecondarySelection((Actor) player, session, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void explainRegionAdjust(LocalPlayer player, LocalSession session) {
|
||||||
|
explainRegionAdjust((Actor) player, session);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ package com.sk89q.worldedit.session.request;
|
|||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public final class Request {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private @Nullable LocalWorld world;
|
private @Nullable World world;
|
||||||
private @Nullable LocalSession session;
|
private @Nullable LocalSession session;
|
||||||
private @Nullable EditSession editSession;
|
private @Nullable EditSession editSession;
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public final class Request {
|
|||||||
*
|
*
|
||||||
* @return the world, which may be null
|
* @return the world, which may be null
|
||||||
*/
|
*/
|
||||||
public @Nullable LocalWorld getWorld() {
|
public @Nullable World getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ public final class Request {
|
|||||||
*
|
*
|
||||||
* @param world the world, which may be null
|
* @param world the world, which may be null
|
||||||
*/
|
*/
|
||||||
public void setWorld(@Nullable LocalWorld world) {
|
public void setWorld(@Nullable World world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import com.sk89q.worldedit.*;
|
|||||||
import com.sk89q.worldedit.regions.NullRegion;
|
import com.sk89q.worldedit.regions.NullRegion;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -45,7 +46,7 @@ public class RequestSelection implements Region {
|
|||||||
*/
|
*/
|
||||||
protected Region getRegion() {
|
protected Region getRegion() {
|
||||||
LocalSession session = Request.request().getSession();
|
LocalSession session = Request.request().getSession();
|
||||||
LocalWorld world = Request.request().getWorld();
|
World world = Request.request().getWorld();
|
||||||
|
|
||||||
if (session != null && world != null) {
|
if (session != null && world != null) {
|
||||||
try {
|
try {
|
||||||
@ -123,12 +124,17 @@ public class RequestSelection implements Region {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalWorld getWorld() {
|
public World getWorld() {
|
||||||
return getRegion().getWorld();
|
return getRegion().getWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWorld(LocalWorld world) {
|
public void setWorld(LocalWorld world) {
|
||||||
|
setWorld((World) world);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setWorld(World world) {
|
||||||
getRegion().setWorld(world);
|
getRegion().setWorld(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,14 +19,11 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.util;
|
package com.sk89q.worldedit.util;
|
||||||
|
|
||||||
import com.sk89q.worldedit.BlockWorldVector;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
|
||||||
import com.sk89q.worldedit.WorldVectorFace;
|
|
||||||
import com.sk89q.worldedit.blocks.BlockID;
|
import com.sk89q.worldedit.blocks.BlockID;
|
||||||
import com.sk89q.worldedit.blocks.BlockType;
|
import com.sk89q.worldedit.blocks.BlockType;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
|
import com.sk89q.worldedit.internal.LocalWorldAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class uses an inefficient method to figure out what block a player
|
* This class uses an inefficient method to figure out what block a player
|
||||||
@ -52,7 +49,7 @@ public class TargetBlock {
|
|||||||
* @param player player to work with
|
* @param player player to work with
|
||||||
*/
|
*/
|
||||||
public TargetBlock(LocalPlayer player) {
|
public TargetBlock(LocalPlayer player) {
|
||||||
this.world = player.getWorld();
|
this.world = LocalWorldAdapter.wrap(player.getWorld());
|
||||||
this.setValues(player.getPosition(), player.getYaw(), player.getPitch(),
|
this.setValues(player.getPosition(), player.getYaw(), player.getPitch(),
|
||||||
300, 1.65, 0.2);
|
300, 1.65, 0.2);
|
||||||
}
|
}
|
||||||
@ -76,7 +73,7 @@ public class TargetBlock {
|
|||||||
* @param checkDistance how often to check for blocks, the smaller the more precise
|
* @param checkDistance how often to check for blocks, the smaller the more precise
|
||||||
*/
|
*/
|
||||||
public TargetBlock(Entity player, int maxDistance, double checkDistance) {
|
public TargetBlock(Entity player, int maxDistance, double checkDistance) {
|
||||||
this.world = player.getWorld();
|
this.world = LocalWorldAdapter.wrap(player.getWorld());
|
||||||
this.setValues(player.getPosition(), player.getYaw(), player.getPitch(),
|
this.setValues(player.getPosition(), player.getYaw(), player.getPitch(),
|
||||||
maxDistance, 1.65, checkDistance);
|
maxDistance, 1.65, checkDistance);
|
||||||
}
|
}
|
||||||
|
@ -19,25 +19,19 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.world.chunk;
|
package com.sk89q.worldedit.world.chunk;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import com.sk89q.jnbt.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.sk89q.jnbt.ByteArrayTag;
|
|
||||||
import com.sk89q.jnbt.ByteTag;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
|
||||||
import com.sk89q.jnbt.IntTag;
|
|
||||||
import com.sk89q.jnbt.ListTag;
|
|
||||||
import com.sk89q.jnbt.NBTUtils;
|
|
||||||
import com.sk89q.jnbt.Tag;
|
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
||||||
import com.sk89q.worldedit.world.DataException;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class AnvilChunk implements Chunk {
|
public class AnvilChunk implements Chunk {
|
||||||
|
|
||||||
private CompoundTag rootTag;
|
private CompoundTag rootTag;
|
||||||
@ -49,7 +43,7 @@ public class AnvilChunk implements Chunk {
|
|||||||
|
|
||||||
private Map<BlockVector, Map<String,Tag>> tileEntities;
|
private Map<BlockVector, Map<String,Tag>> tileEntities;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private LocalWorld world; // TODO: remove if stays unused.
|
private World world; // TODO: remove if stays unused.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the chunk with a compound tag.
|
* Construct the chunk with a compound tag.
|
||||||
@ -58,7 +52,7 @@ public class AnvilChunk implements Chunk {
|
|||||||
* @param tag the tag to read
|
* @param tag the tag to read
|
||||||
* @throws DataException on a data error
|
* @throws DataException on a data error
|
||||||
*/
|
*/
|
||||||
public AnvilChunk(LocalWorld world, CompoundTag tag) throws DataException {
|
public AnvilChunk(World world, CompoundTag tag) throws DataException {
|
||||||
rootTag = tag;
|
rootTag = tag;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
|
||||||
|
@ -21,11 +21,11 @@ package com.sk89q.worldedit.world.chunk;
|
|||||||
|
|
||||||
import com.sk89q.jnbt.*;
|
import com.sk89q.jnbt.*;
|
||||||
import com.sk89q.worldedit.BlockVector;
|
import com.sk89q.worldedit.BlockVector;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
||||||
import com.sk89q.worldedit.world.DataException;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
import com.sk89q.worldedit.world.storage.InvalidFormatException;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -46,7 +46,7 @@ public class OldChunk implements Chunk {
|
|||||||
|
|
||||||
private Map<BlockVector, Map<String,Tag>> tileEntities;
|
private Map<BlockVector, Map<String,Tag>> tileEntities;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private LocalWorld world; // TODO: remove if stays unused.
|
private World world; // TODO: remove if stays unused.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the chunk with a compound tag.
|
* Construct the chunk with a compound tag.
|
||||||
@ -54,7 +54,7 @@ public class OldChunk implements Chunk {
|
|||||||
* @param tag
|
* @param tag
|
||||||
* @throws DataException
|
* @throws DataException
|
||||||
*/
|
*/
|
||||||
public OldChunk(LocalWorld world, CompoundTag tag) throws DataException {
|
public OldChunk(World world, CompoundTag tag) throws DataException {
|
||||||
rootTag = tag;
|
rootTag = tag;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
|
||||||
|
@ -19,16 +19,20 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.world.storage;
|
package com.sk89q.worldedit.world.storage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import java.util.Map;
|
import com.sk89q.jnbt.Tag;
|
||||||
|
import com.sk89q.worldedit.BlockVector2D;
|
||||||
import com.sk89q.jnbt.*;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.Vector2D;
|
||||||
import com.sk89q.worldedit.world.DataException;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.chunk.AnvilChunk;
|
import com.sk89q.worldedit.world.chunk.AnvilChunk;
|
||||||
import com.sk89q.worldedit.world.chunk.Chunk;
|
import com.sk89q.worldedit.world.chunk.Chunk;
|
||||||
import com.sk89q.worldedit.world.chunk.OldChunk;
|
import com.sk89q.worldedit.world.chunk.OldChunk;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents chunk storage mechanisms.
|
* Represents chunk storage mechanisms.
|
||||||
*
|
*
|
||||||
@ -61,7 +65,7 @@ public abstract class ChunkStore {
|
|||||||
* @throws DataException
|
* @throws DataException
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public abstract CompoundTag getChunkTag(Vector2D pos, LocalWorld world)
|
public abstract CompoundTag getChunkTag(Vector2D pos, World world)
|
||||||
throws DataException, IOException;
|
throws DataException, IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,8 +77,7 @@ public abstract class ChunkStore {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws DataException
|
* @throws DataException
|
||||||
*/
|
*/
|
||||||
public Chunk getChunk(Vector2D pos, LocalWorld world)
|
public Chunk getChunk(Vector2D pos, World world) throws DataException, IOException {
|
||||||
throws DataException, IOException {
|
|
||||||
|
|
||||||
CompoundTag tag = getChunkTag(pos, world);
|
CompoundTag tag = getChunkTag(pos, world);
|
||||||
Map<String, Tag> tags = tag.getValue();
|
Map<String, Tag> tags = tag.getValue();
|
||||||
|
@ -24,6 +24,7 @@ import com.sk89q.jnbt.NBTInputStream;
|
|||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.world.DataException;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -78,8 +79,7 @@ public abstract class LegacyChunkStore extends ChunkStore {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag getChunkTag(Vector2D pos, LocalWorld world)
|
public CompoundTag getChunkTag(Vector2D pos, World world) throws DataException, IOException {
|
||||||
throws DataException, IOException {
|
|
||||||
int x = pos.getBlockX();
|
int x = pos.getBlockX();
|
||||||
int z = pos.getBlockZ();
|
int z = pos.getBlockZ();
|
||||||
|
|
||||||
|
@ -19,15 +19,16 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.world.storage;
|
package com.sk89q.worldedit.world.storage;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Map;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.jnbt.NBTInputStream;
|
import com.sk89q.jnbt.NBTInputStream;
|
||||||
import com.sk89q.jnbt.Tag;
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.LocalWorld;
|
|
||||||
import com.sk89q.worldedit.Vector2D;
|
import com.sk89q.worldedit.Vector2D;
|
||||||
import com.sk89q.worldedit.world.DataException;
|
import com.sk89q.worldedit.world.DataException;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class McRegionChunkStore extends ChunkStore {
|
public abstract class McRegionChunkStore extends ChunkStore {
|
||||||
protected String curFilename = null;
|
protected String curFilename = null;
|
||||||
@ -67,8 +68,7 @@ public abstract class McRegionChunkStore extends ChunkStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompoundTag getChunkTag(Vector2D pos, LocalWorld world) throws DataException,
|
public CompoundTag getChunkTag(Vector2D pos, World world) throws DataException, IOException {
|
||||||
IOException {
|
|
||||||
|
|
||||||
McRegionReader reader = getReader(pos, world.getName());
|
McRegionReader reader = getReader(pos, world.getName());
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren