More compile fixes

This commit is contained in:
MattBDev
2019-08-22 13:14:27 -04:00
parent 6998c2d230
commit 135c12b650
32 changed files with 217 additions and 269 deletions

View File

@ -24,7 +24,6 @@ dependencies {
"compile"("it.unimi.dsi:fastutil:8.2.1")
"compile"("com.googlecode.json-simple:json-simple:1.1.1")
"compileOnly"(project(":worldedit-libs:core:ap"))
"annotationProcessor"(project(":worldedit-libs:core:ap"))
// ensure this is on the classpath for the AP
@ -59,9 +58,8 @@ sourceSets {
tasks.named<Copy>("processResources") {
filesMatching("fawe.properties") {
expand("version" to (project.parent?.version ?: "UNKNOWN"))
expand("name" to (project.parent?.name ?: "FAWE"))
expand("commit" to "TODO GIT")
expand("date" to "TODO Date")
// expand("version" to project.ext["internalVersion"])
// expand("commit" to "TODO GIT")
// expand("date" to "TODO Date")
}
}

View File

@ -26,8 +26,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class CommandContext {
@ -256,8 +254,11 @@ public class CommandContext {
}
public String getString(int start, int end) {
return IntStream.range(start + 1, end + 1).mapToObj(i -> " " + parsedArgs.get(i))
.collect(Collectors.joining("", parsedArgs.get(start), ""));
StringBuilder buffer = new StringBuilder(parsedArgs.get(start));
for (int i = start + 1; i < end + 1; ++i) {
buffer.append(" ").append(parsedArgs.get(i));
}
return buffer.toString();
}
public int getInteger(int index) throws NumberFormatException {

View File

@ -72,6 +72,7 @@ import com.sk89q.worldedit.regions.selector.RegionSelectorType;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Identifiable;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
@ -395,7 +396,7 @@ public class LocalSession implements TextureHolder {
return null;
}
public synchronized void remember(Player player, World world, ChangeSet changeSet, FaweLimit limit) {
public synchronized void remember(Identifiable player, World world, ChangeSet changeSet, FaweLimit limit) {
if (Settings.IMP.HISTORY.USE_DISK) {
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
}
@ -438,7 +439,7 @@ public class LocalSession implements TextureHolder {
}
}
public synchronized void remember(final EditSession editSession, final boolean append, int limitMb) {
public synchronized void remember(EditSession editSession, boolean append, int limitMb) {
if (Settings.IMP.HISTORY.USE_DISK) {
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
}

View File

@ -81,7 +81,6 @@ import java.util.Map;
import javax.annotation.Nullable;
import javax.script.ScriptException;
import org.mozilla.javascript.NativeJavaObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -109,7 +108,8 @@ public final class WorldEdit {
private final PlatformManager platformManager = new PlatformManager(this);
private final EditSessionFactory editSessionFactory = new EditSessionFactory.EditSessionFactoryImpl(eventBus);
private final SessionManager sessions = new SessionManager(this);
private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20));;
private final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(
EvenMoreExecutors.newBoundedCachedThreadPool(0, 1, 20, "WorldEdit Task Executor - %s"));
private final Supervisor supervisor = new SimpleSupervisor();
private final BlockFactory blockFactory = new BlockFactory(this);
@ -635,14 +635,14 @@ public final class WorldEdit {
* @param args arguments for the script
* @throws WorldEditException
*/
public Object runScript(Player player, File f, String[] args) throws WorldEditException {
public void runScript(Player player, File f, String[] args) throws WorldEditException {
String filename = f.getPath();
int index = filename.lastIndexOf('.');
String ext = filename.substring(index + 1);
if (!ext.equalsIgnoreCase("js")) {
player.printError("Only .js scripts are currently supported");
return null;
return;
}
String script;
@ -655,7 +655,7 @@ public final class WorldEdit {
if (file == null) {
player.printError("Script does not exist: " + filename);
return null;
return;
}
} else {
file = new FileInputStream(f);
@ -668,7 +668,7 @@ public final class WorldEdit {
script = new String(data, 0, data.length, StandardCharsets.UTF_8);
} catch (IOException e) {
player.printError("Script read error: " + e.getMessage());
return null;
return;
}
LocalSession session = getSessionManager().get(player);
@ -681,8 +681,8 @@ public final class WorldEdit {
engine = new RhinoCraftScriptEngine();
} catch (NoClassDefFoundError ignored) {
player.printError("Failed to find an installed script engine.");
player.printError("Please see https://worldedit.readthedocs.io/en/latest/usage/other/craftscripts/");
return null;
player.printError("Please see https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/");
return;
}
engine.setTimeLimit(getConfiguration().scriptTimeout);
@ -693,11 +693,7 @@ public final class WorldEdit {
vars.put("player", player);
try {
Object result = engine.evaluate(script, filename, vars);
if (result instanceof NativeJavaObject) {
result = ((NativeJavaObject) result).unwrap();
}
return result;
engine.evaluate(script, filename, vars);
} catch (ScriptException e) {
player.printError("Failed to execute:");
player.printRaw(e.getMessage());
@ -714,7 +710,6 @@ public final class WorldEdit {
session.remember(editSession);
}
}
return null;
}
/**

View File

@ -19,14 +19,12 @@
package com.sk89q.worldedit.internal.command;
import static com.google.common.base.Preconditions.checkState;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
import com.sk89q.worldedit.internal.util.Substring;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import static java.util.stream.Collectors.toList;
import org.enginehub.piston.Command;
import org.enginehub.piston.exception.CommandException;
import org.enginehub.piston.inject.InjectedValueAccess;
@ -40,6 +38,9 @@ import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkState;
import static java.util.stream.Collectors.toList;
public class CommandUtil {
public static Map<String, Command> getSubCommands(Command currentCommand) {
@ -64,20 +65,37 @@ public class CommandUtil {
* Fix {@code suggestions} to replace the last space-separated word in {@code arguments}.
*/
public static List<String> fixSuggestions(String arguments, List<Substring> suggestions) {
Substring lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments));
Substring lastArg = Iterables.getLast(
CommandArgParser.spaceSplit(arguments)
);
return suggestions.stream()
.map(suggestion -> CommandUtil.suggestLast(lastArg, suggestion))
// Re-map suggestions to only operate on the last non-quoted word
.map(suggestion -> onlyOnLastQuotedWord(lastArg, suggestion))
.map(suggestion -> suggestLast(lastArg, suggestion))
.filter(Optional::isPresent)
.map(Optional::get)
.collect(toList());
}
private static Substring onlyOnLastQuotedWord(Substring lastArg, Substring suggestion) {
if (suggestion.getSubstring().startsWith(lastArg.getSubstring())) {
// This is already fine.
return suggestion;
}
String substr = suggestion.getSubstring();
int sp = substr.lastIndexOf(' ');
if (sp < 0) {
return suggestion;
}
return Substring.wrap(substr.substring(sp + 1), suggestion.getStart() + sp + 1, suggestion.getEnd());
}
/**
* Given the last word of a command, mutate the suggestion to replace the last word, if
* possible.
*/
private static Optional<String> suggestLast(Substring last, Substring suggestion) {
if (suggestion.getStart() == last.getEnd()) {
if (suggestion.getStart() == last.getEnd() && !last.getSubstring().equals("\"")) {
// this suggestion is for the next argument.
if (last.getSubstring().isEmpty()) {
return Optional.of(suggestion.getSubstring());

View File

@ -32,6 +32,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
@ -114,11 +115,12 @@ public class ServerCUIHandler {
}
// Borrowed this math from FAWE
double rotX = player.getLocation().getYaw();
double rotY = player.getLocation().getPitch();
final Location location = player.getLocation();
double rotX = location.getYaw();
double rotY = location.getPitch();
double xz = Math.cos(Math.toRadians(rotY));
int x = (int) (player.getLocation().getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12);
int z = (int) (player.getLocation().getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12);
int x = (int) (location.getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12);
int z = (int) (location.getZ() - (xz * Math.cos(Math.toRadians(rotX))) * 12);
int y = Math.max(0, Math.min(Math.min(255, posY + 32), posY + 3));
Map<String, Tag> structureTag = new HashMap<>();

View File

@ -71,7 +71,7 @@ public class SessionManager {
private static final Logger log = LoggerFactory.getLogger(SessionManager.class);
private static boolean warnedInvalidTool;
private final Timer timer = new Timer();
private final Timer timer = new Timer("WorldEdit Session Manager");
private final WorldEdit worldEdit;
private final Map<UUID, SessionHolder> sessions = new HashMap<>();
private SessionStore store = new VoidStore();

View File

@ -19,8 +19,10 @@
package com.sk89q.worldedit.util.concurrency;
import java.util.concurrent.ArrayBlockingQueue;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@ -39,15 +41,33 @@ public final class EvenMoreExecutors {
*
* @param minThreads the minimum number of threads to have at a given time
* @param maxThreads the maximum number of threads to have at a given time
* @param queueSize the size of the queue before new submissions are rejected
* @param queueSize the size of the queue before new submissions are rejected
* @return the newly created thread pool
*/
public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize) {
return newBoundedCachedThreadPool(minThreads, maxThreads, queueSize, null);
}
/**
* Creates a thread pool that creates new threads as needed up to
* a maximum number of threads, but will reuse previously constructed
* threads when they are available.
*
* @param minThreads the minimum number of threads to have at a given time
* @param maxThreads the maximum number of threads to have at a given time
* @param queueSize the size of the queue before new submissions are rejected
* @param threadFormat thread name formatter
* @return the newly created thread pool
*/
public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize, String threadFormat) {
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
minThreads, maxThreads,
60L, TimeUnit.SECONDS,
new ArrayBlockingQueue<>(queueSize));
new LinkedBlockingDeque<>(queueSize));
threadPoolExecutor.allowCoreThreadTimeOut(true);
if (threadFormat != null) {
threadPoolExecutor.setThreadFactory(new ThreadFactoryBuilder().setNameFormat(threadFormat).build());
}
return threadPoolExecutor;
}

View File

@ -19,8 +19,9 @@
package com.sk89q.worldedit.util.paste;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.sk89q.worldedit.util.net.HttpRequest;
import org.json.simple.JSONValue;
import java.io.IOException;
import java.net.URL;
@ -33,6 +34,8 @@ public class EngineHubPaste implements Paster {
private static final Pattern URL_PATTERN = Pattern.compile("https?://.+$");
private static final Gson GSON = new Gson();
@Override
public Callable<URL> paste(String content) {
return new PasteTask(content);
@ -59,10 +62,10 @@ public class EngineHubPaste implements Paster {
.returnContent()
.asString("UTF-8").trim();
Object object = JSONValue.parse(result);
if (object instanceof Map) {
@SuppressWarnings("unchecked")
String urlString = String.valueOf(((Map<Object, Object>) object).get("url"));
Map<Object, Object> object = GSON.fromJson(result, new TypeToken<Map<Object, Object>>() {
}.getType());
if (object != null) {
String urlString = String.valueOf(object.get("url"));
Matcher m = URL_PATTERN.matcher(urlString);
if (m.matches()) {

View File

@ -72,7 +72,6 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
*
* @return the maximum Y
*/
@Override
int getMaxY();
/**

View File

@ -66,13 +66,13 @@ public class SnapshotRepository {
}
/**
* Get a list of snapshots in a directory. The newest snapshot is near the top of the array.
* Get a list of snapshots in a directory. The newest snapshot is
* near the top of the array.
*
* @param newestFirst true to get the newest first
* @return a list of snapshots
*/
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName)
throws MissingWorldException {
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName) throws MissingWorldException {
FilenameFilter filter = (dir, name) -> {
File f = new File(dir, name);
return isValidSnapshot(f);
@ -116,8 +116,7 @@ public class SnapshotRepository {
* @return a snapshot or null
*/
@Nullable
public Snapshot getSnapshotAfter(ZonedDateTime date, String world)
throws MissingWorldException {
public Snapshot getSnapshotAfter(ZonedDateTime date, String world) throws MissingWorldException {
List<Snapshot> snapshots = getSnapshots(true, world);
Snapshot last = null;
@ -139,8 +138,7 @@ public class SnapshotRepository {
* @return a snapshot or null
*/
@Nullable
public Snapshot getSnapshotBefore(ZonedDateTime date, String world)
throws MissingWorldException {
public Snapshot getSnapshotBefore(ZonedDateTime date, String world) throws MissingWorldException {
List<Snapshot> snapshots = getSnapshots(false, world);
Snapshot last = null;
@ -206,8 +204,7 @@ public class SnapshotRepository {
* @return whether it is a valid snapshot
*/
protected boolean isValidSnapshot(File file) {
if (!file.getName()
.matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
if (!file.getName().matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
return false;
}

View File

@ -283,7 +283,7 @@
"hardness": 2.0,
"resistance": 3.0,
"ticksRandomly": false,
"fullCube": true,
"fullCube": false,
"slipperiness": 0.6,
"liquid": false,
"solid": true,
@ -758,7 +758,7 @@
"hardness": 3.0,
"resistance": 3.0,
"ticksRandomly": false,
"fullCube": true,
"fullCube": false,
"slipperiness": 0.6,
"liquid": false,
"solid": true,
@ -771,7 +771,7 @@
"unpushable": false,
"mapColor": "#000000",
"isTranslucent": false,
"hasContainer": false
"hasContainer": true
}
},
{
@ -1133,7 +1133,7 @@
"hardness": 2.0,
"resistance": 3.0,
"ticksRandomly": false,
"fullCube": true,
"fullCube": false,
"slipperiness": 0.6,
"liquid": false,
"solid": true,
@ -1246,7 +1246,7 @@
"unpushable": false,
"mapColor": "#8f7748",
"isTranslucent": false,
"hasContainer": false
"hasContainer": true
}
},
{
@ -1383,7 +1383,7 @@
"hardness": 2.0,
"resistance": 2.0,
"ticksRandomly": false,
"fullCube": true,
"fullCube": false,
"slipperiness": 0.6,
"liquid": false,
"solid": true,
@ -1391,10 +1391,10 @@
"burnable": false,
"opaque": true,
"replacedDuringPlacement": false,
"toolRequired": false,
"toolRequired": true,
"fragileWhenPushed": false,
"unpushable": false,
"mapColor": "#7f3fb2",
"mapColor": "#707070",
"isTranslucent": true,
"hasContainer": true
}
@ -1408,7 +1408,7 @@
"hardness": 0.3,
"resistance": 0.3,
"ticksRandomly": false,
"fullCube": true,
"fullCube": false,
"slipperiness": 0.6,
"liquid": false,
"solid": true,
@ -16899,4 +16899,4 @@
"hasContainer": false
}
}
]
]

View File

@ -316,16 +316,11 @@
"47:0": "minecraft:bookshelf",
"48:0": "minecraft:mossy_cobblestone",
"49:0": "minecraft:obsidian",
"50:0": "minecraft:torch",
"50:1": "minecraft:wall_torch[facing=east]",
"50:2": "minecraft:wall_torch[facing=west]",
"50:3": "minecraft:wall_torch[facing=south]",
"50:4": "minecraft:wall_torch[facing=north]",
"50:9": "minecraft:wall_torch[facing=east]",
"50:10": "minecraft:wall_torch[facing=west]",
"50:11": "minecraft:wall_torch[facing=south]",
"50:12": "minecraft:wall_torch[facing=north]",
"50:13": "minecraft:torch",
"50:5": "minecraft:torch",
"51:0": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=0]",
"51:1": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=1]",
"51:2": "minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=2]",
@ -351,15 +346,10 @@
"53:5": "minecraft:oak_stairs[half=top,shape=outer_right,facing=west]",
"53:6": "minecraft:oak_stairs[half=top,shape=outer_right,facing=south]",
"53:7": "minecraft:oak_stairs[half=top,shape=outer_right,facing=north]",
"54:0": "minecraft:chest",
"54:2": "minecraft:chest[facing=north,type=single]",
"54:3": "minecraft:chest[facing=south,type=single]",
"54:4": "minecraft:chest[facing=west,type=single]",
"54:5": "minecraft:chest[facing=east,type=single]",
"54:10": "minecraft:chest[facing=north]",
"54:11": "minecraft:chest[facing=south]",
"54:12": "minecraft:chest[facing=west]",
"54:13": "minecraft:chest[facing=east]",
"55:0": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=0]",
"55:1": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=1]",
"55:2": "minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=2]",
@ -395,40 +385,30 @@
"60:5": "minecraft:farmland[moisture=5]",
"60:6": "minecraft:farmland[moisture=6]",
"60:7": "minecraft:farmland[moisture=7]",
"61:0": "minecraft:furnace",
"61:2": "minecraft:furnace[facing=north,lit=false]",
"61:3": "minecraft:furnace[facing=south,lit=false]",
"61:4": "minecraft:furnace[facing=west,lit=false]",
"61:5": "minecraft:furnace[facing=east,lit=false]",
"61:10": "minecraft:furnace[facing=north,lit=false]",
"61:11": "minecraft:furnace[facing=south,lit=false]",
"61:12": "minecraft:furnace[facing=west,lit=false]",
"61:13": "minecraft:furnace[facing=east,lit=false]",
"62:0": "minecraft:furnace[lit=true]",
"62:2": "minecraft:furnace[facing=north,lit=true]",
"62:3": "minecraft:furnace[facing=south,lit=true]",
"62:4": "minecraft:furnace[facing=west,lit=true]",
"62:5": "minecraft:furnace[facing=east,lit=true]",
"62:10": "minecraft:furnace[facing=north,lit=true]",
"62:11": "minecraft:furnace[facing=south,lit=true]",
"62:12": "minecraft:furnace[facing=west,lit=true]",
"62:13": "minecraft:furnace[facing=east,lit=true]",
"63:0": "minecraft:oak_sign[rotation=0]",
"63:1": "minecraft:oak_sign[rotation=1]",
"63:2": "minecraft:oak_sign[rotation=2]",
"63:3": "minecraft:oak_sign[rotation=3]",
"63:4": "minecraft:oak_sign[rotation=4]",
"63:5": "minecraft:oak_sign[rotation=5]",
"63:6": "minecraft:oak_sign[rotation=6]",
"63:7": "minecraft:oak_sign[rotation=7]",
"63:8": "minecraft:oak_sign[rotation=8]",
"63:9": "minecraft:oak_sign[rotation=9]",
"63:10": "minecraft:oak_sign[rotation=10]",
"63:11": "minecraft:oak_sign[rotation=11]",
"63:12": "minecraft:oak_sign[rotation=12]",
"63:13": "minecraft:oak_sign[rotation=13]",
"63:14": "minecraft:oak_sign[rotation=14]",
"63:15": "minecraft:oak_sign[rotation=15]",
"63:0": "minecraft:sign[rotation=0]",
"63:1": "minecraft:sign[rotation=1]",
"63:2": "minecraft:sign[rotation=2]",
"63:3": "minecraft:sign[rotation=3]",
"63:4": "minecraft:sign[rotation=4]",
"63:5": "minecraft:sign[rotation=5]",
"63:6": "minecraft:sign[rotation=6]",
"63:7": "minecraft:sign[rotation=7]",
"63:8": "minecraft:sign[rotation=8]",
"63:9": "minecraft:sign[rotation=9]",
"63:10": "minecraft:sign[rotation=10]",
"63:11": "minecraft:sign[rotation=11]",
"63:12": "minecraft:sign[rotation=12]",
"63:13": "minecraft:sign[rotation=13]",
"63:14": "minecraft:sign[rotation=14]",
"63:15": "minecraft:sign[rotation=15]",
"64:0": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=east,open=false]",
"64:1": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=south,open=false]",
"64:2": "minecraft:oak_door[hinge=right,half=lower,powered=false,facing=west,open=false]",
@ -441,15 +421,10 @@
"64:9": "minecraft:oak_door[hinge=right,half=upper,powered=false,facing=east,open=false]",
"64:10": "minecraft:oak_door[hinge=left,half=upper,powered=true,facing=east,open=false]",
"64:11": "minecraft:oak_door[hinge=right,half=upper,powered=true,facing=east,open=false]",
"65:0": "minecraft:ladder",
"65:2": "minecraft:ladder[facing=north]",
"65:3": "minecraft:ladder[facing=south]",
"65:4": "minecraft:ladder[facing=west]",
"65:5": "minecraft:ladder[facing=east]",
"65:10": "minecraft:ladder[facing=north]",
"65:11": "minecraft:ladder[facing=south]",
"65:12": "minecraft:ladder[facing=west]",
"65:13": "minecraft:ladder[facing=east]",
"66:0": "minecraft:rail[shape=north_south]",
"66:1": "minecraft:rail[shape=east_west]",
"66:2": "minecraft:rail[shape=ascending_east]",
@ -468,15 +443,10 @@
"67:5": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=west]",
"67:6": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=south]",
"67:7": "minecraft:cobblestone_stairs[half=top,shape=straight,facing=north]",
"68:0": "minecraft:oak_wall_sign",
"68:2": "minecraft:oak_wall_sign[facing=north]",
"68:3": "minecraft:oak_wall_sign[facing=south]",
"68:4": "minecraft:oak_wall_sign[facing=west]",
"68:5": "minecraft:oak_wall_sign[facing=east]",
"68:10": "minecraft:oak_wall_sign[facing=north]",
"68:11": "minecraft:oak_wall_sign[facing=south]",
"68:12": "minecraft:oak_wall_sign[facing=west]",
"68:13": "minecraft:oak_wall_sign[facing=east]",
"68:2": "minecraft:wall_sign[facing=north]",
"68:3": "minecraft:wall_sign[facing=south]",
"68:4": "minecraft:wall_sign[facing=west]",
"68:5": "minecraft:wall_sign[facing=east]",
"69:0": "minecraft:lever[powered=false,facing=north,face=ceiling]",
"69:1": "minecraft:lever[powered=false,facing=east,face=wall]",
"69:2": "minecraft:lever[powered=false,facing=west,face=wall]",
@ -511,28 +481,16 @@
"72:1": "minecraft:oak_pressure_plate[powered=true]",
"73:0": "minecraft:redstone_ore[lit=false]",
"74:0": "minecraft:redstone_ore[lit=true]",
"75:0": "minecraft:redstone_torch[lit=false]",
"75:1": "minecraft:redstone_wall_torch[facing=east,lit=false]",
"75:2": "minecraft:redstone_wall_torch[facing=west,lit=false]",
"75:3": "minecraft:redstone_wall_torch[facing=south,lit=false]",
"75:4": "minecraft:redstone_wall_torch[facing=north,lit=false]",
"75:5": "minecraft:redstone_torch[lit=false]",
"75:9": "minecraft:redstone_wall_torch[facing=east,lit=false]",
"75:10": "minecraft:redstone_wall_torch[facing=west,lit=false]",
"75:11": "minecraft:redstone_wall_torch[facing=south,lit=false]",
"75:12": "minecraft:redstone_wall_torch[facing=north,lit=false]",
"75:13": "minecraft:redstone_wall_torch[lit=false]",
"76:0": "minecraft:redstone_torch[lit=true]",
"76:1": "minecraft:redstone_wall_torch[facing=east,lit=true]",
"76:2": "minecraft:redstone_wall_torch[facing=west,lit=true]",
"76:3": "minecraft:redstone_wall_torch[facing=south,lit=true]",
"76:4": "minecraft:redstone_wall_torch[facing=north,lit=true]",
"76:5": "minecraft:redstone_wall_torch[lit=true]",
"76:9": "minecraft:redstone_wall_torch[facing=east,lit=true]",
"76:10": "minecraft:redstone_wall_torch[facing=west,lit=true]",
"76:11": "minecraft:redstone_wall_torch[facing=south,lit=true]",
"76:12": "minecraft:redstone_wall_torch[facing=north,lit=true]",
"76:13": "minecraft:redstone_wall_torch[lit=true]",
"76:5": "minecraft:redstone_torch[lit=true]",
"77:0": "minecraft:stone_button[powered=false,facing=east,face=ceiling]",
"77:1": "minecraft:stone_button[powered=false,facing=east,face=wall]",
"77:2": "minecraft:stone_button[powered=false,facing=west,face=wall]",
@ -598,15 +556,8 @@
"87:0": "minecraft:netherrack",
"88:0": "minecraft:soul_sand",
"89:0": "minecraft:glowstone",
"90:0": "minecraft:nether_portal",
"90:1": "minecraft:nether_portal[axis=x]",
"90:2": "minecraft:nether_portal[axis=z]",
"90:5": "minecraft:nether_portal[axis=x]",
"90:6": "minecraft:nether_portal[axis=z]",
"90:9": "minecraft:nether_portal[axis=x]",
"90:10": "minecraft:nether_portal[axis=z]",
"90:13": "minecraft:nether_portal[axis=x]",
"90:14": "minecraft:nether_portal[axis=z]",
"91:0": "minecraft:jack_o_lantern[facing=south]",
"91:1": "minecraft:jack_o_lantern[facing=west]",
"91:2": "minecraft:jack_o_lantern[facing=north]",
@ -866,15 +817,10 @@
"128:6": "minecraft:sandstone_stairs[half=top,shape=straight,facing=south]",
"128:7": "minecraft:sandstone_stairs[half=top,shape=straight,facing=north]",
"129:0": "minecraft:emerald_ore",
"130:0": "minecraft:ender_chest",
"130:2": "minecraft:ender_chest[facing=north]",
"130:3": "minecraft:ender_chest[facing=south]",
"130:4": "minecraft:ender_chest[facing=west]",
"130:5": "minecraft:ender_chest[facing=east]",
"130:10": "minecraft:ender_chest[facing=north]",
"130:11": "minecraft:ender_chest[facing=south]",
"130:12": "minecraft:ender_chest[facing=west]",
"130:13": "minecraft:ender_chest[facing=east]",
"131:0": "minecraft:tripwire_hook[powered=false,attached=false,facing=south]",
"131:1": "minecraft:tripwire_hook[powered=false,attached=false,facing=west]",
"131:2": "minecraft:tripwire_hook[powered=false,attached=false,facing=north]",
@ -1007,15 +953,10 @@
"145:9": "minecraft:damaged_anvil[facing=west]",
"145:10": "minecraft:damaged_anvil[facing=north]",
"145:11": "minecraft:damaged_anvil[facing=east]",
"146:0": "minecraft:trapped_chest",
"146:2": "minecraft:trapped_chest[facing=north,type=single]",
"146:3": "minecraft:trapped_chest[facing=south,type=single]",
"146:4": "minecraft:trapped_chest[facing=west,type=single]",
"146:5": "minecraft:trapped_chest[facing=east,type=single]",
"146:10": "minecraft:trapped_chest[facing=north,type=single]",
"146:11": "minecraft:trapped_chest[facing=south,type=single]",
"146:12": "minecraft:trapped_chest[facing=west,type=single]",
"146:13": "minecraft:trapped_chest[facing=east,type=single]",
"147:0": "minecraft:light_weighted_pressure_plate[power=0]",
"147:1": "minecraft:light_weighted_pressure_plate[power=1]",
"147:2": "minecraft:light_weighted_pressure_plate[power=2]",
@ -1283,15 +1224,10 @@
"176:13": "minecraft:white_banner[rotation=13]",
"176:14": "minecraft:white_banner[rotation=14]",
"176:15": "minecraft:white_banner[rotation=15]",
"177:0": "minecraft:white_wall_banner",
"177:2": "minecraft:white_wall_banner[facing=north]",
"177:3": "minecraft:white_wall_banner[facing=south]",
"177:4": "minecraft:white_wall_banner[facing=west]",
"177:5": "minecraft:white_wall_banner[facing=east]",
"177:10": "minecraft:white_wall_banner[facing=north]",
"177:11": "minecraft:white_wall_banner[facing=south]",
"177:12": "minecraft:white_wall_banner[facing=west]",
"177:13": "minecraft:white_wall_banner[facing=east]",
"178:0": "minecraft:daylight_detector[inverted=true,power=0]",
"178:1": "minecraft:daylight_detector[inverted=true,power=1]",
"178:2": "minecraft:daylight_detector[inverted=true,power=2]",
@ -2196,7 +2132,7 @@
"321:0": "minecraft:painting",
"322:0": "minecraft:golden_apple",
"322:1": "minecraft:enchanted_golden_apple",
"323:0": "minecraft:oak_sign",
"323:0": "minecraft:sign",
"324:0": "minecraft:oak_door",
"325:0": "minecraft:bucket",
"326:0": "minecraft:water_bucket",

View File

@ -19,19 +19,20 @@
package com.sk89q.minecraft.util.commands;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.HashSet;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
public class CommandContextTest {
@ -39,7 +40,7 @@ public class CommandContextTest {
private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something";
CommandContext firstCommand;
@Before
@BeforeEach
public void setUpTest() {
try {
firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w')));
@ -49,10 +50,12 @@ public class CommandContextTest {
}
}
@Test(expected = CommandException.class)
public void testInvalidFlags() throws CommandException {
@Test
public void testInvalidFlags() {
final String failingCommand = "herpderp -opw testers";
assertThrows(CommandException.class, () -> {
new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w')));
});
}
@Test

View File

@ -19,34 +19,29 @@
package com.sk89q.worldedit.extent.transform;
import static org.junit.Assert.assertEquals;
import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.util.HashSet;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
@Ignore("A platform is currently required to get properties, preventing this test.")
@Disabled("A platform is currently required to get properties, preventing this test.")
public class BlockTransformExtentTest {
private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90);
private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90);
private final Set<BlockType> ignored = new HashSet<>();
@Before
public void setUp() throws Exception {
@BeforeEach
public void setUp() {
// BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test"));
}
@Test
public void testTransform() throws Exception {
public void testTransform() {
// for (BlockType type : BlockType.REGISTRY.values()) {
// if (ignored.contains(type)) {
// continue;
@ -66,4 +61,4 @@ public class BlockTransformExtentTest {
// assertEquals(base, rotated);
// }
}
}
}

View File

@ -0,0 +1,5 @@
junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.mode.default=concurrent
junit.jupiter.execution.parallel.mode.classes.default=same_thread
junit.jupiter.execution.parallel.config.strategy=dynamic
junit.jupiter.execution.parallel.config.dynamic.factor=4