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

@ -12,9 +12,9 @@ configurations.all {
resolutionStrategy { resolutionStrategy {
// Fabric needs this. // Fabric needs this.
force( force(
"commons-io:commons-io:2.5", "commons-io:commons-io:2.5",
"org.ow2.asm:asm:7.1", "org.ow2.asm:asm:7.1",
"org.ow2.asm:asm-commons:7.1" "org.ow2.asm:asm-commons:7.1"
) )
} }
} }

View File

@ -13,7 +13,6 @@ fun Project.applyCommonConfiguration() {
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
maven { url = uri("http://empcraft.com/maven2") } maven { url = uri("http://empcraft.com/maven2") }
maven { url = uri("https://repo.destroystokyo.com/repository/maven-public") } maven { url = uri("https://repo.destroystokyo.com/repository/maven-public") }
//maven { url = uri("https://ci.athion.net/job/FAWE-Piston/ws/") }
ivy { url = uri("https://ci.athion.net/job") ivy { url = uri("https://ci.athion.net/job")
patternLayout { patternLayout {
artifact("/[organisation]/[module]/artifact/[revision].[ext]") artifact("/[organisation]/[module]/artifact/[revision].[ext]")

View File

@ -22,7 +22,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
apply(plugin = "eclipse") apply(plugin = "eclipse")
apply(plugin = "idea") apply(plugin = "idea")
apply(plugin = "maven") apply(plugin = "maven")
apply(plugin = "checkstyle") //apply(plugin = "checkstyle")
apply(plugin = "com.github.johnrengelman.shadow") apply(plugin = "com.github.johnrengelman.shadow")
apply(plugin = "com.jfrog.artifactory") apply(plugin = "com.jfrog.artifactory")
@ -33,10 +33,10 @@ fun Project.applyPlatformAndCoreConfiguration() {
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
} }
configure<CheckstyleExtension> { // configure<CheckstyleExtension> {
configFile = rootProject.file("config/checkstyle/checkstyle.xml") // configFile = rootProject.file("config/checkstyle/checkstyle.xml")
toolVersion = "7.6.1" // toolVersion = "7.6.1"
} // }
tasks.withType<Test>().configureEach { tasks.withType<Test>().configureEach {
useJUnitPlatform() useJUnitPlatform()
@ -86,9 +86,9 @@ fun Project.applyPlatformAndCoreConfiguration() {
} }
} }
tasks.named("check").configure { // tasks.named("check").configure {
dependsOn("checkstyleMain", "checkstyleTest") // dependsOn("checkstyleMain", "checkstyleTest")
} // }
} }

View File

@ -1,7 +1,7 @@
object Versions { object Versions {
const val TEXT = "3.0.1" const val TEXT = "3.0.1"
const val TEXT_EXTRAS = "3.0.2" const val TEXT_EXTRAS = "3.0.2"
const val PISTON = "0.4.4-SNAPSHOT" const val PISTON = "0.4.3"
const val AUTO_VALUE = "1.6.5" const val AUTO_VALUE = "1.6.5"
const val JUNIT = "5.5.0" const val JUNIT = "5.5.0"
const val MOCKITO = "3.0.0" const val MOCKITO = "3.0.0"

View File

@ -65,10 +65,6 @@
<property name="format" value="(?!Character)\.to(Lower|Upper)Case\(\)"/> <property name="format" value="(?!Character)\.to(Lower|Upper)Case\(\)"/>
<property name="illegalPattern" value="true"/> <property name="illegalPattern" value="true"/>
</module> </module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="ignored|ignore"/>
</module>
</module> </module>
<!-- Validate that command annotations are formatted correctly --> <!-- Validate that command annotations are formatted correctly -->
<module name="RegexpMultiline"> <module name="RegexpMultiline">

View File

@ -6,10 +6,9 @@ Example usage:
You may or may not install these scripts -- it is optional. If you are, however, You may or may not install these scripts -- it is optional. If you are, however,
place the entire craftscripts/ folder into the respective directory for the platform place the entire craftscripts/ folder into the respective directory for the platform
that you have installed WorldEdit for that you have installed WorldEdit.
(see http://wiki.sk89q.com/wiki/WorldEdit/Installation).
In order to be able to use CraftScripts, you must install the Rhino JavaScript library. In order to be able to use CraftScripts, you must install the Rhino JavaScript library.
The installation page linked above has information about that. More information The installation page linked above has information about that. More information
about scripts in general can be found at about scripts in general can be found at
http://wiki.sk89q.com/wiki/WorldEdit/Scripting https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/

View File

@ -1,4 +1,4 @@
#group=com.sk89q.worldedit group=com.sk89q.worldedit
#version=7.1.0-SNAPSHOT version=7.1.0-SNAPSHOT
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G

View File

@ -27,41 +27,38 @@ configurations.all {
} }
dependencies { dependencies {
"compile"("net.milkbowl.vault:VaultAPI:1.7") "compile"("net.milkbowl.vault:VaultAPI:1.7") { isTransitive = false }
"api"(project(":worldedit-core")) "api"(project(":worldedit-core"))
"api"(project(":worldedit-libs:bukkit")) "api"(project(":worldedit-libs:bukkit"))
"api"("org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT") { "compile"("it.unimi.dsi:fastutil:8.2.1")
"api"("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT") {
exclude("junit", "junit") exclude("junit", "junit")
} }
"compile"("it.unimi.dsi:fastutil:8.2.1") "compileOnly"("org.spigotmc:spigot:1.14.4-R0.1-SNAPSHOT")
"compileOnly"("com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT")
"compile"("com.destroystokyo.paper:paper-api:1.14.4-R0.1-SNAPSHOT")
"compileOnly"("BuildTools:spigot-1.14.4:lastSuccessfulBuild@jar")
"implementation"("io.papermc:paperlib:1.0.2") "implementation"("io.papermc:paperlib:1.0.2")
"compileOnly"("com.sk89q:dummypermscompat:1.10") "compileOnly"("com.sk89q:dummypermscompat:1.10")
"implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1") "implementation"("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
"implementation"("org.bstats:bstats-bukkit:1.5") "implementation"("org.bstats:bstats-bukkit:1.5")
"testCompile"("org.mockito:mockito-core:1.9.0-rc1") "testCompile"("org.mockito:mockito-core:1.9.0-rc1")
"implementation"("com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39") "implementation"("com.sk89q.worldguard:worldguard-core:7.0.0-20190215.210421-39") { isTransitive = false }
"implementation"("com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39") "implementation"("com.sk89q.worldguard:worldguard-legacy:7.0.0-20190215.210421-39") { isTransitive = false }
"implementation"("com.massivecraft:factions:2.8.0") "implementation"("com.massivecraft:factions:2.8.0") { isTransitive = false }
"implementation"("com.drtshock:factions:1.6.9.5") "implementation"("com.drtshock:factions:1.6.9.5") { isTransitive = false }
"implementation"("com.factionsone:FactionsOne:1.2.2") "implementation"("com.factionsone:FactionsOne:1.2.2") { isTransitive = false }
"implementation"("me.ryanhamshire:GriefPrevention:11.5.2") "implementation"("me.ryanhamshire:GriefPrevention:11.5.2") { isTransitive = false }
"implementation"("com.massivecraft:mcore:7.0.1") "implementation"("com.massivecraft:mcore:7.0.1") { isTransitive = false }
"implementation"("net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT") "implementation"("net.sacredlabyrinth.Phaed:PreciousStones:10.0.4-SNAPSHOT") { isTransitive = false }
"implementation"("net.jzx7:regios:5.9.9") "implementation"("net.jzx7:regios:5.9.9") { isTransitive = false }
"implementation"("com.bekvon.bukkit.residence:Residence:4.5._13.1") "implementation"("com.bekvon.bukkit.residence:Residence:4.5._13.1") { isTransitive = false }
"implementation"("com.palmergames.bukkit:towny:0.84.0.9") "implementation"("com.palmergames.bukkit:towny:0.84.0.9") { isTransitive = false }
"implementation"("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0") "implementation"("com.thevoxelbox.voxelsniper:voxelsniper:5.171.0") { isTransitive = false }
"implementation"("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT") "implementation"("com.comphenix.protocol:ProtocolLib-API:4.4.0-SNAPSHOT") { isTransitive = false }
"implementation"("com.wasteofplastic:askyblock:3.0.8.2") "implementation"("com.wasteofplastic:askyblock:3.0.8.2") { isTransitive = false }
} }
tasks.named<Copy>("processResources") { tasks.named<Copy>("processResources") {
filesMatching("plugin.yml") { filesMatching("plugin.yml") {
expand("name" to (project.parent?.name ?: "FAWE")) expand("internalVersion" to project.ext["internalVersion"])
expand("version" to (project.parent?.version ?: "UNKNOWN"))
} }
} }

View File

@ -1098,11 +1098,6 @@ public class AsyncWorld extends PassthroughExtent implements World {
return parent.locateNearestStructure(arg0, arg1, arg2, arg3); return parent.locateNearestStructure(arg0, arg1, arg2, arg3);
} }
@Override
public int getViewDistance() {
return parent.getViewDistance();
}
@Override @Override
public RayTraceResult rayTrace(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3, boolean arg4, public RayTraceResult rayTrace(Location arg0, Vector arg1, double arg2, FluidCollisionMode arg3, boolean arg4,
double arg5, Predicate<Entity> arg6) { double arg5, Predicate<Entity> arg6) {

View File

@ -28,6 +28,7 @@ import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
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.BaseItem;
import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
@ -36,6 +37,7 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.AbstractWorld;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
@ -252,9 +254,6 @@ public class BukkitWorld extends AbstractWorld {
@Override @Override
public boolean clearContainerBlockContents(BlockVector3 pt) { public boolean clearContainerBlockContents(BlockVector3 pt) {
Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
if (block == null) {
return false;
}
BlockState state = block.getState(); BlockState state = block.getState();
if (!(state instanceof InventoryHolder)) { if (!(state instanceof InventoryHolder)) {
return false; return false;
@ -321,14 +320,12 @@ public class BukkitWorld extends AbstractWorld {
public void checkLoadedChunk(BlockVector3 pt) { public void checkLoadedChunk(BlockVector3 pt) {
World world = getWorld(); World world = getWorld();
if (!world.isChunkLoaded(pt.getBlockX() >> 4, pt.getBlockZ() >> 4)) { world.getChunkAt(pt.getBlockX() >> 4, pt.getBlockZ() >> 4);
world.loadChunk(pt.getBlockX() >> 4, pt.getBlockZ() >> 4);
}
} }
@Override @Override
public boolean equals(Object other) { public boolean equals(Object other) {
World ref = worldRef.get(); final World ref = worldRef.get();
if (ref == null) { if (ref == null) {
return false; return false;
} else if (other == null) { } else if (other == null) {
@ -337,7 +334,7 @@ public class BukkitWorld extends AbstractWorld {
World otherWorld = ((BukkitWorld) other).worldRef.get(); World otherWorld = ((BukkitWorld) other).worldRef.get();
return ref.equals(otherWorld); return ref.equals(otherWorld);
} else if (other instanceof com.sk89q.worldedit.world.World) { } else if (other instanceof com.sk89q.worldedit.world.World) {
return ((com.sk89q.worldedit.world.World) other).getName().equals(getName()); return ((com.sk89q.worldedit.world.World) other).getName().equals(ref.getName());
} else { } else {
return false; return false;
} }

View File

@ -1,10 +1,10 @@
name: WorldEdit name: WorldEdit
main: com.sk89q.worldedit.bukkit.WorldEditPlugin main: com.sk89q.worldedit.bukkit.WorldEditPlugin
version: ${version} version: "${internalVersion}"
load: STARTUP
api-version: 1.13 api-version: 1.13
description: Fast Async WorldEdit plugin description: Fast Async WorldEdit plugin
authors: [Empire92] authors: [Empire92]
load: STARTUP
loadbefore: [BannerBoard, WorldGuard, PlotSquared, AsyncWorldEdit, AsyncWorldEditInjector] loadbefore: [BannerBoard, WorldGuard, PlotSquared, AsyncWorldEdit, AsyncWorldEditInjector]
database: false database: false
permissions: permissions:

View File

@ -19,20 +19,20 @@
package com.sk89q.wepif; package com.sk89q.wepif;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.junit.Before; import org.junit.jupiter.api.BeforeEach;
import org.junit.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class DinnerPermsResolverTest { public class DinnerPermsResolverTest {
private DinnerPermsResolver resolver; private DinnerPermsResolver resolver;
@Before @BeforeEach
public void setUp() { public void setUp() {
Server server = mock(Server.class); Server server = mock(Server.class);
when(server.getPluginManager()).thenReturn(mock(PluginManager.class)); when(server.getPluginManager()).thenReturn(mock(PluginManager.class));

View File

@ -30,6 +30,7 @@ import org.bukkit.plugin.Plugin;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -52,7 +53,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
@Override @Override
public boolean isPermissionSet(String s) { public boolean isPermissionSet(String s) {
return assignedPermissions.containsKey(s.toLowerCase()); return assignedPermissions.containsKey(s.toLowerCase(Locale.ROOT));
} }
@Override @Override
@ -63,7 +64,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
@Override @Override
public boolean hasPermission(String s) { public boolean hasPermission(String s) {
if (isPermissionSet(s)) { if (isPermissionSet(s)) {
return assignedPermissions.get(s.toLowerCase()); return assignedPermissions.get(s.toLowerCase(Locale.ROOT));
} }
return false; return false;
} }
@ -113,11 +114,11 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
} }
public void setPermission(String permission, boolean value) { public void setPermission(String permission, boolean value) {
assignedPermissions.put(permission.toLowerCase(), value); assignedPermissions.put(permission.toLowerCase(Locale.ROOT), value);
} }
public void unsetPermission(String permission) { public void unsetPermission(String permission) {
assignedPermissions.remove(permission.toLowerCase()); assignedPermissions.remove(permission.toLowerCase(Locale.ROOT));
} }
public void clearPermissions() { public void clearPermissions() {

View File

@ -20,15 +20,16 @@
package com.sk89q.worldedit.bukkit; package com.sk89q.worldedit.bukkit;
import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.TreeGenerator;
import org.junit.Assert; import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
public class BukkitWorldTest { public class BukkitWorldTest {
@Test @Test
public void testTreeTypeMapping() { public void testTreeTypeMapping() {
for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) { for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) {
Assert.assertNotNull("No mapping for: " + type, BukkitWorld.toBukkitTreeType(type)); assertNotNull(BukkitWorld.toBukkitTreeType(type), "No mapping for: " + type);
} }
} }

View File

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

View File

@ -26,8 +26,6 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class CommandContext { public class CommandContext {
@ -256,8 +254,11 @@ public class CommandContext {
} }
public String getString(int start, int end) { public String getString(int start, int end) {
return IntStream.range(start + 1, end + 1).mapToObj(i -> " " + parsedArgs.get(i)) StringBuilder buffer = new StringBuilder(parsedArgs.get(start));
.collect(Collectors.joining("", 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 { 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.session.ClipboardHolder;
import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Identifiable;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
@ -395,7 +396,7 @@ public class LocalSession implements TextureHolder {
return null; 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) { if (Settings.IMP.HISTORY.USE_DISK) {
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE; 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) { if (Settings.IMP.HISTORY.USE_DISK) {
LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE; LocalSession.MAX_HISTORY_SIZE = Integer.MAX_VALUE;
} }

View File

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

View File

@ -19,14 +19,12 @@
package com.sk89q.worldedit.internal.command; 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.ImmutableList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.sk89q.worldedit.extension.platform.PlatformCommandManager; import com.sk89q.worldedit.extension.platform.PlatformCommandManager;
import com.sk89q.worldedit.internal.util.Substring; import com.sk89q.worldedit.internal.util.Substring;
import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TextComponent;
import static java.util.stream.Collectors.toList;
import org.enginehub.piston.Command; import org.enginehub.piston.Command;
import org.enginehub.piston.exception.CommandException; import org.enginehub.piston.exception.CommandException;
import org.enginehub.piston.inject.InjectedValueAccess; import org.enginehub.piston.inject.InjectedValueAccess;
@ -40,6 +38,9 @@ import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkState;
import static java.util.stream.Collectors.toList;
public class CommandUtil { public class CommandUtil {
public static Map<String, Command> getSubCommands(Command currentCommand) { 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}. * Fix {@code suggestions} to replace the last space-separated word in {@code arguments}.
*/ */
public static List<String> fixSuggestions(String arguments, List<Substring> suggestions) { 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() 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) .filter(Optional::isPresent)
.map(Optional::get) .map(Optional::get)
.collect(toList()); .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 * Given the last word of a command, mutate the suggestion to replace the last word, if
* possible. * possible.
*/ */
private static Optional<String> suggestLast(Substring last, Substring suggestion) { 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. // this suggestion is for the next argument.
if (last.getSubstring().isEmpty()) { if (last.getSubstring().isEmpty()) {
return Optional.of(suggestion.getSubstring()); 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.CuboidRegion;
import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.RegionSelector;
import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; 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.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
@ -114,11 +115,12 @@ public class ServerCUIHandler {
} }
// Borrowed this math from FAWE // Borrowed this math from FAWE
double rotX = player.getLocation().getYaw(); final Location location = player.getLocation();
double rotY = player.getLocation().getPitch(); double rotX = location.getYaw();
double rotY = location.getPitch();
double xz = Math.cos(Math.toRadians(rotY)); double xz = Math.cos(Math.toRadians(rotY));
int x = (int) (player.getLocation().getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12); int x = (int) (location.getX() - (-xz * Math.sin(Math.toRadians(rotX))) * 12);
int z = (int) (player.getLocation().getZ() - (xz * Math.cos(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)); int y = Math.max(0, Math.min(Math.min(255, posY + 32), posY + 3));
Map<String, Tag> structureTag = new HashMap<>(); 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 final Logger log = LoggerFactory.getLogger(SessionManager.class);
private static boolean warnedInvalidTool; 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 WorldEdit worldEdit;
private final Map<UUID, SessionHolder> sessions = new HashMap<>(); private final Map<UUID, SessionHolder> sessions = new HashMap<>();
private SessionStore store = new VoidStore(); private SessionStore store = new VoidStore();

View File

@ -19,8 +19,10 @@
package com.sk89q.worldedit.util.concurrency; 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.ExecutorService;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; 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 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 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 * @return the newly created thread pool
*/ */
public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int queueSize) { 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( ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
minThreads, maxThreads, minThreads, maxThreads,
60L, TimeUnit.SECONDS, 60L, TimeUnit.SECONDS,
new ArrayBlockingQueue<>(queueSize)); new LinkedBlockingDeque<>(queueSize));
threadPoolExecutor.allowCoreThreadTimeOut(true); threadPoolExecutor.allowCoreThreadTimeOut(true);
if (threadFormat != null) {
threadPoolExecutor.setThreadFactory(new ThreadFactoryBuilder().setNameFormat(threadFormat).build());
}
return threadPoolExecutor; return threadPoolExecutor;
} }

View File

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

View File

@ -72,7 +72,6 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
* *
* @return the maximum Y * @return the maximum Y
*/ */
@Override
int getMaxY(); 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 * @param newestFirst true to get the newest first
* @return a list of snapshots * @return a list of snapshots
*/ */
public List<Snapshot> getSnapshots(boolean newestFirst, String worldName) public List<Snapshot> getSnapshots(boolean newestFirst, String worldName) throws MissingWorldException {
throws MissingWorldException {
FilenameFilter filter = (dir, name) -> { FilenameFilter filter = (dir, name) -> {
File f = new File(dir, name); File f = new File(dir, name);
return isValidSnapshot(f); return isValidSnapshot(f);
@ -116,8 +116,7 @@ public class SnapshotRepository {
* @return a snapshot or null * @return a snapshot or null
*/ */
@Nullable @Nullable
public Snapshot getSnapshotAfter(ZonedDateTime date, String world) public Snapshot getSnapshotAfter(ZonedDateTime date, String world) throws MissingWorldException {
throws MissingWorldException {
List<Snapshot> snapshots = getSnapshots(true, world); List<Snapshot> snapshots = getSnapshots(true, world);
Snapshot last = null; Snapshot last = null;
@ -139,8 +138,7 @@ public class SnapshotRepository {
* @return a snapshot or null * @return a snapshot or null
*/ */
@Nullable @Nullable
public Snapshot getSnapshotBefore(ZonedDateTime date, String world) public Snapshot getSnapshotBefore(ZonedDateTime date, String world) throws MissingWorldException {
throws MissingWorldException {
List<Snapshot> snapshots = getSnapshots(false, world); List<Snapshot> snapshots = getSnapshots(false, world);
Snapshot last = null; Snapshot last = null;
@ -206,8 +204,7 @@ public class SnapshotRepository {
* @return whether it is a valid snapshot * @return whether it is a valid snapshot
*/ */
protected boolean isValidSnapshot(File file) { protected boolean isValidSnapshot(File file) {
if (!file.getName() if (!file.getName().matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
.matches("^[A-Za-z0-9_\\- \\./\\\\'\\$@~!%\\^\\*\\(\\)\\[\\]\\+\\{\\},\\?]+$")) {
return false; return false;
} }

View File

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

View File

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

View File

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

View File

@ -19,34 +19,29 @@
package com.sk89q.worldedit.extent.transform; 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.AffineTransform;
import com.sk89q.worldedit.math.transform.Transform; 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.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.HashSet;
import java.util.Set; 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 { public class BlockTransformExtentTest {
private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90); private static final Transform ROTATE_90 = new AffineTransform().rotateY(-90);
private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90); private static final Transform ROTATE_NEG_90 = new AffineTransform().rotateY(90);
private final Set<BlockType> ignored = new HashSet<>(); private final Set<BlockType> ignored = new HashSet<>();
@Before @BeforeEach
public void setUp() throws Exception { public void setUp() {
// BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test")); // BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test"));
} }
@Test @Test
public void testTransform() throws Exception { public void testTransform() {
// for (BlockType type : BlockType.REGISTRY.values()) { // for (BlockType type : BlockType.REGISTRY.values()) {
// if (ignored.contains(type)) { // if (ignored.contains(type)) {
// continue; // continue;

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

View File

@ -1,11 +1,6 @@
applyLibrariesConfiguration() applyLibrariesConfiguration()
dependencies { dependencies {
/*
"shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar")
"shade"("FAWE-Piston:core-ap/runtime/build/libs/runtime-${Versions.PISTON}:lastSuccessfulBuild@jar")
"shade"("FAWE-Piston:default-impl/build/libs/default-impl-${Versions.PISTON}:lastSuccessfulBuild@jar")
*/
"shade"("org.enginehub.piston.core-ap:annotations:${Versions.PISTON}") "shade"("org.enginehub.piston.core-ap:annotations:${Versions.PISTON}")
"shade"("org.enginehub.piston.core-ap:processor:${Versions.PISTON}") "shade"("org.enginehub.piston.core-ap:processor:${Versions.PISTON}")
} }

View File

@ -13,9 +13,4 @@ dependencies {
"shade"("org.enginehub.piston:core:${Versions.PISTON}") "shade"("org.enginehub.piston:core:${Versions.PISTON}")
"shade"("org.enginehub.piston.core-ap:runtime:${Versions.PISTON}") "shade"("org.enginehub.piston.core-ap:runtime:${Versions.PISTON}")
"shade"("org.enginehub.piston:default-impl:${Versions.PISTON}") "shade"("org.enginehub.piston:default-impl:${Versions.PISTON}")
/*
"shade"("FAWE-Piston:core/build/libs/core-${Versions.PISTON}:lastSuccessfulBuild@jar")
"shade"("FAWE-Piston:core-ap/runtime/build/libs/runtime-${Versions.PISTON}:lastSuccessfulBuild@jar")
"shade"("FAWE-Piston:default-impl/build/libs/default-impl-${Versions.PISTON}:lastSuccessfulBuild@jar")
*/
} }