From 4ba54c433705780ca0a3ec1a9de71ba000ef4a63 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 27 Oct 2019 17:19:30 +1000 Subject: [PATCH] Further translations --- .../worldedit/command/BiomeCommands.java | 1 - .../worldedit/command/ExpandCommands.java | 1 - .../worldedit/command/GeneralCommands.java | 4 +- .../worldedit/command/GenerationCommands.java | 1 - .../worldedit/command/NavigationCommands.java | 1 - .../worldedit/command/RegionCommands.java | 1 - .../worldedit/command/SelectionCommands.java | 109 +++++++++--------- .../command/SuperPickaxeCommands.java | 6 +- .../sk89q/worldedit/command/ToolCommands.java | 2 +- .../worldedit/command/ToolUtilCommands.java | 21 ++-- .../command/util/PrintCommandHelp.java | 17 ++- .../platform/AbstractPlayerActor.java | 1 - .../function/operation/ForwardExtentCopy.java | 1 - .../function/visitor/BreadthFirstSearch.java | 1 - .../function/visitor/EntityVisitor.java | 3 - .../function/visitor/FlatRegionVisitor.java | 4 - .../function/visitor/RegionVisitor.java | 2 - .../formatting/component/CommandListBox.java | 1 + .../util/translation/TranslationManager.java | 1 - .../src/main/resources/lang/strings.json | 72 ++++++++++-- 20 files changed, 146 insertions(+), 104 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java index 447c8275c..a04cbeeb4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java @@ -66,7 +66,6 @@ import java.util.Set; import java.util.stream.Collectors; import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION; -import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n; /** * Implements biome-related commands such as "/biomelist". diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ExpandCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ExpandCommands.java index 829766b9d..bc93624e2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ExpandCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ExpandCommands.java @@ -48,7 +48,6 @@ import java.util.List; import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION; import static com.sk89q.worldedit.internal.command.CommandUtil.requireIV; -import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n; /** * Extracted from {@link SelectionCommands} to allow importing of {@link Command}. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index 38f66b71a..82bd2c8f4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -225,11 +225,11 @@ public class GeneralCommands { } boolean previousMode = session.isTickingWatchdog(); if (hookMode != null && (hookMode == HookMode.ACTIVE) == previousMode) { - actor.printError(TranslatableComponent.of(previousMode ? "worldedit.watchdog.already-active" : "worldedit.watchdog.already-inactive")); + actor.printError(TranslatableComponent.of(previousMode ? "worldedit.watchdog.active.already" : "worldedit.watchdog.inactive.already")); return; } session.setTickingWatchdog(!previousMode); - actor.printInfo(TranslatableComponent.of(previousMode ? "worldedit.watchdog.now-inactive" : "worldedit.watchdog.now-active")); + actor.printInfo(TranslatableComponent.of(previousMode ? "worldedit.watchdog.inactive" : "worldedit.watchdog.active")); } @Command( diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index b6a2a3c42..ecad75352 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -51,7 +51,6 @@ import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL; import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT; import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION; import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument; -import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n; /** * Commands for the generation of shapes and other objects. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java index f1a815b39..7b514b951 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java @@ -36,7 +36,6 @@ import org.enginehub.piston.annotation.param.Switch; import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION; -import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n; /** * Commands for moving the player around. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java index 6d59e128f..b3f0a6d1e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java @@ -75,7 +75,6 @@ import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgum import static com.sk89q.worldedit.regions.Regions.asFlatRegion; import static com.sk89q.worldedit.regions.Regions.maximumBlockY; import static com.sk89q.worldedit.regions.Regions.minimumBlockY; -import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n; /** * Commands that operate on regions. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java index 5cf8dc676..6b3bdc515 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java @@ -66,6 +66,7 @@ import com.sk89q.worldedit.util.formatting.component.SubtleFormat; 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; @@ -116,12 +117,12 @@ public class SelectionCommands { } else if (actor instanceof Locatable) { pos = ((Locatable) actor).getBlockLocation(); } else { - actor.printError("You must provide coordinates as console."); + actor.printError(TranslatableComponent.of("worldedit.pos.console-require-coords")); return; } if (!session.getRegionSelector(world).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(actor))) { - actor.printError("Position already set."); + actor.printError(TranslatableComponent.of("worldedit.pos.already-set")); return; } @@ -144,12 +145,12 @@ public class SelectionCommands { } else if (actor instanceof Locatable) { pos = ((Locatable) actor).getBlockLocation(); } else { - actor.printError("You must provide coordinates as console."); + actor.printError(TranslatableComponent.of("worldedit.pos.console-require-coords")); return; } if (!session.getRegionSelector(world).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(actor))) { - actor.printError("Position already set."); + actor.printError(TranslatableComponent.of("worldedit.pos.already-set")); return; } @@ -168,14 +169,14 @@ public class SelectionCommands { if (pos != null) { if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) { - player.printError("Position already set."); + player.printError(TranslatableComponent.of("worldedit.hpos.already-set")); return; } session.getRegionSelector(player.getWorld()) .explainPrimarySelection(player, session, pos.toVector().toBlockPoint()); } else { - player.printError("No block in sight!"); + player.printError(TranslatableComponent.of("worldedit.hpos.no-block")); } } @@ -190,14 +191,14 @@ public class SelectionCommands { if (pos != null) { if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(player))) { - player.printError("Position already set."); + player.printError(TranslatableComponent.of("worldedit.hpos.already-set")); return; } session.getRegionSelector(player.getWorld()) .explainSecondarySelection(player, session, pos.toVector().toBlockPoint()); } else { - player.printError("No block in sight!"); + player.printError(TranslatableComponent.of("worldedit.hpos.no-block")); } } @@ -225,9 +226,13 @@ public class SelectionCommands { min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); max = BlockVector3.at(max2D.getBlockX() * 16 + 15, world.getMaxY(), max2D.getBlockZ() * 16 + 15); - actor.print("Chunks selected: (" - + min2D.getBlockX() + ", " + min2D.getBlockZ() + ") - (" - + max2D.getBlockX() + ", " + max2D.getBlockZ() + ")"); + actor.printInfo(TranslatableComponent.of( + "worldedit.chunk.selected-multiple", + TextComponent.of(min2D.getBlockX()), + TextComponent.of(min2D.getBlockZ()), + TextComponent.of(max2D.getBlockX()), + TextComponent.of(max2D.getBlockZ()) + )); } else { final BlockVector2 min2D; if (coordinates != null) { @@ -247,8 +252,8 @@ public class SelectionCommands { min = BlockVector3.at(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16); max = min.add(15, world.getMaxY(), 15); - actor.print("Chunk selected: " - + min2D.getBlockX() + ", " + min2D.getBlockZ()); + actor.printInfo(TranslatableComponent.of("worldedit.chunk.selected", TextComponent.of(min2D.getBlockX()), + TextComponent.of(min2D.getBlockZ()))); } final CuboidRegionSelector selector; @@ -278,16 +283,16 @@ public class SelectionCommands { } ItemType itemType = ItemTypes.get(wandId); if (itemType == null) { - player.printError("Wand item is mis-configured or disabled."); + player.printError(TranslatableComponent.of("worldedit.wand.invalid")); return; } player.giveItem(new BaseItemStack(itemType, 1)); if (navWand) { session.setTool(itemType, new NavigationWand()); - player.print("Left click: jump to location; Right click: pass through walls"); + player.printInfo(TranslatableComponent.of("worldedit.wand.navwand.info")); } else { session.setTool(itemType, new SelectionWand()); - player.print("Left click: select pos #1; Right click: select pos #2"); + player.printInfo(TranslatableComponent.of("worldedit.wand.selwand.info")); } } @@ -339,9 +344,9 @@ public class SelectionCommands { session.getRegionSelector(world).explainRegionAdjust(actor, session); - actor.print("Region contracted " + (oldSize - newSize) + " blocks."); + actor.printInfo(TranslatableComponent.of("worldedit.contract.contracted", TextComponent.of(oldSize - newSize))); } catch (RegionOperationException e) { - actor.printError(e.getMessage()); + actor.printError(TextComponent.of(e.getMessage())); } } @@ -368,9 +373,9 @@ public class SelectionCommands { session.getRegionSelector(world).explainRegionAdjust(actor, session); - actor.print("Region shifted."); + actor.print(TranslatableComponent.of("worldedit.shift.shifted")); } catch (RegionOperationException e) { - actor.printError(e.getMessage()); + actor.printError(TextComponent.of(e.getMessage())); } } @@ -391,7 +396,7 @@ public class SelectionCommands { region.expand(getChangesForEachDir(amount, onlyHorizontal, onlyVertical)); session.getRegionSelector(world).learnChanges(); session.getRegionSelector(world).explainRegionAdjust(actor, session); - actor.print("Region outset."); + actor.print(TranslatableComponent.of("worldedit.outset.outset")); } @Command( @@ -411,7 +416,7 @@ public class SelectionCommands { region.contract(getChangesForEachDir(amount, onlyHorizontal, onlyVertical)); session.getRegionSelector(world).learnChanges(); session.getRegionSelector(world).explainRegionAdjust(actor, session); - actor.print("Region inset."); + actor.print(TranslatableComponent.of("worldedit.inset.inset")); } private BlockVector3[] getChangesForEachDir(int amount, boolean onlyHorizontal, boolean onlyVertical) { @@ -447,36 +452,36 @@ public class SelectionCommands { region = clipboard.getRegion(); BlockVector3 origin = clipboard.getOrigin(); - actor.print("Offset: " + origin); + actor.printInfo(TranslatableComponent.of("worldedit.size.offset", TextComponent.of(origin.toString()))); } else { region = session.getSelection(world); - actor.print("Type: " + session.getRegionSelector(world).getTypeName()); + actor.printInfo(TranslatableComponent.of("worldedit.size.type", TextComponent.of(session.getRegionSelector(world).getTypeName()))); for (String line : session.getRegionSelector(world).getInformationLines()) { - actor.print(line); + actor.printInfo(TextComponent.of(line)); } } BlockVector3 size = region.getMaximumPoint() .subtract(region.getMinimumPoint()) .add(1, 1, 1); - actor.print("Size: " + size); - actor.print("Cuboid distance: " + region.getMaximumPoint().distance(region.getMinimumPoint())); - actor.print("# of blocks: " + region.getArea()); + actor.printInfo(TranslatableComponent.of("worldedit.size.size", TextComponent.of(size.toString()))); + actor.printInfo(TranslatableComponent.of("worldedit.size.distance", TextComponent.of(region.getMaximumPoint().distance(region.getMinimumPoint())))); + actor.printInfo(TranslatableComponent.of("worldedit.size.blocks", TextComponent.of(region.getArea()))); } - @Command( name = "/count", desc = "Counts the number of blocks matching a mask" ) @CommandPermissions("worldedit.analysis.count") - public void count(Actor actor, World world, LocalSession session, EditSession editSession, + public int count(Actor actor, World world, LocalSession session, EditSession editSession, @Arg(desc = "The mask of blocks to match") Mask mask) throws WorldEditException { int count = editSession.countBlocks(session.getSelection(world), mask); - actor.print("Counted: " + count); + actor.printInfo(TranslatableComponent.of("worldedit.count.counted", TextComponent.of(count))); + return count; } @Command( @@ -510,13 +515,13 @@ public class SelectionCommands { } else { distribution = session.getLastDistribution(); if (distribution == null) { - actor.printError("No previous distribution."); + actor.printError(TranslatableComponent.of("worldedit.distr.no-previous")); return; } } if (distribution.isEmpty()) { // *Should* always be false - actor.printError("No blocks counted."); + actor.printError(TranslatableComponent.of("worldedit.distr.no-blocks")); return; } @@ -542,7 +547,7 @@ public class SelectionCommands { if (selector == null) { session.getRegionSelector(world).clear(); session.dispatchCUISelection(actor); - actor.print("Selection cleared."); + actor.printInfo(TranslatableComponent.of("worldedit.select.cleared")); return; } @@ -552,38 +557,38 @@ public class SelectionCommands { switch (selector) { case CUBOID: newSelector = new CuboidRegionSelector(oldSelector); - actor.print("Cuboid: left click for point 1, right click for point 2"); + actor.printInfo(TranslatableComponent.of("worldedit.select.cuboid.message")); break; case EXTEND: newSelector = new ExtendingCuboidRegionSelector(oldSelector); - actor.print("Cuboid: left click for a starting point, right click to extend"); + actor.printInfo(TranslatableComponent.of("worldedit.select.extend.message")); break; case POLY: { newSelector = new Polygonal2DRegionSelector(oldSelector); - actor.print("2D polygon selector: Left/right click to add a point."); + actor.printInfo(TranslatableComponent.of("worldedit.select.poly.message")); Optional limit = ActorSelectorLimits.forActor(actor).getPolygonVertexLimit(); - limit.ifPresent(integer -> actor.print(integer + " points maximum.")); + limit.ifPresent(integer -> actor.printInfo(TranslatableComponent.of("worldedit.select.poly.limit-message", TextComponent.of(integer)))); break; } case ELLIPSOID: newSelector = new EllipsoidRegionSelector(oldSelector); - actor.print("Ellipsoid selector: left click=center, right click to extend"); + actor.printInfo(TranslatableComponent.of("worldedit.select.ellipsoid.message")); break; case SPHERE: newSelector = new SphereRegionSelector(oldSelector); - actor.print("Sphere selector: left click=center, right click to set radius"); + actor.printInfo(TranslatableComponent.of("worldedit.select.sphere.message")); break; case CYL: newSelector = new CylinderRegionSelector(oldSelector); - actor.print("Cylindrical selector: Left click=center, right click to extend."); + actor.printInfo(TranslatableComponent.of("worldedit.select.cyl.message")); break; case CONVEX: case HULL: case POLYHEDRON: { newSelector = new ConvexPolyhedralRegionSelector(oldSelector); - actor.print("Convex polyhedral selector: Left click=First vertex, right click to add more."); + actor.printInfo(TranslatableComponent.of("worldedit.select.convex.message")); Optional limit = ActorSelectorLimits.forActor(actor).getPolyhedronVertexLimit(); - limit.ifPresent(integer -> actor.print(integer + " points maximum.")); + limit.ifPresent(integer -> actor.printInfo(TranslatableComponent.of("worldedit.select.convex.limit-message", TextComponent.of(integer)))); break; } case LIST: @@ -593,13 +598,13 @@ public class SelectionCommands { TextComponentProducer contents = box.getContents(); contents.append(SubtleFormat.wrap("Select one of the modes below:")).newline(); - box.appendCommand("cuboid", "Select two corners of a cuboid", "//sel cuboid"); - box.appendCommand("extend", "Fast cuboid selection mode", "//sel extend"); - box.appendCommand("poly", "Select a 2D polygon with height", "//sel poly"); - box.appendCommand("ellipsoid", "Select an ellipsoid", "//sel ellipsoid"); - box.appendCommand("sphere", "Select a sphere", "//sel sphere"); - box.appendCommand("cyl", "Select a cylinder", "//sel cyl"); - box.appendCommand("convex", "Select a convex polyhedral", "//sel convex"); + box.appendCommand("cuboid", TranslatableComponent.of("worldedit.select.cuboid.description"), "//sel cuboid"); + box.appendCommand("extend", TranslatableComponent.of("worldedit.select.extend.description"), "//sel extend"); + box.appendCommand("poly", TranslatableComponent.of("worldedit.select.poly.description"), "//sel poly"); + box.appendCommand("ellipsoid", TranslatableComponent.of("worldedit.select.ellipsoid.description"), "//sel ellipsoid"); + box.appendCommand("sphere", TranslatableComponent.of("worldedit.select.sphere.description"), "//sel sphere"); + box.appendCommand("cyl", TranslatableComponent.of("worldedit.select.cyl.description"), "//sel cyl"); + box.appendCommand("convex", TranslatableComponent.of("worldedit.select.convex.description"), "//sel convex"); actor.print(box.create(1)); return; @@ -616,7 +621,7 @@ public class SelectionCommands { if (found != null) { session.setDefaultRegionSelector(found); - actor.print("Your default region selector is now " + found.name() + "."); + actor.printInfo(TranslatableComponent.of("worldedit.select.default-set", TextComponent.of(found.name()))); } else { throw new RuntimeException("Something unexpected happened. Please report this."); } @@ -679,7 +684,7 @@ public class SelectionCommands { @Override public Component create(int page) throws InvalidComponentException { - super.getContents().append(TextComponent.of("Total Block Count: " + totalBlocks, TextColor.GRAY)) + super.getContents().append(TranslatableComponent.of("worldedit.distr.total", TextColor.GRAY, TextComponent.of(totalBlocks))) .append(TextComponent.newline()); return super.create(page); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java index cec687204..61878e040 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SuperPickaxeCommands.java @@ -51,7 +51,7 @@ public class SuperPickaxeCommands { public void single(Player player, LocalSession session) throws WorldEditException { session.setSuperPickaxe(new SinglePickaxe()); session.enableSuperPickAxe(); - player.printInfo(TranslatableComponent.of("worldedit.superpickaxe.mode.single")); + player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.single")); } @Command( @@ -72,7 +72,7 @@ public class SuperPickaxeCommands { session.setSuperPickaxe(new AreaPickaxe(range)); session.enableSuperPickAxe(); - player.printInfo(TranslatableComponent.of("worldedit.superpickaxe.mode.area")); + player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.area")); } @Command( @@ -94,6 +94,6 @@ public class SuperPickaxeCommands { session.setSuperPickaxe(new RecursivePickaxe(range)); session.enableSuperPickAxe(); - player.printInfo(TranslatableComponent.of("worldedit.superpickaxe.mode.recursive")); + player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.mode.recursive")); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java index dfcb66d1b..3e6be110e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java @@ -235,7 +235,7 @@ public class ToolCommands { LocalConfiguration config = we.getConfiguration(); if (range > config.maxSuperPickaxeSize) { - player.printError("Maximum range: " + config.maxSuperPickaxeSize); + player.printError(TranslatableComponent.of("worldedit.superpickaxe.max-range", TextComponent.of(config.maxSuperPickaxeSize))); return; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java index 2597372d5..3a9335c59 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java @@ -28,6 +28,7 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.util.HandSide; +import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import org.enginehub.piston.annotation.Command; import org.enginehub.piston.annotation.CommandContainer; import org.enginehub.piston.annotation.param.Arg; @@ -54,15 +55,15 @@ public class ToolUtilCommands { Boolean superPickaxe) { boolean hasSuperPickAxe = session.hasSuperPickAxe(); if (superPickaxe != null && superPickaxe == hasSuperPickAxe) { - player.printError("Super pickaxe already " + (superPickaxe ? "enabled" : "disabled") + "."); + player.printError(TranslatableComponent.of(superPickaxe ? "worldedit.tool.superpickaxe.enabled.already" : "worldedit.tool.superpickaxe.disabled.already")); return; } if (hasSuperPickAxe) { session.disableSuperPickAxe(); - player.print("Super pickaxe disabled."); + player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.disabled")); } else { session.enableSuperPickAxe(); - player.print("Super pickaxe enabled."); + player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.enabled")); } } @@ -77,9 +78,9 @@ public class ToolUtilCommands { Mask mask) throws WorldEditException { session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setMask(mask); if (mask == null) { - player.print("Brush mask disabled."); + player.printInfo(TranslatableComponent.of("worldedit.tool.mask.disabled")); } else { - player.print("Brush mask set."); + player.printInfo(TranslatableComponent.of("worldedit.tool.mask.set")); } } @@ -93,7 +94,7 @@ public class ToolUtilCommands { @Arg(desc = "The pattern of blocks to use") Pattern pattern) throws WorldEditException { session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setFill(pattern); - player.print("Brush material set."); + player.printInfo(TranslatableComponent.of("worldedit.tool.material.set")); } @Command( @@ -105,7 +106,7 @@ public class ToolUtilCommands { @Arg(desc = "The range of the brush") int range) throws WorldEditException { session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setRange(range); - player.print("Brush range set."); + player.printInfo(TranslatableComponent.of("worldedit.tool.range.set")); } @Command( @@ -119,7 +120,7 @@ public class ToolUtilCommands { we.checkMaxBrushRadius(size); session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setSize(size); - player.print("Brush size set."); + player.printInfo(TranslatableComponent.of("worldedit.tool.size.set")); } @Command( @@ -132,9 +133,9 @@ public class ToolUtilCommands { Mask mask) throws WorldEditException { session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setTraceMask(mask); if (mask == null) { - player.print("Trace mask disabled."); + player.printInfo(TranslatableComponent.of("worldedit.tool.tracemask.disabled")); } else { - player.print("Trace mask set."); + player.printInfo(TranslatableComponent.of("worldedit.tool.tracemask.set")); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PrintCommandHelp.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PrintCommandHelp.java index bd674f108..ca7f3a394 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PrintCommandHelp.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/PrintCommandHelp.java @@ -19,10 +19,13 @@ package com.sk89q.worldedit.command.util; +import static com.sk89q.worldedit.internal.command.CommandUtil.byCleanName; +import static com.sk89q.worldedit.internal.command.CommandUtil.getSubCommands; +import static java.util.stream.Collectors.toList; + import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.util.formatting.component.CommandListBox; import com.sk89q.worldedit.util.formatting.component.CommandUsageBox; @@ -39,10 +42,6 @@ import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; -import static com.sk89q.worldedit.internal.command.CommandUtil.byCleanName; -import static com.sk89q.worldedit.internal.command.CommandUtil.getSubCommands; -import static java.util.stream.Collectors.toList; - /** * Implementation of the //help command. */ @@ -91,8 +90,8 @@ public class PrintCommandHelp { Map subCommands = getSubCommands(currentCommand); if (subCommands.isEmpty()) { - actor.printError(String.format("'%s' has no sub-commands. (Maybe '%s' is for a parameter?)", - toCommandString(visited), subCommand)); + actor.printError(TranslatableComponent.of("worldedit.help.no-subcommands", + TextComponent.of(toCommandString(visited)), TextComponent.of(subCommand))); // full help for single command CommandUsageBox box = new CommandUsageBox(visited, visited.stream() .map(Command::getName).collect(Collectors.joining(" ")), helpRootCommand); @@ -104,8 +103,8 @@ public class PrintCommandHelp { currentCommand = subCommands.get(subCommand); visited.add(currentCommand); } else { - actor.printError(String.format("The sub-command '%s' under '%s' could not be found.", - subCommand, toCommandString(visited))); + actor.printError(TranslatableComponent.of("worldedit.help.subcommand-not-found", + TextComponent.of(subCommand), TextComponent.of(toCommandString(visited)))); // list subcommands for currentCommand printCommands(page, getSubCommands(Iterables.getLast(visited)).values().stream(), actor, visited, helpRootCommand); return; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index 775cd2475..6bb5959c9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -35,7 +35,6 @@ import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.TargetBlock; 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.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java index a08507e03..b679f1d41 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java @@ -21,7 +21,6 @@ package com.sk89q.worldedit.function.operation; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n; import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java index e32ec54d9..e2612249a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java @@ -20,7 +20,6 @@ package com.sk89q.worldedit.function.visitor; import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n; import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEditException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java index b8e9cb99f..c1e8e7b56 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/EntityVisitor.java @@ -20,7 +20,6 @@ package com.sk89q.worldedit.function.visitor; import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n; import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEditException; @@ -33,9 +32,7 @@ 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 java.util.Collection; import java.util.Iterator; -import java.util.List; /** * Visits entities as provided by an {@code Iterator}. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java index 70d3c9df0..5c1f9f62f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java @@ -20,7 +20,6 @@ package com.sk89q.worldedit.function.visitor; import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n; import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEditException; @@ -34,9 +33,6 @@ 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 java.util.Collection; -import java.util.List; - /** * Applies region functions to columns in a {@link FlatRegion}. */ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java index a7070e1c4..670c3861b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.function.visitor; -import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n; - import com.google.common.collect.Lists; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandListBox.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandListBox.java index 2efc8b7b3..9dda1c49f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandListBox.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/formatting/component/CommandListBox.java @@ -58,6 +58,7 @@ public class CommandListBox extends PaginationBox { appendCommand(alias, description, null); } + @Deprecated public void appendCommand(String alias, String description, String insertion) { appendCommand(alias, TextComponent.of(description), insertion); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java index ab5d1e3d1..a0921b81d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java @@ -33,7 +33,6 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.Type; import java.net.URL; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.text.MessageFormat; import java.util.HashMap; diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index 341c5a2ee..aba676629 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -54,10 +54,10 @@ "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.watchdog.no-hook": "This platform has no watchdog hook.", - "worldedit.watchdog.already-active": "Watchdog hook already active.", - "worldedit.watchdog.already-inactive": "Watchdog hook already inactive.", - "worldedit.watchdog.now-active": "Watchdog hook now active.", - "worldedit.watchdog.now-inactive": "Watchdog hook now inactive.", + "worldedit.watchdog.active.already": "Watchdog hook already active.", + "worldedit.watchdog.inactive.already": "Watchdog hook already inactive.", + "worldedit.watchdog.active": "Watchdog hook now active.", + "worldedit.watchdog.inactive": "Watchdog hook now inactive.", "worldedit.world.remove": "Removed world override.", "worldedit.world.set": "Set the world override to {0}. (Use //world to go back to default)", @@ -93,6 +93,47 @@ "worldedit.schematic.delete.deleted": "{0} has been deleted.", "worldedit.schematic.formats.title": "Available clipboard formats (Name: Lookup names)", + "worldedit.pos.already-set": "Position already set.", + "worldedit.pos.console-require-coords": "You must provide coordinates as console.", + "worldedit.hpos.no-block": "No block in sight!", + "worldedit.hpos.already-set": "Position already set.", + "worldedit.chunk.selected-multiple": "Chunks selected: ({0}, {1}) - ({2}, {3})", + "worldedit.chunk.selected": "Chunk selected: {0}, {1}", + "worldedit.wand.invalid": "Wand item is mis-configured or disabled.", + "worldedit.wand.selwand.info": "Left click: select pos #1; Right click: select pos #2", + "worldedit.wand.navwand.info": "Left click: jump to location; Right click: pass through walls", + "worldedit.contract.contracted": "Region contracted {0} blocks.", + "worldedit.shift.shifted": "Region shifted.", + "worldedit.outset.outset": "Region outset.", + "worldedit.inset.inset": "Region inset.", + "worldedit.size.offset": "Offset: {0}", + "worldedit.size.type": "Type: {0}", + "worldedit.size.size": "Size: {0}", + "worldedit.size.distance": "Cuboid distance: {0}", + "worldedit.size.blocks": "# of blocks: {0}", + "worldedit.count.counted": "Counted: {0}", + "worldedit.distr.no-blocks": "No blocks counted.", + "worldedit.distr.no-previous": "No previous distribution.", + "worldedit.distr.total": "Total Block Count: {0}", + "worldedit.select.cleared": "Selection cleared.", + "worldedit.select.cuboid.message": "Cuboid: left click for point 1, right click for point 2", + "worldedit.select.cuboid.description": "Select two corners of a cuboid", + "worldedit.select.extend.message": "Cuboid: left click for a starting point, right click to extend", + "worldedit.select.extend.description": "Fast cuboid selection mode", + "worldedit.select.poly.message": "2D polygon selector: Left/right click to add a point.", + "worldedit.select.poly.limit-message": "{0} points maximum.", + "worldedit.select.poly.description": "Select a 2D polygon with height", + "worldedit.select.ellipsoid.message": "Ellipsoid selector: left click=center, right click to extend", + "worldedit.select.ellipsoid.description": "Select an ellipsoid", + "worldedit.select.sphere.message": "Sphere selector: left click=center, right click to set radius", + "worldedit.select.sphere.description": "Select a sphere", + "worldedit.select.cyl.message": "Cylindrical selector: Left click=center, right click to extend", + "worldedit.select.cyl.description": "Select a cylinder", + "worldedit.select.convex.message": "Convex polyhedral selector: Left click=First vertex, right click to add more.", + "worldedit.select.convex.limit-message": "{0} points maximum.", + "worldedit.select.convex.description": "Select a convex polyhedral", + "worldedit.select.default-set": "Your default region selector is now {0}.", + "worldedit.drain.drained": "{0} blocks have been drained.", "worldedit.fill.created": "{0} blocks have been filled.", "worldedit.fillr.created": "{0} blocks have been filled.", @@ -203,10 +244,21 @@ "worldedit.tool.lrbuild.equip": "Long-range building tool bound to {0}.", "worldedit.tool.lrbuild.set": "Left-click set to {0}; right-click set to {1}.", - "worldedit.superpickaxe.mode.single": "Mode is now single. Left click with a pickaxe. // to disable.", - "worldedit.superpickaxe.mode.area": "Mode is now area. Left click with a pickaxe. // to disable.", - "worldedit.superpickaxe.mode.recursive": "Mode is now recursive. Left click with a pickaxe. // to disable.", - "worldedit.superpickaxe.max-range": "Maximum range is {0}.", + "worldedit.tool.superpickaxe.mode.single": "Mode is now single. Left click with a pickaxe. // to disable.", + "worldedit.tool.superpickaxe.mode.area": "Mode is now area. Left click with a pickaxe. // to disable.", + "worldedit.tool.superpickaxe.mode.recursive": "Mode is now recursive. Left click with a pickaxe. // to disable.", + "worldedit.tool.superpickaxe.max-range": "Maximum range is {0}.", + "worldedit.tool.superpickaxe.enabled.already": "Super pickaxe already enabled.", + "worldedit.tool.superpickaxe.disabled.already": "Super pickaxe already disabled.", + "worldedit.tool.superpickaxe.enabled": "Super pickaxe enabled.", + "worldedit.tool.superpickaxe.disabled": "Super pickaxe disabled.", + "worldedit.tool.mask.set": "Brush mask set.", + "worldedit.tool.mask.disabled": "Brush mask disabled.", + "worldedit.tool.material.set": "Brush material set.", + "worldedit.tool.range.set": "Brush range set.", + "worldedit.tool.size.set": "Brush size set.", + "worldedit.tool.tracemask.set": "Trace mask set.", + "worldedit.tool.tracemask.disabled": "Trace mask disabled.", "worldedit.operation.affected.biome": "{0} biomes affected", "worldedit.operation.affected.block": "{0} blocks affected", @@ -214,5 +266,7 @@ "worldedit.operation.affected.entity": "{0} entities affected", "worldedit.operation.deform.expression": "deformed using {0}", - "worldedit.help.command-not-found": "The command '{0}' could not be found." + "worldedit.help.command-not-found": "The command '{0}' could not be found.", + "worldedit.help.no-subcommands": "'{0}' has no sub-commands. (Maybe '{1}' is for a parameter?)", + "worldedit.help.subcommand-not-found": "The sub-command '{0}' under '{1}' could not be found." } \ No newline at end of file