Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 16:12:51 +02:00
Fine tuning captions
Fix listchunks throwing component error
Dieser Commit ist enthalten in:
Ursprung
dc51379e8f
Commit
01dff32597
@ -329,7 +329,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
@Override
|
||||
public void sendAnnouncements() {
|
||||
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() == null) {
|
||||
printError(TranslatableComponent.of("worldedit.version.bukkit.unsupported-adapter",
|
||||
print(Caption.of("worldedit.version.bukkit.unsupported-adapter",
|
||||
TextComponent.of("https://intellectualsites.github.io/download/fawe.html", TextColor.AQUA)
|
||||
.clickEvent(ClickEvent.openUrl("https://intellectualsites.github.io/download/fawe.html"))));
|
||||
}
|
||||
|
@ -772,14 +772,13 @@ public final class WorldEdit {
|
||||
} catch (ScriptException e) {
|
||||
// non-exceptional return check
|
||||
if (!(Throwables.getRootCause(e) instanceof ReturnException)) {
|
||||
player.print(Caption.of("worldedit.script.failed", TextComponent.of(e.getMessage(), TextColor.WHITE)));
|
||||
player.print(Caption.of("worldedit.script.failed", TextComponent.of(e.getMessage())));
|
||||
logger.warn("Failed to execute script", e);
|
||||
}
|
||||
} catch (NumberFormatException | WorldEditException e) {
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
player.print(Caption.of("worldedit.script.failed-console", TextComponent.of(e.getClass().getCanonicalName(),
|
||||
TextColor.WHITE)));
|
||||
player.print(Caption.of("worldedit.script.failed-console", TextComponent.of(e.getClass().getCanonicalName())));
|
||||
logger.warn("Failed to execute script", e);
|
||||
} finally {
|
||||
for (EditSession editSession : scriptContext.getEditSessions()) {
|
||||
|
@ -125,7 +125,7 @@ public class ApplyBrushCommands {
|
||||
@Arg(desc = "The direction in which the item will be applied", def = "up")
|
||||
@Direction(includeDiagonals = true)
|
||||
com.sk89q.worldedit.util.Direction direction) throws WorldEditException {
|
||||
player.print(TextComponent.builder().append("WARNING: ", TextColor.RED, TextDecoration.BOLD)
|
||||
player.print(TextComponent.builder().append("WARNING: ")
|
||||
.append(Caption.of("worldedit.brush.apply.item.warning")).build());
|
||||
setApplyBrush(parameters, player, localSession, new ItemUseFactory(item, direction));
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class BrushCommands {
|
||||
|
||||
private final WorldEdit worldEdit;
|
||||
|
||||
private static final Component UNBIND_COMMAND_COMPONENT = TextComponent.builder("/brush unbind", TextColor.AQUA)
|
||||
private static final Component UNBIND_COMMAND_COMPONENT = TextComponent.builder("/brush unbind")
|
||||
.clickEvent(ClickEvent.suggestCommand("/brush unbind"))
|
||||
.build();
|
||||
|
||||
|
@ -102,8 +102,8 @@ public class ChunkCommands {
|
||||
@ArgFlag(name = 'p', desc = "Page number.", def = "1") int page) throws WorldEditException {
|
||||
final Region region = session.getSelection(world);
|
||||
|
||||
actor.print(Caption.of("worldedit.listchunks.listfor", TextComponent.of(actor.getName())));
|
||||
actor.print(new ChunkListPaginationBox(region).create(page));
|
||||
actor.print(Caption.of("worldedit.listchunks.listfor", TextComponent.of(actor.getName())));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -177,10 +177,11 @@ public class ChunkCommands {
|
||||
|
||||
private static class ChunkListPaginationBox extends PaginationBox {
|
||||
//private final Region region;
|
||||
private final List<BlockVector2> chunks = null;
|
||||
private final List<BlockVector2> chunks;
|
||||
|
||||
ChunkListPaginationBox(Region region) {
|
||||
super("Selected Chunks", "/listchunks -p %page%");
|
||||
this.chunks = new ArrayList<>(region.getChunks());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,7 +111,7 @@ public class ExpandCommands {
|
||||
long newSize = region.getVolume();
|
||||
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||
long changeSize = newSize - oldSize;
|
||||
actor.printInfo(
|
||||
actor.print(
|
||||
Caption.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize))
|
||||
);
|
||||
} catch (RegionOperationException e) {
|
||||
|
@ -178,11 +178,11 @@ public class GeneralCommands {
|
||||
}
|
||||
|
||||
session.setBlockChangeLimit(limit);
|
||||
Component component = TextComponent.empty().append(TranslatableComponent.of("worldedit.limit.set", TextComponent.of(limit)));
|
||||
Component component = TextComponent.empty().append(Caption.of("worldedit.limit.set", TextComponent.of(limit)));
|
||||
if (limit != config.defaultChangeLimit) {
|
||||
component.append(TextComponent.space()).append(TranslatableComponent.of("worldedit.limit.return-to-default", TextColor.GRAY));
|
||||
component.append(TextComponent.space()).append(Caption.of("worldedit.limit.return-to-default"));
|
||||
}
|
||||
actor.printInfo(component);
|
||||
actor.print(component);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -205,11 +205,11 @@ public class GeneralCommands {
|
||||
}
|
||||
|
||||
session.setTimeout(limit);
|
||||
Component component = TextComponent.empty().append(TranslatableComponent.of("worldedit.timeout.set", TextComponent.of(limit)));
|
||||
Component component = TextComponent.empty().append(Caption.of("worldedit.timeout.set", TextComponent.of(limit)));
|
||||
if (limit != config.calculationTimeout) {
|
||||
component.append(TranslatableComponent.of("worldedit.timeout.return-to-default", TextColor.GRAY));
|
||||
component.append(TranslatableComponent.of("worldedit.timeout.return-to-default"));
|
||||
}
|
||||
actor.printInfo(component);
|
||||
actor.print(component);
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -439,7 +439,7 @@ public class GeneralCommands {
|
||||
}
|
||||
|
||||
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, new ItemSearcher(search, blocksOnly, itemsOnly, page),
|
||||
TranslatableComponent.of("worldedit.searchitem.searching"));
|
||||
Caption.of("worldedit.searchitem.searching"));
|
||||
}
|
||||
|
||||
private static class ItemSearcher implements Callable<Component> {
|
||||
|
@ -130,7 +130,7 @@ public class PaintBrushCommands {
|
||||
@Arg(desc = "The direction in which the item will be applied", def = "up")
|
||||
@Direction(includeDiagonals = true)
|
||||
com.sk89q.worldedit.util.Direction direction) throws WorldEditException {
|
||||
player.print(TextComponent.builder().append("WARNING: ", TextColor.RED, TextDecoration.BOLD)
|
||||
player.print(TextComponent.builder().append("WARNING: ")
|
||||
.append(TranslatableComponent.of("worldedit.brush.paint.item.warning")).build());
|
||||
setPaintBrush(parameters, player, localSession, new ItemUseFactory(item, direction));
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
public void setlighting(Player player, EditSession editSession, @Selection Region region) {
|
||||
player.print(TextComponent.of("Temporarily not working"));
|
||||
player.print(Caption.of("fawe.info.temporarily-not-working"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@ -221,7 +221,7 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
public void setskylighting(Player player, @Selection Region region) {
|
||||
player.printInfo(TextComponent.of("Temporarily not working"));
|
||||
player.print(Caption.of("fawe.info.temporarily-not-working"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -53,6 +53,7 @@ import com.sk89q.worldedit.util.formatting.component.PaginationBox;
|
||||
import com.sk89q.worldedit.util.formatting.component.TextComponentProducer;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
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.HoverEvent;
|
||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||
@ -94,7 +95,6 @@ import static com.boydti.fawe.util.ReflectionUtils.as;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
|
||||
/**
|
||||
* Commands that work with schematic files.
|
||||
*/
|
||||
@ -300,9 +300,9 @@ public class SchematicCommands {
|
||||
format.hold(actor, uri, in);
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", filename));
|
||||
} catch (IllegalArgumentException e) {
|
||||
actor.printError("Unknown filename: " + filename);
|
||||
actor.print(Caption.of("worldedit.schematic.unknown-filename", TextComponent.of(filename)));
|
||||
} catch (URISyntaxException | IOException e) {
|
||||
actor.printError("File could not be read or it does not exist: " + e.getMessage());
|
||||
actor.print(TranslatableComponent.of("worldedit.schematic.file-not-exist", TextComponent.of(e.getMessage())));
|
||||
LOGGER.warn("Failed to load a saved clipboard", e);
|
||||
} finally {
|
||||
if (in != null) {
|
||||
@ -316,7 +316,7 @@ public class SchematicCommands {
|
||||
|
||||
@Command(
|
||||
name = "save",
|
||||
desc = "Save a schematic into your clipboard"
|
||||
desc = "Save your clipboard into a schematic file"
|
||||
)
|
||||
@CommandPermissions({"worldedit.clipboard.save", "worldedit.schematic.save", "worldedit.schematic.save.other"})
|
||||
public void save(Actor actor, LocalSession session,
|
||||
@ -326,7 +326,7 @@ public class SchematicCommands {
|
||||
String formatName,
|
||||
@Switch(name = 'f', desc = "Overwrite an existing file.")
|
||||
boolean allowOverwrite,
|
||||
@Switch(name = 'g', desc = "//TODO")
|
||||
@Switch(name = 'g', desc = "Bypasses per-player-schematic folders")
|
||||
boolean global) throws WorldEditException {
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
|
||||
@ -360,7 +360,7 @@ public class SchematicCommands {
|
||||
boolean overwrite = f.exists();
|
||||
if (overwrite) {
|
||||
if (!actor.hasPermission("worldedit.schematic.delete")) {
|
||||
throw new StopExecutionException(TextComponent.of("That schematic already exists!"));
|
||||
throw new StopExecutionException(TranslatableComponent.of("worldedit.schematic.already-exists"));
|
||||
}
|
||||
if (other) {
|
||||
if (!actor.hasPermission("worldedit.schematic.delete.other")) {
|
||||
@ -390,7 +390,7 @@ public class SchematicCommands {
|
||||
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
|
||||
.sendMessageAfterDelay(Caption.of("worldedit.schematic.save.saving"))
|
||||
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null)
|
||||
.onFailure("Failed to save schematic", worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
||||
.onFailure(TranslatableComponent.of("worldedit.schematic.failed-to-save"), worldEdit.getPlatformManager().getPlatformCommandManager().getExceptionConverter())
|
||||
.buildAndExec(worldEdit.getExecutorService());
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ public class SchematicCommands {
|
||||
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working;
|
||||
File destDir = new File(dir, directory);
|
||||
if (!MainUtil.isInSubDirectory(working, destDir)) {
|
||||
player.printError("Directory " + destDir + " does not exist!");
|
||||
player.print(Caption.of("worldedit.schematic.directory-does-not-exist", TextComponent.of(String.valueOf(destDir))));
|
||||
return;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) {
|
||||
@ -420,7 +420,7 @@ public class SchematicCommands {
|
||||
return;
|
||||
}
|
||||
if (!destDir.exists() && !destDir.mkdirs()) {
|
||||
player.printError("Creation of " + destDir + " failed! (check file permissions)");
|
||||
player.print(Caption.of("worldedit.schematic.file-perm-fail", TextComponent.of(String.valueOf(destDir))));
|
||||
return;
|
||||
}
|
||||
for (File source : sources) {
|
||||
@ -483,7 +483,7 @@ public class SchematicCommands {
|
||||
first = false;
|
||||
}
|
||||
first = true;
|
||||
actor.printInfo(TextComponent.of(builder.toString()));
|
||||
actor.print(TextComponent.of(builder.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,7 +506,7 @@ public class SchematicCommands {
|
||||
@Arg(name = "filter", desc = "Filter for schematics", def = "all")
|
||||
String filter, Arguments arguments) throws WorldEditException {
|
||||
if (oldFirst && newFirst) {
|
||||
throw new StopExecutionException(TextComponent.of("Cannot sort by oldest and newest."));
|
||||
throw new StopExecutionException(Caption.of("worldedit.schematic.sorting-old-new"));
|
||||
}
|
||||
String pageCommand = "/" + arguments.get();
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
@ -536,50 +536,37 @@ public class SchematicCommands {
|
||||
|
||||
List<Component> components = UtilityCommands.entryToComponent(dir, entries, isLoaded,
|
||||
(name, path, type, loaded) -> {
|
||||
TextColor color = TextColor.GRAY;
|
||||
switch (type) {
|
||||
case URL:
|
||||
color = TextColor.DARK_GRAY;
|
||||
break;
|
||||
case FILE:
|
||||
color = TextColor.GREEN;
|
||||
break;
|
||||
case DIRECTORY:
|
||||
color = TextColor.GOLD;
|
||||
break;
|
||||
}
|
||||
|
||||
TextComponentProducer msg = new TextComponentProducer();
|
||||
|
||||
msg.append(TextComponent.of(" - ", color));
|
||||
msg.append(Caption.of("worldedit.schematic.dash.symbol"));
|
||||
|
||||
if (loaded) {
|
||||
msg.append(TextComponent.of("[-]", TextColor.RED)
|
||||
msg.append(Caption.of("worldedit.schematic.minus.symbol")
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, unload + " " + path))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Unload"))));
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.schematic.unload"))));
|
||||
} else {
|
||||
msg.append(TextComponent.of("[+]", TextColor.GREEN)
|
||||
msg.append(Caption.of("worldedit.schematic.plus.symbol")
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, loadMulti + " " + path))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Add to clipboard"))));
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.schematic.clipboard"))));
|
||||
}
|
||||
if (type != UtilityCommands.URIType.DIRECTORY) {
|
||||
msg.append(TextComponent.of("[X]", TextColor.DARK_RED)
|
||||
msg.append(Caption.of("worldedit.schematic.x.symbol")
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, delete + " " + path))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("delete")))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.schematic.delete")))
|
||||
);
|
||||
} else if (hasShow) {
|
||||
msg.append(TextComponent.of("[O]", TextColor.DARK_AQUA)
|
||||
msg.append(Caption.of("worldedit.schematic.0.symbol")
|
||||
.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, showCmd + " " + path))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("visualize")))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.schematic.visualize")))
|
||||
);
|
||||
}
|
||||
TextComponent msgElem = TextComponent.of(name, color);
|
||||
TextComponent msgElem = TextComponent.of(name);
|
||||
if (type != UtilityCommands.URIType.DIRECTORY) {
|
||||
msgElem = msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, loadSingle + " " + path));
|
||||
msgElem = msgElem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Load")));
|
||||
msgElem = msgElem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.schematic.load")));
|
||||
} else {
|
||||
msgElem = msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, list + " " + path));
|
||||
msgElem = msgElem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("List")));
|
||||
msgElem = msgElem.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, Caption.of("worldedit.schematic.list")));
|
||||
}
|
||||
msg.append(msgElem);
|
||||
|
||||
@ -929,7 +916,7 @@ public class SchematicCommands {
|
||||
private final File[] files;
|
||||
|
||||
SchematicPaginationBox(String rootDir, File[] files, String pageCommand) {
|
||||
super("Available schematics", pageCommand);
|
||||
super("worldedit.schematic.available", pageCommand);
|
||||
this.prefix = rootDir == null ? "" : rootDir;
|
||||
this.files = files;
|
||||
}
|
||||
@ -947,14 +934,12 @@ public class SchematicCommands {
|
||||
|
||||
return TextComponent.builder()
|
||||
.content("")
|
||||
.append(TextComponent.of("[L]")
|
||||
.color(TextColor.GOLD)
|
||||
.append(TranslatableComponent.of("worldedit.schematic.load.symbol")
|
||||
.clickEvent(ClickEvent
|
||||
.of(ClickEvent.Action.RUN_COMMAND, "/schem load \"" + path + "\""))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to load"))))
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TranslatableComponent.of("worldedit.schematic.click-to-load"))))
|
||||
.append(TextComponent.space())
|
||||
.append(TextComponent.of(path)
|
||||
.color(TextColor.DARK_GREEN)
|
||||
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(format))))
|
||||
.build();
|
||||
}
|
||||
|
@ -312,14 +312,14 @@ public class SelectionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.wand.toggle")
|
||||
public void toggleWand(Player player) {
|
||||
player.printInfo(
|
||||
player.print(
|
||||
Caption.of(
|
||||
"worldedit.wand.selwand.now.tool",
|
||||
TextComponent.of("/tool none", TextColor.AQUA).clickEvent(
|
||||
TextComponent.of("/tool none").clickEvent(
|
||||
ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/tool none")),
|
||||
TextComponent.of("/tool selwand", TextColor.AQUA).clickEvent(
|
||||
TextComponent.of("/tool selwand").clickEvent(
|
||||
ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "/tool selwand")),
|
||||
TextComponent.of("//wand", TextColor.AQUA).clickEvent(
|
||||
TextComponent.of("//wand").clickEvent(
|
||||
ClickEvent.of(ClickEvent.Action.RUN_COMMAND, "//wand"))
|
||||
)
|
||||
);
|
||||
@ -654,8 +654,8 @@ public class SelectionCommands {
|
||||
box.appendCommand("sphere", Caption.of("worldedit.select.sphere.description"), "//sel sphere");
|
||||
box.appendCommand("cyl", Caption.of("worldedit.select.cyl.description"), "//sel cyl");
|
||||
box.appendCommand("convex", Caption.of("worldedit.select.convex.description"), "//sel convex");
|
||||
box.appendCommand("polyhedral", "Select a hollow polyhedral", "//sel polyhedral");
|
||||
box.appendCommand("fuzzy[=<mask>]", "Select all connected blocks (magic wand)", "//sel fuzzy[=<mask>]");
|
||||
box.appendCommand("polyhedral", Caption.of("fawe.selection.sel.polyhedral"), "//sel polyhedral");
|
||||
box.appendCommand("fuzzy[=<mask>]", Caption.of("fawe.selection.sel.fuzzy-instruction"), "//sel fuzzy[=<mask>]");
|
||||
|
||||
actor.print(box.create(1));
|
||||
return;
|
||||
@ -718,13 +718,13 @@ public class SelectionCommands {
|
||||
|
||||
final BlockState state = c.getID();
|
||||
final BlockType blockType = state.getBlockType();
|
||||
Component blockName = blockType.getRichName().color(TextColor.LIGHT_PURPLE);
|
||||
Component blockName = blockType.getRichName();
|
||||
TextComponent toolTip;
|
||||
if (separateStates && state != blockType.getDefaultState()) {
|
||||
toolTip = TextComponent.of(state.getAsString(), TextColor.GRAY);
|
||||
blockName = blockName.append(TextComponent.of("*", TextColor.LIGHT_PURPLE));
|
||||
toolTip = TextComponent.of(state.getAsString());
|
||||
blockName = blockName.append(TextComponent.of("*"));
|
||||
} else {
|
||||
toolTip = TextComponent.of(blockType.getId(), TextColor.GRAY);
|
||||
toolTip = TextComponent.of(blockType.getId());
|
||||
}
|
||||
blockName = blockName.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, toolTip));
|
||||
line.append(blockName);
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.command.util;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
@ -29,6 +30,7 @@ import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.formatting.component.ErrorFormat;
|
||||
import com.sk89q.worldedit.util.formatting.text.Component;
|
||||
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.task.FutureForwardingTask;
|
||||
import com.sk89q.worldedit.util.task.Supervisor;
|
||||
@ -162,18 +164,18 @@ public final class AsyncCommandBuilder<T> {
|
||||
|
||||
if (message == null) {
|
||||
if (Strings.isNullOrEmpty(converted.getMessage())) {
|
||||
message = TextComponent.of("Unknown error.");
|
||||
message = TranslatableComponent.of("worldedit.error.unknown");
|
||||
} else {
|
||||
message = converted.getRichMessage();
|
||||
}
|
||||
}
|
||||
sender.printError(failure.append(TextComponent.of(": ")).append(message));
|
||||
sender.print(failure.append(TextComponent.of(": ")).append(message));
|
||||
}
|
||||
} else {
|
||||
throw orig;
|
||||
}
|
||||
} catch (Throwable unknown) {
|
||||
sender.printError(failure.append(TextComponent.of(": Unknown error. Please see console.")));
|
||||
sender.print(failure.append(Caption.of("worldedit.command.error.report")));
|
||||
LOGGER.error("Uncaught exception occurred in task: " + description, orig);
|
||||
}
|
||||
}
|
||||
|
@ -433,10 +433,10 @@ public interface Player extends Entity, Actor {
|
||||
} catch (Exception event) {
|
||||
printError(TextComponent.of("====== INVALID CLIPBOARD ======"));
|
||||
event.printStackTrace();
|
||||
printError(Caption.of("fawe.error.stacktrace"));
|
||||
printError(Caption.of("fawe.error.no-failure"));
|
||||
printError(Caption.of("File: ", TextComponent.of(file.getName()), TextComponent.of(" (len:"), TextComponent.of(file.length()), TextComponent.of(")")));
|
||||
printError(Caption.of("fawe.error.stacktrace"));
|
||||
print(Caption.of("fawe.error.stacktrace"));
|
||||
print(Caption.of("fawe.error.no-failure"));
|
||||
print(Caption.of("File: ", TextComponent.of(file.getName()), TextComponent.of(" (len:"), TextComponent.of(file.length()), TextComponent.of(")")));
|
||||
print(Caption.of("fawe.error.stacktrace"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -667,13 +667,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
|
||||
|
||||
@Override
|
||||
public File openFileOpenDialog(String[] extensions) {
|
||||
printError(Caption.of("worldedit.platform.no-file-dialog"));
|
||||
print(Caption.of("worldedit.platform.no-file-dialog"));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File openFileSaveDialog(String[] extensions) {
|
||||
printError(Caption.of("worldedit.platform.no-file-dialog"));
|
||||
print(Caption.of("worldedit.platform.no-file-dialog"));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.internal.command;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -26,9 +27,9 @@ 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 com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
|
||||
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.TextDecoration;
|
||||
import org.enginehub.piston.Command;
|
||||
import org.enginehub.piston.CommandParameters;
|
||||
import org.enginehub.piston.NoInputCommandParameters;
|
||||
@ -50,14 +51,13 @@ import static java.util.stream.Collectors.toList;
|
||||
|
||||
public class CommandUtil {
|
||||
|
||||
private static final Component DEPRECATION_MARKER = TextComponent.of("This command is deprecated.");
|
||||
private static final Component DEPRECATION_MARKER = Caption.of("worldedit.command.deprecation");
|
||||
|
||||
private static Component makeDeprecatedFooter(String reason, Component replacement) {
|
||||
return TextComponent.builder()
|
||||
.append(DEPRECATION_MARKER)
|
||||
.append(" " + reason + ".")
|
||||
.append(TextComponent.newline())
|
||||
.append(replacement.color(TextColor.GOLD).decoration(TextDecoration.ITALIC, true))
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -85,11 +85,9 @@ public class CommandUtil {
|
||||
}
|
||||
|
||||
public static Component createNewCommandReplacementText(String suggestedCommand) {
|
||||
return TextComponent.builder("Please use ", TextColor.GOLD)
|
||||
return TranslatableComponent.builder("worldedit.command.deprecation-message")
|
||||
.append(TextComponent.of(suggestedCommand)
|
||||
.decoration(TextDecoration.UNDERLINED, true)
|
||||
.clickEvent(ClickEvent.suggestCommand(suggestedCommand)))
|
||||
.append(" instead.")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
"fawe.info.worldedit.bypassed": "Currently bypassing FAWE restriction.",
|
||||
"fawe.info.worldedit.restricted": "Your FAWE edits are now restricted.",
|
||||
"fawe.info.worldedit.oom.admin": "Possible options:\n - //fast\n - Do smaller edits\n - Allocate more memory\n - Disable `max-memory-percent`",
|
||||
"fawe.info.temporarily-not-working": "Temporarily not working",
|
||||
|
||||
"fawe.web.generating.link": "Uploading {0}, please wait...",
|
||||
"fawe.web.generating.link.failed": "Failed to generate download link!",
|
||||
@ -153,7 +154,9 @@
|
||||
|
||||
"fawe.selection.sel.max": "{0} points maximum.",
|
||||
"fawe.selection.sel.fuzzy": "Fuzzy selector: Left click to select all contingent blocks, right click to add. To select an air cavity, use //pos1.",
|
||||
"fawe.selection.sel.fuzzy-instruction": "Select all connected blocks (magic wand)",
|
||||
"fawe.selection.sel.convex.polyhedral": "Convex polyhedral selector: Left click=First vertex, right click to add more.",
|
||||
"fawe.selection.sel.polyhedral": "Select a hollow polyhedral",
|
||||
"fawe.selection.sel.list": "For a list of selection types use: //sel list",
|
||||
|
||||
"fawe.tips.tip.sel.list": "Tip: See the different selection modes with //sel list",
|
||||
@ -345,6 +348,27 @@
|
||||
"worldedit.schematic.delete.failed": "Deletion of {0} failed! Is it read-only?",
|
||||
"worldedit.schematic.delete.deleted": "{0} has been deleted.",
|
||||
"worldedit.schematic.formats.title": "Available clipboard formats (Name: Lookup names)",
|
||||
"worldedit.schematic.load.symbol": "[L]",
|
||||
"worldedit.schematic.plus.symbol": "[+]",
|
||||
"worldedit.schematic.minus.symbol": "[-]",
|
||||
"worldedit.schematic.x.symbol": "[X]",
|
||||
"worldedit.schematic.0.symbol": "[O]",
|
||||
"worldedit.schematic.dash.symbol": " - ",
|
||||
"worldedit.schematic.click-to-load": "Click to load",
|
||||
"worldedit.schematic.load": "Load",
|
||||
"worldedit.schematic.list": "List",
|
||||
"worldedit.schematic.available": "Available schematics",
|
||||
"worldedit.schematic.unload": "Unload",
|
||||
"worldedit.schematic.delete": "delete",
|
||||
"worldedit.schematic.visualize": "visualize",
|
||||
"worldedit.schematic.clipboard": "Add to clipboard",
|
||||
"worldedit.schematic.unknown-filename": "Unknown filename: {0}",
|
||||
"worldedit.schematic.file-not-exist": "File could not be read or it does not exist: {0}",
|
||||
"worldedit.schematic.already-exists": "That schematic already exists!",
|
||||
"worldedit.schematic.failed-to-save": "Failed to save schematic",
|
||||
"worldedit.schematic.directory-does-not-exist": "Directory '{0}' does not exist!",
|
||||
"worldedit.schematic.file-perm-fail": "Creation of '{0}' failed! Check file permission.",
|
||||
"worldedit.schematic.sorting-old-new": "Cannot sort by oldest and newest.",
|
||||
|
||||
"worldedit.pos.already-set": "Position already set.",
|
||||
"worldedit.pos.console-require-coords": "You must provide coordinates as console.",
|
||||
@ -481,7 +505,9 @@
|
||||
"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.command.error.report": "&cPlease report this error: [See console]",
|
||||
"worldedit.command.deprecation": "This command is deprecated.",
|
||||
"worldedit.command.deprecation-message": "Please use '{0}' instead.",
|
||||
"worldedit.pastebin.uploading": "(Please wait... sending output to paste service...)",
|
||||
"worldedit.session.cant-find-session": "Unable to find session for {0}",
|
||||
"worldedit.platform.no-file-dialog": "File dialogs are not supported in your environment.",
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren