mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
feature(cli): Added a CLI version of WorldEdit, and allowed most commands to be run from console (#508)
* Re-do commits to avoid awful rebase * You can load and save a schematic file now. Still gotta setup ability to use commands as a console actor. * Add a world override concept to LocalSession, and allow a lot more commands to be performed by actors. * Fixed commands, and set the loaded schematic as the world override in CLI * Properly load tags * Added 1.14.4 data values * Allow a majority of commands to be performed by the console. * Fixed a lot of PR requested changes * Added a Locatable interface and use that for getting the location of the player in commands. * Added script support. Currently requires a newline at the end of the script. * Shade everything to allow this to run locally - should probably minimize this to an extent later. * Actually hook up the version * Added a //world command to set the override * Fixed a missed checkstyle issue * Added CommandBlock support to Bukkit * Make command block support configurable * Minor cleanup and implementing a few of the final functions * Fixed most issues from PR * Improve UX, saving is now automatic and unknown command messages show * Better save docs and support any clipboard format * Include the entire formats list * Arrays.copyOf * Clear the world override if the selector is called on another world. * Update logging extent to allow basic logging with non-player actors
This commit is contained in:
@ -26,6 +26,7 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.command.util.Logging;
|
||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||
import com.sk89q.worldedit.internal.annotation.MultiDirection;
|
||||
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
|
||||
@ -34,6 +35,7 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.regions.RegionOperationException;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.CommandManager;
|
||||
import org.enginehub.piston.CommandManagerService;
|
||||
@ -120,7 +122,7 @@ public class ExpandCommands {
|
||||
desc = "Expand the selection area"
|
||||
)
|
||||
@Logging(REGION)
|
||||
public void expand(Player player, LocalSession session,
|
||||
public void expand(Actor actor, World world, LocalSession session,
|
||||
@Arg(desc = "Amount to expand the selection by, can be `vert` to expand to the whole vertical column")
|
||||
int amount,
|
||||
@Arg(desc = "Amount to expand the selection by in the other direction", def = "0")
|
||||
@ -128,7 +130,7 @@ public class ExpandCommands {
|
||||
@Arg(desc = "Direction to expand", def = Direction.AIM)
|
||||
@MultiDirection
|
||||
List<BlockVector3> direction) throws WorldEditException {
|
||||
Region region = session.getSelection(player.getWorld());
|
||||
Region region = session.getSelection(world);
|
||||
int oldSize = region.getArea();
|
||||
|
||||
if (reverseAmount == 0) {
|
||||
@ -141,12 +143,12 @@ public class ExpandCommands {
|
||||
}
|
||||
}
|
||||
|
||||
session.getRegionSelector(player.getWorld()).learnChanges();
|
||||
session.getRegionSelector(world).learnChanges();
|
||||
int newSize = region.getArea();
|
||||
|
||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
|
||||
player.print("Region expanded " + (newSize - oldSize) + " block(s).");
|
||||
actor.print("Region expanded " + (newSize - oldSize) + " block(s).");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user