Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-20 01:40:06 +01:00
Added a tonne more translations
Dieser Commit ist enthalten in:
Ursprung
4ba54c4337
Commit
fc0fee39cb
@ -32,6 +32,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats;
|
||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader;
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
@ -237,13 +238,13 @@ public class CLIWorldEdit {
|
|||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
String line = scanner.nextLine();
|
String line = scanner.nextLine();
|
||||||
if (line.equals("stop")) {
|
if (line.equals("stop")) {
|
||||||
commandSender.print("Stopping!");
|
commandSender.printInfo(TextComponent.of("Stopping!"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CommandEvent event = new CommandEvent(commandSender, line);
|
CommandEvent event = new CommandEvent(commandSender, line);
|
||||||
WorldEdit.getInstance().getEventBus().post(event);
|
WorldEdit.getInstance().getEventBus().post(event);
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
commandSender.printError("Unknown command!");
|
commandSender.printError(TextComponent.of("Unknown command!"));
|
||||||
} else {
|
} else {
|
||||||
saveAllWorlds(false);
|
saveAllWorlds(false);
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ import com.sk89q.worldedit.util.Location;
|
|||||||
import com.sk89q.worldedit.util.concurrency.EvenMoreExecutors;
|
import com.sk89q.worldedit.util.concurrency.EvenMoreExecutors;
|
||||||
import com.sk89q.worldedit.util.eventbus.EventBus;
|
import com.sk89q.worldedit.util.eventbus.EventBus;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException;
|
import com.sk89q.worldedit.util.io.file.FileSelectionAbortedException;
|
||||||
import com.sk89q.worldedit.util.io.file.FilenameException;
|
import com.sk89q.worldedit.util.io.file.FilenameException;
|
||||||
import com.sk89q.worldedit.util.io.file.FilenameResolutionException;
|
import com.sk89q.worldedit.util.io.file.FilenameResolutionException;
|
||||||
@ -634,7 +636,7 @@ public final class WorldEdit {
|
|||||||
* @param player the player
|
* @param player the player
|
||||||
* @param f the script file to execute
|
* @param f the script file to execute
|
||||||
* @param args arguments for the script
|
* @param args arguments for the script
|
||||||
* @throws WorldEditException
|
* @throws WorldEditException if something goes wrong
|
||||||
*/
|
*/
|
||||||
public void 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();
|
||||||
@ -642,7 +644,7 @@ public final class WorldEdit {
|
|||||||
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(TranslatableComponent.of("worldedit.script.unsupported"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,7 +657,7 @@ public final class WorldEdit {
|
|||||||
file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename);
|
file = WorldEdit.class.getResourceAsStream("craftscripts/" + filename);
|
||||||
|
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
player.printError("Script does not exist: " + filename);
|
player.printError(TranslatableComponent.of("worldedit.script.file-not-found", TextComponent.of(filename)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -668,7 +670,7 @@ public final class WorldEdit {
|
|||||||
in.close();
|
in.close();
|
||||||
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(TranslatableComponent.of("worldedit.script.read-error", TextComponent.of(e.getMessage())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -681,8 +683,7 @@ public final class WorldEdit {
|
|||||||
try {
|
try {
|
||||||
engine = new RhinoCraftScriptEngine();
|
engine = new RhinoCraftScriptEngine();
|
||||||
} catch (NoClassDefFoundError ignored) {
|
} catch (NoClassDefFoundError ignored) {
|
||||||
player.printError("Failed to find an installed script engine.");
|
player.printError(TranslatableComponent.of("worldedit.script.no-script-engine"));
|
||||||
player.printError("Please see https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,14 +697,13 @@ public final class WorldEdit {
|
|||||||
try {
|
try {
|
||||||
engine.evaluate(script, filename, vars);
|
engine.evaluate(script, filename, vars);
|
||||||
} catch (ScriptException e) {
|
} catch (ScriptException e) {
|
||||||
player.printError("Failed to execute:");
|
player.printError(TranslatableComponent.of("worldedit.script.failed", TextComponent.of(e.getMessage(), TextColor.WHITE)));
|
||||||
player.print(TextComponent.of(e.getMessage()));
|
|
||||||
logger.warn("Failed to execute script", e);
|
logger.warn("Failed to execute script", e);
|
||||||
} catch (NumberFormatException | WorldEditException e) {
|
} catch (NumberFormatException | WorldEditException e) {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
player.printError("Failed to execute (see console):");
|
player.printError(TranslatableComponent.of("worldedit.script.failed-console", TextComponent.of(e.getClass().getCanonicalName(),
|
||||||
player.print(TextComponent.of(e.getClass().getCanonicalName()));
|
TextColor.WHITE)));
|
||||||
logger.warn("Failed to execute script", e);
|
logger.warn("Failed to execute script", e);
|
||||||
} finally {
|
} finally {
|
||||||
for (EditSession editSession : scriptContext.getEditSessions()) {
|
for (EditSession editSession : scriptContext.getEditSessions()) {
|
||||||
|
@ -38,6 +38,7 @@ import com.sk89q.worldedit.util.Location;
|
|||||||
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||||
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 com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
|
||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
@ -85,9 +86,9 @@ public class ChunkCommands {
|
|||||||
int chunkZ = (int) Math.floor(pos.getBlockZ() / 16.0);
|
int chunkZ = (int) Math.floor(pos.getBlockZ() / 16.0);
|
||||||
|
|
||||||
final BlockVector2 chunkPos = BlockVector2.at(chunkX, chunkZ);
|
final BlockVector2 chunkPos = BlockVector2.at(chunkX, chunkZ);
|
||||||
player.print("Chunk: " + chunkX + ", " + chunkZ);
|
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.chunk", TextComponent.of(chunkX), TextComponent.of(chunkZ)));
|
||||||
player.print("Old format: " + LegacyChunkStore.getFilename(chunkPos));
|
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.old-filename", TextComponent.of(LegacyChunkStore.getFilename(chunkPos))));
|
||||||
player.print("McRegion: region/" + McRegionChunkStore.getFilename(chunkPos));
|
player.printInfo(TranslatableComponent.of("worldedit.chunkinfo.mcregion-filename", TextComponent.of(McRegionChunkStore.getFilename(chunkPos))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -101,7 +102,7 @@ public class ChunkCommands {
|
|||||||
|
|
||||||
WorldEditAsyncCommandBuilder.createAndSendMessage(actor,
|
WorldEditAsyncCommandBuilder.createAndSendMessage(actor,
|
||||||
() -> new ChunkListPaginationBox(region).create(page),
|
() -> new ChunkListPaginationBox(region).create(page),
|
||||||
"Listing chunks for " + actor.getName());
|
TranslatableComponent.of("worldedit.listchunks.listfor", TextComponent.of(actor.getName())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
|
@ -289,7 +289,7 @@ public class GeneralCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, new ItemSearcher(search, blocksOnly, itemsOnly, page),
|
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, new ItemSearcher(search, blocksOnly, itemsOnly, page),
|
||||||
"(Please wait... searching items.)");
|
TranslatableComponent.of("worldedit.searchitem.searching"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ItemSearcher implements Callable<Component> {
|
private static class ItemSearcher implements Callable<Component> {
|
||||||
|
@ -129,7 +129,7 @@ public class SchematicCommands {
|
|||||||
SchematicLoadTask task = new SchematicLoadTask(actor, f, format);
|
SchematicLoadTask task = new SchematicLoadTask(actor, f, format);
|
||||||
AsyncCommandBuilder.wrap(task, actor)
|
AsyncCommandBuilder.wrap(task, actor)
|
||||||
.registerWithSupervisor(worldEdit.getSupervisor(), "Loading schematic " + filename)
|
.registerWithSupervisor(worldEdit.getSupervisor(), "Loading schematic " + filename)
|
||||||
.sendMessageAfterDelay("(Please wait... loading schematic.)")
|
.sendMessageAfterDelay(TranslatableComponent.of("worldedit.schematic.load.loading"))
|
||||||
.onSuccess(TextComponent.of(filename, TextColor.GOLD)
|
.onSuccess(TextComponent.of(filename, TextColor.GOLD)
|
||||||
.append(TextComponent.of(" loaded. Paste it with ", TextColor.LIGHT_PURPLE))
|
.append(TextComponent.of(" loaded. Paste it with ", TextColor.LIGHT_PURPLE))
|
||||||
.append(CodeFormat.wrap("//paste").clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, "//paste"))),
|
.append(CodeFormat.wrap("//paste").clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, "//paste"))),
|
||||||
@ -188,7 +188,7 @@ public class SchematicCommands {
|
|||||||
SchematicSaveTask task = new SchematicSaveTask(actor, f, format, holder, overwrite);
|
SchematicSaveTask task = new SchematicSaveTask(actor, f, format, holder, overwrite);
|
||||||
AsyncCommandBuilder.wrap(task, actor)
|
AsyncCommandBuilder.wrap(task, actor)
|
||||||
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
|
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
|
||||||
.sendMessageAfterDelay("(Please wait... saving schematic.)")
|
.sendMessageAfterDelay(TranslatableComponent.of("worldedit.schematic.save.saving"))
|
||||||
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null)
|
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null)
|
||||||
.onFailure("Failed to load schematic", worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
.onFailure("Failed to load schematic", worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
||||||
.buildAndExec(worldEdit.getExecutorService());
|
.buildAndExec(worldEdit.getExecutorService());
|
||||||
|
@ -26,6 +26,7 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
|
|||||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import com.sk89q.worldedit.command.util.Logging;
|
import com.sk89q.worldedit.command.util.Logging;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
import org.enginehub.piston.annotation.Command;
|
import org.enginehub.piston.annotation.Command;
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import org.enginehub.piston.annotation.param.Arg;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
@ -67,7 +68,7 @@ public class ScriptingCommands {
|
|||||||
@Arg(desc = "Arguments to the CraftScript", def = "", variable = true)
|
@Arg(desc = "Arguments to the CraftScript", def = "", variable = true)
|
||||||
List<String> args) throws WorldEditException {
|
List<String> args) throws WorldEditException {
|
||||||
if (!player.hasPermission("worldedit.scripting.execute." + filename)) {
|
if (!player.hasPermission("worldedit.scripting.execute." + filename)) {
|
||||||
player.printError("You don't have permission to use that script.");
|
player.printError(TranslatableComponent.of("worldedit.execute.script-permissions"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,12 +94,12 @@ public class ScriptingCommands {
|
|||||||
String lastScript = session.getLastScript();
|
String lastScript = session.getLastScript();
|
||||||
|
|
||||||
if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) {
|
if (!player.hasPermission("worldedit.scripting.execute." + lastScript)) {
|
||||||
player.printError("You don't have permission to use that script.");
|
player.printError(TranslatableComponent.of("worldedit.execute.script-permissions"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastScript == null) {
|
if (lastScript == null) {
|
||||||
player.printError("Use /cs with a script name first.");
|
player.printError(TranslatableComponent.of("worldedit.executelast.no-script"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ public class SnapshotCommands {
|
|||||||
if (!snapshots.isEmpty()) {
|
if (!snapshots.isEmpty()) {
|
||||||
actor.print(new SnapshotListBox(world.getName(), snapshots).create(page));
|
actor.print(new SnapshotListBox(world.getName(), snapshots).create(page));
|
||||||
} else {
|
} else {
|
||||||
actor.printError("No snapshots are available. See console for details.");
|
actor.printError(TranslatableComponent.of("worldedit.restore.none-found-console"));
|
||||||
|
|
||||||
// Okay, let's toss some debugging information!
|
// Okay, let's toss some debugging information!
|
||||||
File dir = config.snapshotRepo.getDirectory();
|
File dir = config.snapshotRepo.getDirectory();
|
||||||
@ -138,9 +138,9 @@ public class SnapshotCommands {
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
session.setSnapshot(config.snapshotRepo.getSnapshot(name));
|
session.setSnapshot(config.snapshotRepo.getSnapshot(name));
|
||||||
actor.print("Snapshot set to: " + name);
|
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(name)));
|
||||||
} catch (InvalidSnapshotException e) {
|
} catch (InvalidSnapshotException e) {
|
||||||
actor.printError("That snapshot does not exist or is not available.");
|
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,23 +161,23 @@ public class SnapshotCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (index < 1) {
|
if (index < 1) {
|
||||||
actor.printError("Invalid index, must be equal or higher then 1.");
|
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-above-0"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, world.getName());
|
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, world.getName());
|
||||||
if (snapshots.size() < index) {
|
if (snapshots.size() < index) {
|
||||||
actor.printError("Invalid index, must be between 1 and " + snapshots.size() + ".");
|
actor.printError(TranslatableComponent.of("worldedit.snapshot.index-oob", TextComponent.of(snapshots.size())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Snapshot snapshot = snapshots.get(index - 1);
|
Snapshot snapshot = snapshots.get(index - 1);
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
actor.printError("That snapshot does not exist or is not available.");
|
actor.printError(TranslatableComponent.of("worldedit.restore.not-available"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
session.setSnapshot(snapshot);
|
session.setSnapshot(snapshot);
|
||||||
actor.print("Snapshot set to: " + snapshot.getName());
|
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
|
||||||
} catch (MissingWorldException e) {
|
} catch (MissingWorldException e) {
|
||||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||||
}
|
}
|
||||||
@ -203,11 +203,13 @@ public class SnapshotCommands {
|
|||||||
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, world.getName());
|
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, world.getName());
|
||||||
|
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
actor.printError("Couldn't find a snapshot before "
|
actor.printError(TranslatableComponent.of(
|
||||||
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
"worldedit.snapshot.none-before",
|
||||||
|
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
session.setSnapshot(snapshot);
|
session.setSnapshot(snapshot);
|
||||||
actor.print("Snapshot set to: " + snapshot.getName());
|
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
|
||||||
}
|
}
|
||||||
} catch (MissingWorldException ex) {
|
} catch (MissingWorldException ex) {
|
||||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||||
@ -233,11 +235,13 @@ public class SnapshotCommands {
|
|||||||
try {
|
try {
|
||||||
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, world.getName());
|
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, world.getName());
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
actor.printError("Couldn't find a snapshot after "
|
actor.printError(TranslatableComponent.of(
|
||||||
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
"worldedit.snapshot.none-after",
|
||||||
|
TextComponent.of(dateFormat.withZone(session.getTimeZone()).format(date)))
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
session.setSnapshot(snapshot);
|
session.setSnapshot(snapshot);
|
||||||
actor.print("Snapshot set to: " + snapshot.getName());
|
actor.printInfo(TranslatableComponent.of("worldedit.snapshot.use", TextComponent.of(snapshot.getName())));
|
||||||
}
|
}
|
||||||
} catch (MissingWorldException ex) {
|
} catch (MissingWorldException ex) {
|
||||||
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
actor.printError(TranslatableComponent.of("worldedit.restore.none-for-world"));
|
||||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.command.util;
|
|||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
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 javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@ -33,13 +34,18 @@ public final class WorldEditAsyncCommandBuilder {
|
|||||||
private WorldEditAsyncCommandBuilder() {
|
private WorldEditAsyncCommandBuilder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static void createAndSendMessage(Actor actor, Callable<Component> task, @Nullable String desc) {
|
public static void createAndSendMessage(Actor actor, Callable<Component> task, @Nullable String desc) {
|
||||||
|
createAndSendMessage(actor, task, desc != null ? TextComponent.of(desc) : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void createAndSendMessage(Actor actor, Callable<Component> task, @Nullable Component desc) {
|
||||||
final AsyncCommandBuilder<Component> builder = AsyncCommandBuilder.wrap(task, actor);
|
final AsyncCommandBuilder<Component> builder = AsyncCommandBuilder.wrap(task, actor);
|
||||||
if (desc != null) {
|
if (desc != null) {
|
||||||
builder.sendMessageAfterDelay(desc);
|
builder.sendMessageAfterDelay(desc);
|
||||||
}
|
}
|
||||||
builder
|
builder
|
||||||
.onSuccess((String) null, actor::print)
|
.onSuccess((String) null, actor::printInfo)
|
||||||
.onFailure((String) null, WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
.onFailure((String) null, WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
||||||
.buildAndExec(WorldEdit.getInstance().getExecutorService());
|
.buildAndExec(WorldEdit.getInstance().getExecutorService());
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import com.sk89q.worldedit.util.HandSide;
|
|||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.util.TargetBlock;
|
import com.sk89q.worldedit.util.TargetBlock;
|
||||||
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
import com.sk89q.worldedit.util.auth.AuthorizationException;
|
||||||
|
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||||
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;
|
||||||
@ -490,13 +491,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File openFileOpenDialog(String[] extensions) {
|
public File openFileOpenDialog(String[] extensions) {
|
||||||
printError("File dialogs are not supported in your environment.");
|
printError(TranslatableComponent.of("worldedit.platform.no-file-dialog"));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File openFileSaveDialog(String[] extensions) {
|
public File openFileSaveDialog(String[] extensions) {
|
||||||
printError("File dialogs are not supported in your environment.");
|
printError(TranslatableComponent.of("worldedit.platform.no-file-dialog"));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,7 +546,6 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("CloneDoesntCallSuperClone")
|
|
||||||
@Override
|
@Override
|
||||||
public Object clone() throws CloneNotSupportedException {
|
public Object clone() throws CloneNotSupportedException {
|
||||||
throw new CloneNotSupportedException("Not supported");
|
throw new CloneNotSupportedException("Not supported");
|
||||||
|
@ -497,7 +497,7 @@ public final class PlatformCommandManager {
|
|||||||
}
|
}
|
||||||
} catch (ConditionFailedException e) {
|
} catch (ConditionFailedException e) {
|
||||||
if (e.getCondition() instanceof PermissionCondition) {
|
if (e.getCondition() instanceof PermissionCondition) {
|
||||||
actor.printError("You are not permitted to do that. Are you in the right mode?");
|
actor.printError(TranslatableComponent.of("worldedit.command.permissions"));
|
||||||
} else {
|
} else {
|
||||||
actor.print(e.getRichMessage());
|
actor.print(e.getRichMessage());
|
||||||
}
|
}
|
||||||
@ -559,7 +559,7 @@ public final class PlatformCommandManager {
|
|||||||
store.injectValue(Key.of(Player.class), ValueProvider.constant((Player) actor));
|
store.injectValue(Key.of(Player.class), ValueProvider.constant((Player) actor));
|
||||||
} else {
|
} else {
|
||||||
store.injectValue(Key.of(Player.class), context -> {
|
store.injectValue(Key.of(Player.class), context -> {
|
||||||
throw new CommandException(TextComponent.of("This command must be used with a player."), ImmutableList.of());
|
throw new CommandException(TranslatableComponent.of("worldedit.command.player-only"), ImmutableList.of());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
store.injectValue(Key.of(Arguments.class), ValueProvider.constant(arguments));
|
store.injectValue(Key.of(Arguments.class), ValueProvider.constant(arguments));
|
||||||
@ -576,7 +576,7 @@ public final class PlatformCommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleUnknownException(Actor actor, Throwable t) {
|
private void handleUnknownException(Actor actor, Throwable t) {
|
||||||
actor.printError("Please report this error: [See console]");
|
actor.printError(TranslatableComponent.of("worldedit.command.error.report"));
|
||||||
actor.print(TextComponent.of(t.getClass().getName() + ": " + t.getMessage()));
|
actor.print(TextComponent.of(t.getClass().getName() + ": " + t.getMessage()));
|
||||||
log.error("An unexpected error while handling a WorldEdit command", t);
|
log.error("An unexpected error while handling a WorldEdit command", t);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
"worldedit.toggleplace.player": "Now placing at the block you stand in.",
|
"worldedit.toggleplace.player": "Now placing at the block you stand in.",
|
||||||
"worldedit.searchitem.too-short": "Enter a longer search string (len > 2).",
|
"worldedit.searchitem.too-short": "Enter a longer search string (len > 2).",
|
||||||
"worldedit.searchitem.b-and-i": "You cannot use both the 'b' and 'i' flags simultaneously.",
|
"worldedit.searchitem.b-and-i": "You cannot use both the 'b' and 'i' flags simultaneously.",
|
||||||
|
"worldedit.searchitem.searching": "(Please wait... searching items.)",
|
||||||
"worldedit.watchdog.no-hook": "This platform has no watchdog hook.",
|
"worldedit.watchdog.no-hook": "This platform has no watchdog hook.",
|
||||||
"worldedit.watchdog.active.already": "Watchdog hook already active.",
|
"worldedit.watchdog.active.already": "Watchdog hook already active.",
|
||||||
"worldedit.watchdog.inactive.already": "Watchdog hook already inactive.",
|
"worldedit.watchdog.inactive.already": "Watchdog hook already inactive.",
|
||||||
@ -83,11 +84,18 @@
|
|||||||
"worldedit.restore.block-place-error": "Last error: {0}",
|
"worldedit.restore.block-place-error": "Last error: {0}",
|
||||||
|
|
||||||
"worldedit.snapshot.use.newest": "Now using newest snapshot.",
|
"worldedit.snapshot.use.newest": "Now using newest snapshot.",
|
||||||
|
"worldedit.snapshot.use": "Snapshot set to: {0}",
|
||||||
|
"worldedit.snapshot.none-before": "Couldn't find a snapshot before {0}.",
|
||||||
|
"worldedit.snapshot.none-after": "Couldn't find a snapshot after {0}.",
|
||||||
|
"worldedit.snapshot.index-above-0": "Invalid index, must be equal or higher then 1.",
|
||||||
|
"worldedit.snapshot.index-oob": "Invalid index, must be between 1 and {0}.",
|
||||||
|
|
||||||
"worldedit.schematic.unknown-format": "Unknown schematic format: {0}.",
|
"worldedit.schematic.unknown-format": "Unknown schematic format: {0}.",
|
||||||
"worldedit.schematic.load.does-not-exist": "Schematic {0} does not exist!",
|
"worldedit.schematic.load.does-not-exist": "Schematic {0} does not exist!",
|
||||||
|
"worldedit.schematic.load.loading": "(Please wait... loading schematic.)",
|
||||||
"worldedit.schematic.save.already-exists": "That schematic already exists. Use the -f flag to overwrite it.",
|
"worldedit.schematic.save.already-exists": "That schematic already exists. Use the -f flag to overwrite it.",
|
||||||
"worldedit.schematic.save.failed-directory": "Could not create folder for schematics!",
|
"worldedit.schematic.save.failed-directory": "Could not create folder for schematics!",
|
||||||
|
"worldedit.schematic.save.saving": "(Please wait... saving schematic.)",
|
||||||
"worldedit.schematic.delete.does-not-exist": "Schematic {0} does not exist!",
|
"worldedit.schematic.delete.does-not-exist": "Schematic {0} does not exist!",
|
||||||
"worldedit.schematic.delete.failed": "Deletion of {0} failed! Is it read-only?",
|
"worldedit.schematic.delete.failed": "Deletion of {0} failed! Is it read-only?",
|
||||||
"worldedit.schematic.delete.deleted": "{0} has been deleted.",
|
"worldedit.schematic.delete.deleted": "{0} has been deleted.",
|
||||||
@ -134,6 +142,11 @@
|
|||||||
"worldedit.select.convex.description": "Select a convex polyhedral",
|
"worldedit.select.convex.description": "Select a convex polyhedral",
|
||||||
"worldedit.select.default-set": "Your default region selector is now {0}.",
|
"worldedit.select.default-set": "Your default region selector is now {0}.",
|
||||||
|
|
||||||
|
"worldedit.chunkinfo.chunk": "Chunk: {0}, {1}",
|
||||||
|
"worldedit.chunkinfo.old-filename": "Old format: {0}",
|
||||||
|
"worldedit.chunkinfo.mcregion-filename": "McRegion: region/{0}",
|
||||||
|
"worldedit.listchunks.listfor": "Listing chunks for: {0}",
|
||||||
|
|
||||||
"worldedit.drain.drained": "{0} blocks have been drained.",
|
"worldedit.drain.drained": "{0} blocks have been drained.",
|
||||||
"worldedit.fill.created": "{0} blocks have been filled.",
|
"worldedit.fill.created": "{0} blocks have been filled.",
|
||||||
"worldedit.fillr.created": "{0} blocks have been filled.",
|
"worldedit.fillr.created": "{0} blocks have been filled.",
|
||||||
@ -215,8 +228,12 @@
|
|||||||
"worldedit.version.version": "WorldEdit version {0}",
|
"worldedit.version.version": "WorldEdit version {0}",
|
||||||
|
|
||||||
"worldedit.command.time-elapsed": "{0}s elapsed (history: {1} changed; {2} blocks/sec).",
|
"worldedit.command.time-elapsed": "{0}s elapsed (history: {1} changed; {2} blocks/sec).",
|
||||||
|
"worldedit.command.permissions": "You are not permitted to do that. Are you in the right mode?",
|
||||||
|
"worldedit.command.player-only": "This command must be used with a player.",
|
||||||
|
"worldedit.command.error.report": "Please report this error: [See console]",
|
||||||
"worldedit.pastebin.uploading": "(Please wait... sending output to pastebin...)",
|
"worldedit.pastebin.uploading": "(Please wait... sending output to pastebin...)",
|
||||||
"worldedit.session.cant-find-session": "Unable to find session for {0}",
|
"worldedit.session.cant-find-session": "Unable to find session for {0}",
|
||||||
|
"worldedit.platform.no-file-dialog": "File dialogs are not supported in your environment.",
|
||||||
|
|
||||||
"worldedit.tool.max-block-changes": "Max blocks change limit reached.",
|
"worldedit.tool.max-block-changes": "Max blocks change limit reached.",
|
||||||
"worldedit.tool.no-block": "No block in sight!",
|
"worldedit.tool.no-block": "No block in sight!",
|
||||||
@ -260,6 +277,15 @@
|
|||||||
"worldedit.tool.tracemask.set": "Trace mask set.",
|
"worldedit.tool.tracemask.set": "Trace mask set.",
|
||||||
"worldedit.tool.tracemask.disabled": "Trace mask disabled.",
|
"worldedit.tool.tracemask.disabled": "Trace mask disabled.",
|
||||||
|
|
||||||
|
"worldedit.execute.script-permissions": "You don't have permission to use that script.",
|
||||||
|
"worldedit.executelast.no-script": "Use /cs with a script name first.",
|
||||||
|
"worldedit.script.read-error": "Script read error: {0}",
|
||||||
|
"worldedit.script.unsupported": "Only .js scripts are currently supported",
|
||||||
|
"worldedit.script.file-not-found": "Script does not exist: {0}",
|
||||||
|
"worldedit.script.no-script-engine": "Failed to find an installed script engine.\nPlease see https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/",
|
||||||
|
"worldedit.script.failed": "Failed to execute: {0}",
|
||||||
|
"worldedit.script.failed-console": "Failed to execute (see console): {0}",
|
||||||
|
|
||||||
"worldedit.operation.affected.biome": "{0} biomes affected",
|
"worldedit.operation.affected.biome": "{0} biomes affected",
|
||||||
"worldedit.operation.affected.block": "{0} blocks affected",
|
"worldedit.operation.affected.block": "{0} blocks affected",
|
||||||
"worldedit.operation.affected.column": "{0} columns affected",
|
"worldedit.operation.affected.column": "{0} columns affected",
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren