3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-09-16 04:51:22 +02:00

Fine tuning captions

Fix listchunks throwing component error
Dieser Commit ist enthalten in:
NotMyFault 2021-04-06 14:01:04 +02:00
Ursprung dc51379e8f
Commit 01dff32597
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 158F5701A6AAD00C
16 geänderte Dateien mit 97 neuen und 86 gelöschten Zeilen

Datei anzeigen

@ -329,7 +329,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override @Override
public void sendAnnouncements() { public void sendAnnouncements() {
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() == null) { 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) TextComponent.of("https://intellectualsites.github.io/download/fawe.html", TextColor.AQUA)
.clickEvent(ClickEvent.openUrl("https://intellectualsites.github.io/download/fawe.html")))); .clickEvent(ClickEvent.openUrl("https://intellectualsites.github.io/download/fawe.html"))));
} }

Datei anzeigen

@ -772,14 +772,13 @@ public final class WorldEdit {
} catch (ScriptException e) { } catch (ScriptException e) {
// non-exceptional return check // non-exceptional return check
if (!(Throwables.getRootCause(e) instanceof ReturnException)) { 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); 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.print(Caption.of("worldedit.script.failed-console", TextComponent.of(e.getClass().getCanonicalName(), player.print(Caption.of("worldedit.script.failed-console", 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()) {

Datei anzeigen

@ -125,7 +125,7 @@ public class ApplyBrushCommands {
@Arg(desc = "The direction in which the item will be applied", def = "up") @Arg(desc = "The direction in which the item will be applied", def = "up")
@Direction(includeDiagonals = true) @Direction(includeDiagonals = true)
com.sk89q.worldedit.util.Direction direction) throws WorldEditException { 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()); .append(Caption.of("worldedit.brush.apply.item.warning")).build());
setApplyBrush(parameters, player, localSession, new ItemUseFactory(item, direction)); setApplyBrush(parameters, player, localSession, new ItemUseFactory(item, direction));
} }

Datei anzeigen

@ -145,7 +145,7 @@ public class BrushCommands {
private final WorldEdit worldEdit; 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")) .clickEvent(ClickEvent.suggestCommand("/brush unbind"))
.build(); .build();

Datei anzeigen

@ -102,8 +102,8 @@ public class ChunkCommands {
@ArgFlag(name = 'p', desc = "Page number.", def = "1") int page) throws WorldEditException { @ArgFlag(name = 'p', desc = "Page number.", def = "1") int page) throws WorldEditException {
final Region region = session.getSelection(world); 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(new ChunkListPaginationBox(region).create(page));
actor.print(Caption.of("worldedit.listchunks.listfor", TextComponent.of(actor.getName())));
} }
@Command( @Command(
@ -177,10 +177,11 @@ public class ChunkCommands {
private static class ChunkListPaginationBox extends PaginationBox { private static class ChunkListPaginationBox extends PaginationBox {
//private final Region region; //private final Region region;
private final List<BlockVector2> chunks = null; private final List<BlockVector2> chunks;
ChunkListPaginationBox(Region region) { ChunkListPaginationBox(Region region) {
super("Selected Chunks", "/listchunks -p %page%"); super("Selected Chunks", "/listchunks -p %page%");
this.chunks = new ArrayList<>(region.getChunks());
} }
@Override @Override

Datei anzeigen

@ -111,7 +111,7 @@ public class ExpandCommands {
long newSize = region.getVolume(); long newSize = region.getVolume();
session.getRegionSelector(world).explainRegionAdjust(actor, session); session.getRegionSelector(world).explainRegionAdjust(actor, session);
long changeSize = newSize - oldSize; long changeSize = newSize - oldSize;
actor.printInfo( actor.print(
Caption.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize)) Caption.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize))
); );
} catch (RegionOperationException e) { } catch (RegionOperationException e) {

Datei anzeigen

@ -178,11 +178,11 @@ public class GeneralCommands {
} }
session.setBlockChangeLimit(limit); 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) { 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( @Command(
@ -205,11 +205,11 @@ public class GeneralCommands {
} }
session.setTimeout(limit); 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) { 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( @Command(
@ -439,7 +439,7 @@ public class GeneralCommands {
} }
WorldEditAsyncCommandBuilder.createAndSendMessage(actor, new ItemSearcher(search, blocksOnly, itemsOnly, page), 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> { private static class ItemSearcher implements Callable<Component> {

Datei anzeigen

@ -130,7 +130,7 @@ public class PaintBrushCommands {
@Arg(desc = "The direction in which the item will be applied", def = "up") @Arg(desc = "The direction in which the item will be applied", def = "up")
@Direction(includeDiagonals = true) @Direction(includeDiagonals = true)
com.sk89q.worldedit.util.Direction direction) throws WorldEditException { 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()); .append(TranslatableComponent.of("worldedit.brush.paint.item.warning")).build());
setPaintBrush(parameters, player, localSession, new ItemUseFactory(item, direction)); setPaintBrush(parameters, player, localSession, new ItemUseFactory(item, direction));
} }

Datei anzeigen

@ -212,7 +212,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.light.set") @CommandPermissions("worldedit.light.set")
public void setlighting(Player player, EditSession editSession, @Selection Region region) { 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( @Command(
@ -221,7 +221,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.light.set") @CommandPermissions("worldedit.light.set")
public void setskylighting(Player player, @Selection Region region) { 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( @Command(

Datei anzeigen

@ -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.component.TextComponentProducer;
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.event.HoverEvent; import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor; 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.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Commands that work with schematic files. * Commands that work with schematic files.
*/ */
@ -300,9 +300,9 @@ public class SchematicCommands {
format.hold(actor, uri, in); format.hold(actor, uri, in);
actor.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", filename)); actor.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", filename));
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
actor.printError("Unknown filename: " + filename); actor.print(Caption.of("worldedit.schematic.unknown-filename", TextComponent.of(filename)));
} catch (URISyntaxException | IOException e) { } 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); LOGGER.warn("Failed to load a saved clipboard", e);
} finally { } finally {
if (in != null) { if (in != null) {
@ -316,7 +316,7 @@ public class SchematicCommands {
@Command( @Command(
name = "save", 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"}) @CommandPermissions({"worldedit.clipboard.save", "worldedit.schematic.save", "worldedit.schematic.save.other"})
public void save(Actor actor, LocalSession session, public void save(Actor actor, LocalSession session,
@ -326,7 +326,7 @@ public class SchematicCommands {
String formatName, String formatName,
@Switch(name = 'f', desc = "Overwrite an existing file.") @Switch(name = 'f', desc = "Overwrite an existing file.")
boolean allowOverwrite, boolean allowOverwrite,
@Switch(name = 'g', desc = "//TODO") @Switch(name = 'g', desc = "Bypasses per-player-schematic folders")
boolean global) throws WorldEditException { boolean global) throws WorldEditException {
LocalConfiguration config = worldEdit.getConfiguration(); LocalConfiguration config = worldEdit.getConfiguration();
@ -360,7 +360,7 @@ public class SchematicCommands {
boolean overwrite = f.exists(); boolean overwrite = f.exists();
if (overwrite) { if (overwrite) {
if (!actor.hasPermission("worldedit.schematic.delete")) { 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 (other) {
if (!actor.hasPermission("worldedit.schematic.delete.other")) { if (!actor.hasPermission("worldedit.schematic.delete.other")) {
@ -390,7 +390,7 @@ public class SchematicCommands {
.registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename) .registerWithSupervisor(worldEdit.getSupervisor(), "Saving schematic " + filename)
.sendMessageAfterDelay(Caption.of("worldedit.schematic.save.saving")) .sendMessageAfterDelay(Caption.of("worldedit.schematic.save.saving"))
.onSuccess(filename + " saved" + (overwrite ? " (overwriting previous file)." : "."), null) .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()); .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 dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ? new File(working, player.getUniqueId().toString()) : working;
File destDir = new File(dir, directory); File destDir = new File(dir, directory);
if (!MainUtil.isInSubDirectory(working, destDir)) { 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; return;
} }
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && !MainUtil.isInSubDirectory(dir, destDir) && !player.hasPermission("worldedit.schematic.move.other")) { 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; return;
} }
if (!destDir.exists() && !destDir.mkdirs()) { 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; return;
} }
for (File source : sources) { for (File source : sources) {
@ -483,7 +483,7 @@ public class SchematicCommands {
first = false; first = false;
} }
first = true; 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") @Arg(name = "filter", desc = "Filter for schematics", def = "all")
String filter, Arguments arguments) throws WorldEditException { String filter, Arguments arguments) throws WorldEditException {
if (oldFirst && newFirst) { 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(); String pageCommand = "/" + arguments.get();
LocalConfiguration config = worldEdit.getConfiguration(); LocalConfiguration config = worldEdit.getConfiguration();
@ -536,50 +536,37 @@ public class SchematicCommands {
List<Component> components = UtilityCommands.entryToComponent(dir, entries, isLoaded, List<Component> components = UtilityCommands.entryToComponent(dir, entries, isLoaded,
(name, path, type, loaded) -> { (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(); TextComponentProducer msg = new TextComponentProducer();
msg.append(TextComponent.of(" - ", color)); msg.append(Caption.of("worldedit.schematic.dash.symbol"));
if (loaded) { 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)) .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 { } else {
msg.append(TextComponent.of("[+]", TextColor.GREEN) msg.append(Caption.of("worldedit.schematic.plus.symbol")
.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, loadMulti + " " + path)) .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) { 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)) .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) { } 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)) .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) { if (type != UtilityCommands.URIType.DIRECTORY) {
msgElem = msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, loadSingle + " " + path)); 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 { } else {
msgElem = msgElem.clickEvent(ClickEvent.of(ClickEvent.Action.SUGGEST_COMMAND, list + " " + path)); 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); msg.append(msgElem);
@ -929,7 +916,7 @@ public class SchematicCommands {
private final File[] files; private final File[] files;
SchematicPaginationBox(String rootDir, File[] files, String pageCommand) { SchematicPaginationBox(String rootDir, File[] files, String pageCommand) {
super("Available schematics", pageCommand); super("worldedit.schematic.available", pageCommand);
this.prefix = rootDir == null ? "" : rootDir; this.prefix = rootDir == null ? "" : rootDir;
this.files = files; this.files = files;
} }
@ -947,14 +934,12 @@ public class SchematicCommands {
return TextComponent.builder() return TextComponent.builder()
.content("") .content("")
.append(TextComponent.of("[L]") .append(TranslatableComponent.of("worldedit.schematic.load.symbol")
.color(TextColor.GOLD)
.clickEvent(ClickEvent .clickEvent(ClickEvent
.of(ClickEvent.Action.RUN_COMMAND, "/schem load \"" + path + "\"")) .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.space())
.append(TextComponent.of(path) .append(TextComponent.of(path)
.color(TextColor.DARK_GREEN)
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(format)))) .hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(format))))
.build(); .build();
} }

Datei anzeigen

@ -312,14 +312,14 @@ public class SelectionCommands {
) )
@CommandPermissions("worldedit.wand.toggle") @CommandPermissions("worldedit.wand.toggle")
public void toggleWand(Player player) { public void toggleWand(Player player) {
player.printInfo( player.print(
Caption.of( Caption.of(
"worldedit.wand.selwand.now.tool", "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")), 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")), 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")) 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("sphere", Caption.of("worldedit.select.sphere.description"), "//sel sphere");
box.appendCommand("cyl", Caption.of("worldedit.select.cyl.description"), "//sel cyl"); box.appendCommand("cyl", Caption.of("worldedit.select.cyl.description"), "//sel cyl");
box.appendCommand("convex", Caption.of("worldedit.select.convex.description"), "//sel convex"); box.appendCommand("convex", Caption.of("worldedit.select.convex.description"), "//sel convex");
box.appendCommand("polyhedral", "Select a hollow polyhedral", "//sel polyhedral"); box.appendCommand("polyhedral", Caption.of("fawe.selection.sel.polyhedral"), "//sel polyhedral");
box.appendCommand("fuzzy[=<mask>]", "Select all connected blocks (magic wand)", "//sel fuzzy[=<mask>]"); box.appendCommand("fuzzy[=<mask>]", Caption.of("fawe.selection.sel.fuzzy-instruction"), "//sel fuzzy[=<mask>]");
actor.print(box.create(1)); actor.print(box.create(1));
return; return;
@ -718,13 +718,13 @@ public class SelectionCommands {
final BlockState state = c.getID(); final BlockState state = c.getID();
final BlockType blockType = state.getBlockType(); final BlockType blockType = state.getBlockType();
Component blockName = blockType.getRichName().color(TextColor.LIGHT_PURPLE); Component blockName = blockType.getRichName();
TextComponent toolTip; TextComponent toolTip;
if (separateStates && state != blockType.getDefaultState()) { if (separateStates && state != blockType.getDefaultState()) {
toolTip = TextComponent.of(state.getAsString(), TextColor.GRAY); toolTip = TextComponent.of(state.getAsString());
blockName = blockName.append(TextComponent.of("*", TextColor.LIGHT_PURPLE)); blockName = blockName.append(TextComponent.of("*"));
} else { } else {
toolTip = TextComponent.of(blockType.getId(), TextColor.GRAY); toolTip = TextComponent.of(blockType.getId());
} }
blockName = blockName.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, toolTip)); blockName = blockName.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, toolTip));
line.append(blockName); line.append(blockName);

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.command.util; package com.sk89q.worldedit.command.util;
import com.boydti.fawe.config.Caption;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.ListenableFuture; 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.component.ErrorFormat;
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.format.TextColor; import com.sk89q.worldedit.util.formatting.text.format.TextColor;
import com.sk89q.worldedit.util.task.FutureForwardingTask; import com.sk89q.worldedit.util.task.FutureForwardingTask;
import com.sk89q.worldedit.util.task.Supervisor; import com.sk89q.worldedit.util.task.Supervisor;
@ -162,18 +164,18 @@ public final class AsyncCommandBuilder<T> {
if (message == null) { if (message == null) {
if (Strings.isNullOrEmpty(converted.getMessage())) { if (Strings.isNullOrEmpty(converted.getMessage())) {
message = TextComponent.of("Unknown error."); message = TranslatableComponent.of("worldedit.error.unknown");
} else { } else {
message = converted.getRichMessage(); message = converted.getRichMessage();
} }
} }
sender.printError(failure.append(TextComponent.of(": ")).append(message)); sender.print(failure.append(TextComponent.of(": ")).append(message));
} }
} else { } else {
throw orig; throw orig;
} }
} catch (Throwable unknown) { } 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); LOGGER.error("Uncaught exception occurred in task: " + description, orig);
} }
} }

Datei anzeigen

@ -433,10 +433,10 @@ public interface Player extends Entity, Actor {
} catch (Exception event) { } catch (Exception event) {
printError(TextComponent.of("====== INVALID CLIPBOARD ======")); printError(TextComponent.of("====== INVALID CLIPBOARD ======"));
event.printStackTrace(); event.printStackTrace();
printError(Caption.of("fawe.error.stacktrace")); print(Caption.of("fawe.error.stacktrace"));
printError(Caption.of("fawe.error.no-failure")); print(Caption.of("fawe.error.no-failure"));
printError(Caption.of("File: ", TextComponent.of(file.getName()), TextComponent.of(" (len:"), TextComponent.of(file.length()), TextComponent.of(")"))); print(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"));
} }
} }
} }

Datei anzeigen

@ -667,13 +667,13 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
@Override @Override
public File openFileOpenDialog(String[] extensions) { public File openFileOpenDialog(String[] extensions) {
printError(Caption.of("worldedit.platform.no-file-dialog")); print(Caption.of("worldedit.platform.no-file-dialog"));
return null; return null;
} }
@Override @Override
public File openFileSaveDialog(String[] extensions) { public File openFileSaveDialog(String[] extensions) {
printError(Caption.of("worldedit.platform.no-file-dialog")); print(Caption.of("worldedit.platform.no-file-dialog"));
return null; return null;
} }

Datei anzeigen

@ -19,6 +19,7 @@
package com.sk89q.worldedit.internal.command; package com.sk89q.worldedit.internal.command;
import com.boydti.fawe.config.Caption;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.sk89q.worldedit.extension.platform.Actor; 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.internal.util.Substring;
import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.formatting.text.TextComponent;
import 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.util.formatting.text.format.TextDecoration;
import org.enginehub.piston.Command; import org.enginehub.piston.Command;
import org.enginehub.piston.CommandParameters; import org.enginehub.piston.CommandParameters;
import org.enginehub.piston.NoInputCommandParameters; import org.enginehub.piston.NoInputCommandParameters;
@ -50,14 +51,13 @@ import static java.util.stream.Collectors.toList;
public class CommandUtil { 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) { private static Component makeDeprecatedFooter(String reason, Component replacement) {
return TextComponent.builder() return TextComponent.builder()
.append(DEPRECATION_MARKER) .append(DEPRECATION_MARKER)
.append(" " + reason + ".") .append(" " + reason + ".")
.append(TextComponent.newline()) .append(TextComponent.newline())
.append(replacement.color(TextColor.GOLD).decoration(TextDecoration.ITALIC, true))
.build(); .build();
} }
@ -85,11 +85,9 @@ public class CommandUtil {
} }
public static Component createNewCommandReplacementText(String suggestedCommand) { public static Component createNewCommandReplacementText(String suggestedCommand) {
return TextComponent.builder("Please use ", TextColor.GOLD) return TranslatableComponent.builder("worldedit.command.deprecation-message")
.append(TextComponent.of(suggestedCommand) .append(TextComponent.of(suggestedCommand)
.decoration(TextDecoration.UNDERLINED, true)
.clickEvent(ClickEvent.suggestCommand(suggestedCommand))) .clickEvent(ClickEvent.suggestCommand(suggestedCommand)))
.append(" instead.")
.build(); .build();
} }

Datei anzeigen

@ -14,6 +14,7 @@
"fawe.info.worldedit.bypassed": "Currently bypassing FAWE restriction.", "fawe.info.worldedit.bypassed": "Currently bypassing FAWE restriction.",
"fawe.info.worldedit.restricted": "Your FAWE edits are now restricted.", "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.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": "Uploading {0}, please wait...",
"fawe.web.generating.link.failed": "Failed to generate download link!", "fawe.web.generating.link.failed": "Failed to generate download link!",
@ -153,7 +154,9 @@
"fawe.selection.sel.max": "{0} points maximum.", "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": "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.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.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", "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.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.",
"worldedit.schematic.formats.title": "Available clipboard formats (Name: Lookup names)", "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.already-set": "Position already set.",
"worldedit.pos.console-require-coords": "You must provide coordinates as console.", "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.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.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.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.pastebin.uploading": "(Please wait... sending output to paste service...)",
"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.platform.no-file-dialog": "File dialogs are not supported in your environment.",