3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 10:30:04 +01:00

Initial Piston conversion test. Non-functional.

Dieser Commit ist enthalten in:
Kenzie Togami 2019-03-14 02:10:37 -07:00
Ursprung 4de5487c51
Commit 1966e5a8a2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 5D200B325E157A81
6 geänderte Dateien mit 91 neuen und 79 gelöschten Zeilen

Datei anzeigen

@ -1,5 +1,6 @@
#Thu Mar 14 00:19:48 PDT 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip

Datei anzeigen

@ -1,3 +1,5 @@
rootProject.name = 'worldedit' rootProject.name = 'worldedit'
include 'worldedit-core', 'worldedit-bukkit', 'worldedit-forge', 'worldedit-sponge' include 'worldedit-core', 'worldedit-bukkit', 'worldedit-forge', 'worldedit-sponge'
includeBuild("../Piston")

Datei anzeigen

@ -1,5 +1,11 @@
plugins {
id("net.ltgt.apt") version "0.21"
}
apply plugin: 'eclipse' apply plugin: 'eclipse'
apply plugin: 'idea' apply plugin: 'idea'
apply plugin: 'net.ltgt.apt-eclipse'
apply plugin: 'net.ltgt.apt-idea'
dependencies { dependencies {
compile 'de.schlichtherle:truezip:6.8.3' compile 'de.schlichtherle:truezip:6.8.3'
@ -13,6 +19,9 @@ dependencies {
compile 'com.sk89q.lib:jlibnoise:1.0.0' compile 'com.sk89q.lib:jlibnoise:1.0.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1' compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'org.slf4j:slf4j-api:1.7.26' compile 'org.slf4j:slf4j-api:1.7.26'
compileOnly 'org.enginehub.piston:core-ap-annotations:0.0.1-SNAPSHOT'
annotationProcessor 'org.enginehub.piston:core-ap-processor:0.0.1-SNAPSHOT'
compile 'org.enginehub.piston:default-impl:0.0.1-SNAPSHOT'
//compile 'net.sf.trove4j:trove4j:3.0.3' //compile 'net.sf.trove4j:trove4j:3.0.3'
testCompile 'org.mockito:mockito-core:1.9.0-rc1' testCompile 'org.mockito:mockito-core:1.9.0-rc1'
} }

Datei anzeigen

@ -21,7 +21,6 @@ package com.sk89q.worldedit.command;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext; import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandException; import com.sk89q.minecraft.util.commands.CommandException;
import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.CommandPermissions;
@ -41,10 +40,13 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.command.binding.Switch;
import com.sk89q.worldedit.util.command.parametric.Optional;
import com.sk89q.worldedit.util.io.Closer; import com.sk89q.worldedit.util.io.Closer;
import com.sk89q.worldedit.util.io.file.FilenameException; import com.sk89q.worldedit.util.io.file.FilenameException;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -64,6 +66,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Commands that work with schematic files. * Commands that work with schematic files.
*/ */
@CommandContainer
public class SchematicCommands { public class SchematicCommands {
/** /**
@ -84,13 +87,13 @@ public class SchematicCommands {
} }
@Command( @Command(
aliases = { "load" }, name = "load",
usage = "[<format>] <filename>", desc = "Load a schematic into your clipboard"
desc = "Load a schematic into your clipboard",
min = 1, max = 2
) )
@CommandPermissions({ "worldedit.clipboard.load", "worldedit.schematic.load" }) @CommandPermissions({"worldedit.clipboard.load", "worldedit.schematic.load"})
public void load(Player player, LocalSession session, @Optional("sponge") String formatName, String filename) throws FilenameException { public void load(Player player, LocalSession session,
@Arg(desc = "File name.") String filename,
@Arg(desc = "Format name.", def = "sponge") String formatName) throws FilenameException {
LocalConfiguration config = worldEdit.getConfiguration(); LocalConfiguration config = worldEdit.getConfiguration();
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir); File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
@ -127,16 +130,15 @@ public class SchematicCommands {
} }
@Command( @Command(
aliases = { "save" }, name = "save",
flags = "f", desc = "Save a schematic into your clipboard"
usage = "[<format>] <filename>",
desc = "Save a schematic into your clipboard",
help = "-f is required to overwrite an existing file",
min = 1, max = 2
) )
@CommandPermissions({ "worldedit.clipboard.save", "worldedit.schematic.save" }) @CommandPermissions({"worldedit.clipboard.save", "worldedit.schematic.save"})
public void save(Player player, LocalSession session, @Optional("sponge") String formatName, public void save(Player player, LocalSession session,
String filename, @Switch('f') boolean allowOverwrite) throws CommandException, WorldEditException { @Arg(desc = "File name.") String filename,
@Arg(desc = "Format name.", def = "sponge") String formatName,
@Switch(name = 'f', desc = "Overwrite an existing file.") boolean allowOverwrite
) throws CommandException, WorldEditException {
LocalConfiguration config = worldEdit.getConfiguration(); LocalConfiguration config = worldEdit.getConfiguration();
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir); File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
@ -198,15 +200,13 @@ public class SchematicCommands {
} }
@Command( @Command(
aliases = { "delete", "d" }, name = "delete",
usage = "<filename>", aliases = {"d"},
desc = "Delete a saved schematic", desc = "Delete a saved schematic"
help = "Delete a schematic from the schematic list",
min = 1,
max = 1
) )
@CommandPermissions("worldedit.schematic.delete") @CommandPermissions("worldedit.schematic.delete")
public void delete(Actor actor, String filename) throws WorldEditException { public void delete(Actor actor,
@Arg(desc = "File name.") String filename) throws WorldEditException {
LocalConfiguration config = worldEdit.getConfiguration(); LocalConfiguration config = worldEdit.getConfiguration();
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir); File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
@ -232,12 +232,12 @@ public class SchematicCommands {
} }
@Command( @Command(
aliases = {"formats", "listformats", "f"}, name = "formats",
desc = "List available formats", aliases = {"listformats", "f"},
max = 0 desc = "List available formats"
) )
@CommandPermissions("worldedit.schematic.formats") @CommandPermissions("worldedit.schematic.formats")
public void formats(Actor actor) throws WorldEditException { public void formats(Actor actor) {
actor.print("Available clipboard formats (Name: Lookup names)"); actor.print("Available clipboard formats (Name: Lookup names)");
StringBuilder builder; StringBuilder builder;
boolean first = true; boolean first = true;
@ -257,18 +257,14 @@ public class SchematicCommands {
} }
@Command( @Command(
aliases = {"list", "all", "ls"}, name = "list",
aliases = {"all", "ls"},
desc = "List saved schematics", desc = "List saved schematics",
max = 1, descFooter = "Note: Format is not fully verified until loading."
flags = "dnp",
help = "List all schematics in the schematics directory\n" +
" -d sorts by date, oldest first\n" +
" -n sorts by date, newest first\n" +
" -p <page> prints the requested page\n" +
"Note: Format is not thoroughly verified until loading."
) )
@CommandPermissions("worldedit.schematic.list") @CommandPermissions("worldedit.schematic.list")
public void list(Actor actor, CommandContext args, @Switch('p') @Optional("1") int page) throws WorldEditException { public void list(Actor actor, CommandContext args,
@ArgFlag(name = 'p', desc = "Page to view.", def = "1") int page) {
File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir); File dir = worldEdit.getWorkingDirectoryFile(worldEdit.getConfiguration().saveDir);
List<File> fileList = allFiles(dir); List<File> fileList = allFiles(dir);
@ -315,7 +311,7 @@ public class SchematicCommands {
actor.print("Available schematics (Filename: Format) [" + page + "/" + pageCount + "]:"); actor.print("Available schematics (Filename: Format) [" + page + "/" + pageCount + "]:");
StringBuilder build = new StringBuilder(); StringBuilder build = new StringBuilder();
int limit = Math.min(offset + SCHEMATICS_PER_PAGE, schematics.size()); int limit = Math.min(offset + SCHEMATICS_PER_PAGE, schematics.size());
for (int i = offset; i < limit;) { for (int i = offset; i < limit; ) {
build.append(schematics.get(i)); build.append(schematics.get(i));
if (++i != limit) { if (++i != limit) {
build.append("\n"); build.append("\n");

Datei anzeigen

@ -30,6 +30,7 @@ import com.sk89q.worldedit.util.task.Supervisor;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.concurrent.ForkJoinPool;
public class AsyncCommandHelper { public class AsyncCommandHelper {
@ -85,7 +86,8 @@ public class AsyncCommandHelper {
.exceptionConverter(exceptionConverter) .exceptionConverter(exceptionConverter)
.onSuccess(format(success)) .onSuccess(format(success))
.onFailure(format(failure)) .onFailure(format(failure))
.build()); .build(),
ForkJoinPool.commonPool());
return this; return this;
} }
@ -96,7 +98,8 @@ public class AsyncCommandHelper {
new MessageFutureCallback.Builder(sender) new MessageFutureCallback.Builder(sender)
.exceptionConverter(exceptionConverter) .exceptionConverter(exceptionConverter)
.onFailure(format(failure)) .onFailure(format(failure))
.build()); .build(),
ForkJoinPool.commonPool());
return this; return this;
} }

Datei anzeigen

@ -30,6 +30,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.net.URL; import java.net.URL;
import java.util.concurrent.ForkJoinPool;
public class ActorCallbackPaste { public class ActorCallbackPaste {
@ -65,7 +66,7 @@ public class ActorCallbackPaste {
LOGGER.warn("Failed to submit pastebin", throwable); LOGGER.warn("Failed to submit pastebin", throwable);
sender.printError("Failed to submit to a pastebin. Please see console for the error."); sender.printError("Failed to submit to a pastebin. Please see console for the error.");
} }
}); }, ForkJoinPool.commonPool());
} }
} }