From 455a40b3fcab97cd498582b01e2aebabd265b9f2 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 22 Oct 2019 20:14:52 +1000 Subject: [PATCH] Add a few more strings --- .../worldedit/command/GeneralCommands.java | 4 +-- .../worldedit/command/GenerationCommands.java | 25 +++++++++++-------- .../generator/GardenPatchGenerator.java | 6 ++--- .../src/main/resources/lang/strings.json | 17 +++++++++++++ 4 files changed, 35 insertions(+), 17 deletions(-) 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 da7950b63..38f66b71a 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.help.already-active" : "worldedit.help.already-inactive")); + actor.printError(TranslatableComponent.of(previousMode ? "worldedit.watchdog.already-active" : "worldedit.watchdog.already-inactive")); return; } session.setTickingWatchdog(!previousMode); - actor.printInfo(TranslatableComponent.of(previousMode ? "worldedit.help.now-inactive" : "worldedit.help.now-active")); + actor.printInfo(TranslatableComponent.of(previousMode ? "worldedit.watchdog.now-inactive" : "worldedit.watchdog.now-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 501028d17..92fe2222a 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 @@ -36,6 +36,8 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.TreeGenerator.TreeType; +import com.sk89q.worldedit.util.formatting.text.TextComponent; +import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; import com.sk89q.worldedit.world.biome.BiomeType; import org.enginehub.piston.annotation.Command; import org.enginehub.piston.annotation.CommandContainer; @@ -49,6 +51,7 @@ 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. @@ -113,7 +116,7 @@ public class GenerationCommands { break; default: - actor.printError("You must either specify 1 or 2 radius values."); + actor.printError(TranslatableComponent.of("worldedit.cyl.invalid-radius")); return 0; } @@ -123,7 +126,7 @@ public class GenerationCommands { BlockVector3 pos = session.getPlacementPosition(actor); int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow); - actor.print(affected + " block(s) have been created."); + actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.cyl.created", affected), TextComponent.of(affected))); return affected; } @@ -173,7 +176,7 @@ public class GenerationCommands { break; default: - actor.printError("You must either specify 1 or 3 radius values."); + actor.printError(TranslatableComponent.of("worldedit.sphere.invalid-radius")); return 0; } @@ -190,7 +193,7 @@ public class GenerationCommands { if (actor instanceof Player) { ((Player) actor).findFreePosition(); } - actor.print(affected + " block(s) have been created."); + actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.sphere.created", affected), TextComponent.of(affected))); return affected; } @@ -211,7 +214,7 @@ public class GenerationCommands { worldEdit.checkMaxRadius(size); density /= 100; int affected = editSession.makeForest(session.getPlacementPosition(actor), size, density, type); - actor.print(affected + " trees created."); + actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.forestgen.created", affected), TextComponent.of(affected))); return affected; } @@ -226,7 +229,7 @@ public class GenerationCommands { int size) throws WorldEditException { worldEdit.checkMaxRadius(size); int affected = editSession.makePumpkinPatches(session.getPlacementPosition(actor), size); - actor.print(affected + " pumpkin patches created."); + actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.pumpkins.created", affected), TextComponent.of(affected))); return affected; } @@ -263,7 +266,7 @@ public class GenerationCommands { if (actor instanceof Player) { ((Player) actor).findFreePosition(); } - actor.print(affected + " block(s) have been created."); + actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.pyramid.created", affected), TextComponent.of(affected))); return affected; } @@ -322,10 +325,10 @@ public class GenerationCommands { if (actor instanceof Player) { ((Player) actor).findFreePosition(); } - actor.print(affected + " block(s) have been created."); + actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.generate.created", affected), TextComponent.of(affected))); return affected; } catch (ExpressionException e) { - actor.printError(e.getMessage()); + actor.printError(TextComponent.of(e.getMessage())); return 0; } } @@ -381,10 +384,10 @@ public class GenerationCommands { try { final int affected = editSession.makeBiomeShape(region, zero, unit, target, String.join(" ", expression), hollow, session.getTimeout()); - actor.print("" + affected + " columns affected."); + actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.generatebiome.changed", affected), TextComponent.of(affected))); return affected; } catch (ExpressionException e) { - actor.printError(e.getMessage()); + actor.printError(TextComponent.of(e.getMessage())); return 0; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java index 19f5ed855..e27e5eca6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java @@ -162,14 +162,12 @@ public class GardenPatchGenerator implements RegionFunction { position = position.add(0, 1, 0); } - if (editSession.getBlock(position.add(0, -1, 0)).getBlockType() != BlockTypes.GRASS_BLOCK) { + if (!editSession.getBlock(position.add(0, -1, 0)).getBlockType().equals(BlockTypes.GRASS_BLOCK)) { return false; } - if (editSession.getBlock(position).getBlockType().getMaterial().isAir()) { - editSession.setBlock(position, leafPattern); - } + setBlockIfAir(editSession, position, leafPattern); placeVine(position, position.add(0, 0, 1)); placeVine(position, position.add(0, 0, -1)); diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index 53e9ec6e5..758f33654 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -192,6 +192,23 @@ "worldedit.up.obstructed": "You would hit something above you.", "worldedit.up.moved": "Woosh!", + "worldedit.cyl.invalid-radius": "You must either specify 1 or 2 radius values.", + "worldedit.cyl.created.singular": "{0} block has been created.", + "worldedit.cyl.created.plural": "{0} blocks have been created.", + "worldedit.sphere.invalid-radius": "You must either specify 1 or 3 radius values.", + "worldedit.sphere.created.singular": "{0} block has been created.", + "worldedit.sphere.created.plural": "{0} blocks have been created.", + "worldedit.forestgen.created.singular": "{0} tree created.", + "worldedit.forestgen.created.plural": "{0} trees created.", + "worldedit.pumpkins.created.singular": "{0} pumpkin patch created.", + "worldedit.pumpkins.created.plural": "{0} pumpkin patches created.", + "worldedit.pyramid.created.singular": "{0} block has been created.", + "worldedit.pyramid.created.plural": "{0} blocks have been created.", + "worldedit.generate.created.singular": "{0} block has been created.", + "worldedit.generate.created.plural": "{0} blocks have been created.", + "worldedit.generate.changed.singular": "{0} column affected.", + "worldedit.generate.changed.plural": "{0} columns affected.", + "worldedit.reload.config": "Configuration reloaded!", "worldedit.report.written": "WorldEdit report written to {0}", "worldedit.report.error": "Failed to write report: {0}",