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:
Matthew Miller
2019-08-25 19:58:28 +10:00
committed by GitHub
parent a0b9810c44
commit 0620478763
72 changed files with 2386 additions and 569 deletions

View File

@ -33,6 +33,8 @@ import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.weather.WeatherType;
import com.sk89q.worldedit.world.weather.WeatherTypes;
import java.nio.file.Path;
import java.util.PriorityQueue;
@ -133,6 +135,24 @@ public abstract class AbstractWorld implements World {
return null;
}
@Override
public WeatherType getWeather() {
return WeatherTypes.CLEAR;
}
@Override
public long getRemainingWeatherDuration() {
return 0;
}
@Override
public void setWeather(WeatherType weatherType) {
}
@Override
public void setWeather(WeatherType weatherType, long duration) {
}
private class QueuedEffect implements Comparable<QueuedEffect> {
private final Vector3 position;
private final BlockType blockType;

View File

@ -61,6 +61,11 @@ public class NullWorld extends AbstractWorld {
return "null";
}
@Override
public String getId() {
return "null";
}
@Override
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException {
return false;

View File

@ -31,6 +31,7 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.registry.Keyed;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.world.block.BlockState;
@ -44,7 +45,7 @@ import java.nio.file.Path;
/**
* Represents a world (dimension).
*/
public interface World extends Extent {
public interface World extends Extent, Keyed {
/**
* Get the name of the world.

View File

@ -37,5 +37,7 @@ public interface CategoryRegistry<T extends Keyed> {
*/
Set<T> getCategorisedByName(String category);
Set<T> getAll(final Category<T> category);
default Set<T> getAll(final Category<T> category) {
return getCategorisedByName(category.getId());
}
}

View File

@ -19,7 +19,6 @@
package com.sk89q.worldedit.world.registry;
import com.sk89q.worldedit.registry.Category;
import com.sk89q.worldedit.world.block.BlockType;
import java.util.Collections;
@ -31,9 +30,4 @@ public class NullBlockCategoryRegistry implements BlockCategoryRegistry {
public Set<BlockType> getCategorisedByName(String category) {
return Collections.emptySet();
}
@Override
public Set<BlockType> getAll(final Category<BlockType> category) {
return Collections.emptySet();
}
}

View File

@ -19,7 +19,6 @@
package com.sk89q.worldedit.world.registry;
import com.sk89q.worldedit.registry.Category;
import com.sk89q.worldedit.world.item.ItemType;
import java.util.Collections;
@ -31,9 +30,4 @@ public class NullItemCategoryRegistry implements ItemCategoryRegistry {
public Set<ItemType> getCategorisedByName(String category) {
return Collections.emptySet();
}
@Override
public Set<ItemType> getAll(final Category<ItemType> category) {
return Collections.emptySet();
}
}