3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-07-09 03:58:04 +02:00

More compile fixes

Dieser Commit ist enthalten in:
MattBDev 2019-08-22 13:14:27 -04:00
Ursprung 6998c2d230
Commit 135c12b650
32 geänderte Dateien mit 217 neuen und 269 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -13,7 +13,6 @@ fun Project.applyCommonConfiguration() {
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
maven { url = uri("http://empcraft.com/maven2") }
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")
patternLayout {
artifact("/[organisation]/[module]/artifact/[revision].[ext]")

Datei anzeigen

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

Datei anzeigen

@ -1,7 +1,7 @@
object Versions {
const val TEXT = "3.0.1"
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 JUNIT = "5.5.0"
const val MOCKITO = "3.0.0"

Datei anzeigen

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

Datei anzeigen

@ -6,10 +6,9 @@ Example usage:
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
that you have installed WorldEdit for
(see http://wiki.sk89q.com/wiki/WorldEdit/Installation).
that you have installed WorldEdit.
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
about scripts in general can be found at
http://wiki.sk89q.com/wiki/WorldEdit/Scripting
https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -19,26 +19,26 @@
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.plugin.PluginManager;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
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 {
private DinnerPermsResolver resolver;
@Before
@BeforeEach
public void setUp() {
Server server = mock(Server.class);
when(server.getPluginManager()).thenReturn(mock(PluginManager.class));
resolver = new DinnerPermsResolver(server);
}
@Test
public void testBasicResolving() {
final TestOfflinePermissible permissible = new TestOfflinePermissible();
@ -49,7 +49,7 @@ public class DinnerPermsResolverTest {
assertFalse(resolver.hasPermission(permissible, "completely.unrelated"));
permissible.clearPermissions();
}
@Test
public void testBasicWildcardResolution() {
final TestOfflinePermissible permissible = new TestOfflinePermissible();
@ -59,7 +59,7 @@ public class DinnerPermsResolverTest {
assertTrue(resolver.hasPermission(permissible, "commandbook.spawnmob.spider.skeleton"));
permissible.clearPermissions();
}
@Test
public void testNegatingNodes() {
final TestOfflinePermissible permissible = new TestOfflinePermissible();
@ -67,16 +67,16 @@ public class DinnerPermsResolverTest {
permissible.setPermission("commandbook.cuteasianboys", false);
permissible.setPermission("commandbook.warp.*", false);
permissible.setPermission("commandbook.warp.create", true);
assertTrue(resolver.hasPermission(permissible, "commandbook.motd"));
assertFalse(resolver.hasPermission(permissible, "commandbook.cuteasianboys"));
assertFalse(resolver.hasPermission(permissible, "commandbook.warp.remove"));
assertTrue(resolver.hasPermission(permissible, "commandbook.warp.create"));
permissible.clearPermissions();
}
@Test
public void testInGroup() {
final TestOfflinePermissible permissible = new TestOfflinePermissible();

Datei anzeigen

@ -30,6 +30,7 @@ import org.bukkit.plugin.Plugin;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@ -37,7 +38,7 @@ import java.util.UUID;
public class TestOfflinePermissible implements OfflinePlayer, Permissible {
private boolean op;
private UUID randomUuid = UUID.randomUUID();
private final Map<String, Boolean> assignedPermissions = new HashMap<>();
@Override
@ -52,7 +53,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
@Override
public boolean isPermissionSet(String s) {
return assignedPermissions.containsKey(s.toLowerCase());
return assignedPermissions.containsKey(s.toLowerCase(Locale.ROOT));
}
@Override
@ -63,7 +64,7 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
@Override
public boolean hasPermission(String s) {
if (isPermissionSet(s)) {
return assignedPermissions.get(s.toLowerCase());
return assignedPermissions.get(s.toLowerCase(Locale.ROOT));
}
return false;
}
@ -111,19 +112,19 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible {
}
return ret;
}
public void setPermission(String permission, boolean value) {
assignedPermissions.put(permission.toLowerCase(), value);
assignedPermissions.put(permission.toLowerCase(Locale.ROOT), value);
}
public void unsetPermission(String permission) {
assignedPermissions.remove(permission.toLowerCase());
assignedPermissions.remove(permission.toLowerCase(Locale.ROOT));
}
public void clearPermissions() {
assignedPermissions.clear();
}
// -- Unneeded OfflinePlayer methods
@Override

Datei anzeigen

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

Datei anzeigen

@ -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")
}
}

Datei anzeigen

@ -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 {

Datei anzeigen

@ -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;
}

Datei anzeigen

@ -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;
}
/**

Datei anzeigen

@ -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());

Datei anzeigen

@ -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<>();

Datei anzeigen

@ -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();

Datei anzeigen

@ -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;
}

Datei anzeigen

@ -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()) {

Datei anzeigen

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

Datei anzeigen

@ -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;
}

Datei anzeigen

@ -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
}
}
]
]

Datei anzeigen

@ -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",

Datei anzeigen

@ -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

Datei anzeigen

@ -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);
// }
}
}
}

Datei anzeigen

@ -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

Datei anzeigen

@ -1,11 +1,6 @@
applyLibrariesConfiguration()
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:processor:${Versions.PISTON}")
}

Datei anzeigen

@ -13,9 +13,4 @@ dependencies {
"shade"("org.enginehub.piston:core:${Versions.PISTON}")
"shade"("org.enginehub.piston.core-ap:runtime:${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")
*/
}