Remove support for pluralisation to match Minecraft and alleviate issues with over-complexity

This commit is contained in:
Matthew Miller 2019-10-27 15:29:40 +10:00
parent 455a40b3fc
commit 0e6037584f
13 changed files with 99 additions and 191 deletions

View File

@ -167,7 +167,7 @@ public class BiomeCommands {
return TextComponent.of(biome.getId()); return TextComponent.of(biome.getId());
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
player.printInfo(TranslatableComponent.of(pluraliseI18n(messageKey, biomes.size()), TextUtils.join(components, TextComponent.of(", ")))); player.printInfo(TranslatableComponent.of(messageKey, TextUtils.join(components, TextComponent.of(", "))));
} }
@Command( @Command(
@ -201,7 +201,7 @@ public class BiomeCommands {
Operations.completeLegacy(visitor); Operations.completeLegacy(visitor);
player.printInfo(TranslatableComponent.of( player.printInfo(TranslatableComponent.of(
pluraliseI18n("worldedit.setbiome.changed", visitor.getAffected()), "worldedit.setbiome.changed",
TextComponent.of(visitor.getAffected()) TextComponent.of(visitor.getAffected())
)); ));
} }

View File

@ -113,7 +113,7 @@ public class ExpandCommands {
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session); session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
int changeSize = newSize - oldSize; int changeSize = newSize - oldSize;
player.printInfo( player.printInfo(
TranslatableComponent.of(pluraliseI18n("worldedit.expand.expanded.vert", changeSize), TextComponent.of(changeSize)) TranslatableComponent.of("worldedit.expand.expanded.vert", TextComponent.of(changeSize))
); );
} catch (RegionOperationException e) { } catch (RegionOperationException e) {
player.printError(TextComponent.of(e.getMessage())); player.printError(TextComponent.of(e.getMessage()));
@ -152,7 +152,7 @@ public class ExpandCommands {
session.getRegionSelector(world).explainRegionAdjust(actor, session); session.getRegionSelector(world).explainRegionAdjust(actor, session);
int changeSize = newSize - oldSize; int changeSize = newSize - oldSize;
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.expand.expanded", changeSize), TextComponent.of(changeSize))); actor.printInfo(TranslatableComponent.of("worldedit.expand.expanded", TextComponent.of(changeSize)));
} }
} }

View File

@ -126,7 +126,7 @@ public class GenerationCommands {
BlockVector3 pos = session.getPlacementPosition(actor); BlockVector3 pos = session.getPlacementPosition(actor);
int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow); int affected = editSession.makeCylinder(pos, pattern, radiusX, radiusZ, height, !hollow);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.cyl.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.cyl.created", TextComponent.of(affected)));
return affected; return affected;
} }
@ -193,7 +193,7 @@ public class GenerationCommands {
if (actor instanceof Player) { if (actor instanceof Player) {
((Player) actor).findFreePosition(); ((Player) actor).findFreePosition();
} }
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.sphere.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.sphere.created", TextComponent.of(affected)));
return affected; return affected;
} }
@ -214,7 +214,7 @@ public class GenerationCommands {
worldEdit.checkMaxRadius(size); worldEdit.checkMaxRadius(size);
density /= 100; density /= 100;
int affected = editSession.makeForest(session.getPlacementPosition(actor), size, density, type); int affected = editSession.makeForest(session.getPlacementPosition(actor), size, density, type);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.forestgen.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.forestgen.created", TextComponent.of(affected)));
return affected; return affected;
} }
@ -229,7 +229,7 @@ public class GenerationCommands {
int size) throws WorldEditException { int size) throws WorldEditException {
worldEdit.checkMaxRadius(size); worldEdit.checkMaxRadius(size);
int affected = editSession.makePumpkinPatches(session.getPlacementPosition(actor), size); int affected = editSession.makePumpkinPatches(session.getPlacementPosition(actor), size);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.pumpkins.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.pumpkins.created", TextComponent.of(affected)));
return affected; return affected;
} }
@ -266,7 +266,7 @@ public class GenerationCommands {
if (actor instanceof Player) { if (actor instanceof Player) {
((Player) actor).findFreePosition(); ((Player) actor).findFreePosition();
} }
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.pyramid.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.pyramid.created", TextComponent.of(affected)));
return affected; return affected;
} }
@ -325,7 +325,7 @@ public class GenerationCommands {
if (actor instanceof Player) { if (actor instanceof Player) {
((Player) actor).findFreePosition(); ((Player) actor).findFreePosition();
} }
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.generate.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.generate.created", TextComponent.of(affected)));
return affected; return affected;
} catch (ExpressionException e) { } catch (ExpressionException e) {
actor.printError(TextComponent.of(e.getMessage())); actor.printError(TextComponent.of(e.getMessage()));
@ -384,7 +384,7 @@ public class GenerationCommands {
try { try {
final int affected = editSession.makeBiomeShape(region, zero, unit, target, String.join(" ", expression), hollow, session.getTimeout()); final int affected = editSession.makeBiomeShape(region, zero, unit, target, String.join(" ", expression), hollow, session.getTimeout());
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.generatebiome.changed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.generatebiome.changed", TextComponent.of(affected)));
return affected; return affected;
} catch (ExpressionException e) { } catch (ExpressionException e) {
actor.printError(TextComponent.of(e.getMessage())); actor.printError(TextComponent.of(e.getMessage()));

View File

@ -86,7 +86,7 @@ public class NavigationCommands {
if (ascentLevels == 0) { if (ascentLevels == 0) {
player.printError(TranslatableComponent.of("worldedit.ascend.obstructed")); player.printError(TranslatableComponent.of("worldedit.ascend.obstructed"));
} else { } else {
player.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.ascend.moved", ascentLevels), TextComponent.of(ascentLevels))); player.printInfo(TranslatableComponent.of("worldedit.ascend.moved", TextComponent.of(ascentLevels)));
} }
} }
@ -109,7 +109,7 @@ public class NavigationCommands {
if (descentLevels == 0) { if (descentLevels == 0) {
player.printError(TranslatableComponent.of("worldedit.descend.obstructed")); player.printError(TranslatableComponent.of("worldedit.descend.obstructed"));
} else { } else {
player.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.descend.moved", descentLevels), TextComponent.of(descentLevels))); player.printInfo(TranslatableComponent.of("worldedit.descend.moved", TextComponent.of(descentLevels)));
} }
} }

View File

@ -139,7 +139,7 @@ public class RegionCommands {
BlockVector3 pos2 = cuboidregion.getPos2(); BlockVector3 pos2 = cuboidregion.getPos2();
int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell); int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.line.changed", blocksChanged), TextComponent.of(blocksChanged))); actor.printInfo(TranslatableComponent.of("worldedit.line.changed", TextComponent.of(blocksChanged)));
return blocksChanged; return blocksChanged;
} }
@ -169,7 +169,7 @@ public class RegionCommands {
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell); int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.curve.changed", blocksChanged), TextComponent.of(blocksChanged))); actor.printInfo(TranslatableComponent.of("worldedit.curve.changed", TextComponent.of(blocksChanged)));
return blocksChanged; return blocksChanged;
} }
@ -189,7 +189,7 @@ public class RegionCommands {
from = new ExistingBlockMask(editSession); from = new ExistingBlockMask(editSession);
} }
int affected = editSession.replaceBlocks(region, from, to); int affected = editSession.replaceBlocks(region, from, to);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.replace.replaced", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.replace.replaced", TextComponent.of(affected)));
return affected; return affected;
} }
@ -203,7 +203,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to overlay") @Arg(desc = "The pattern of blocks to overlay")
Pattern pattern) throws WorldEditException { Pattern pattern) throws WorldEditException {
int affected = editSession.overlayCuboidBlocks(region, pattern); int affected = editSession.overlayCuboidBlocks(region, pattern);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.overlay.overlaid", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.overlay.overlaid", TextComponent.of(affected)));
return affected; return affected;
} }
@ -218,7 +218,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException { Pattern pattern) throws WorldEditException {
int affected = editSession.center(region, pattern); int affected = editSession.center(region, pattern);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.center.changed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.center.changed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -230,7 +230,7 @@ public class RegionCommands {
@Logging(REGION) @Logging(REGION)
public int naturalize(Actor actor, EditSession editSession, @Selection Region region) throws WorldEditException { public int naturalize(Actor actor, EditSession editSession, @Selection Region region) throws WorldEditException {
int affected = editSession.naturalizeCuboidBlocks(region); int affected = editSession.naturalizeCuboidBlocks(region);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.naturalize.naturalized", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.naturalize.naturalized", TextComponent.of(affected)));
return affected; return affected;
} }
@ -244,7 +244,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException { Pattern pattern) throws WorldEditException {
int affected = editSession.makeWalls(region, pattern); int affected = editSession.makeWalls(region, pattern);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.walls.changed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.walls.changed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -259,7 +259,7 @@ public class RegionCommands {
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException { Pattern pattern) throws WorldEditException {
int affected = editSession.makeCuboidFaces(region, pattern); int affected = editSession.makeCuboidFaces(region, pattern);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.faces.changed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.faces.changed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -278,7 +278,7 @@ public class RegionCommands {
HeightMap heightMap = new HeightMap(editSession, region, mask); HeightMap heightMap = new HeightMap(editSession, region, mask);
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0)); HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
int affected = heightMap.applyFilter(filter, iterations); int affected = heightMap.applyFilter(filter, iterations);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.smooth.changed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.smooth.changed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -333,7 +333,7 @@ public class RegionCommands {
} }
} }
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.move.moved", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.move.moved", TextComponent.of(affected)));
return affected; return affected;
} }
@ -388,7 +388,7 @@ public class RegionCommands {
} }
} }
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.stack.changed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.stack.changed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -455,7 +455,7 @@ public class RegionCommands {
if (actor instanceof Player) { if (actor instanceof Player) {
((Player) actor).findFreePosition(); ((Player) actor).findFreePosition();
} }
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.deform.deformed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.deform.deformed", TextComponent.of(affected)));
return affected; return affected;
} catch (ExpressionException e) { } catch (ExpressionException e) {
actor.printError(TextComponent.of(e.getMessage())); actor.printError(TextComponent.of(e.getMessage()));
@ -479,7 +479,7 @@ public class RegionCommands {
checkCommandArgument(thickness >= 0, "Thickness must be >= 0"); checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
int affected = editSession.hollowOutRegion(region, thickness, pattern); int affected = editSession.hollowOutRegion(region, thickness, pattern);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.hollow.changed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.hollow.changed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -496,7 +496,7 @@ public class RegionCommands {
double density) throws WorldEditException { double density) throws WorldEditException {
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]"); checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
int affected = editSession.makeForest(region, density / 100, type); int affected = editSession.makeForest(region, density / 100, type);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.forest.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.forest.created", TextComponent.of(affected)));
return affected; return affected;
} }
@ -518,7 +518,7 @@ public class RegionCommands {
Operations.completeLegacy(visitor); Operations.completeLegacy(visitor);
int affected = ground.getAffected(); int affected = ground.getAffected();
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.flora.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.flora.created", TextComponent.of(affected)));
return affected; return affected;
} }

View File

@ -20,7 +20,6 @@
package com.sk89q.worldedit.command; package com.sk89q.worldedit.command;
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT; import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
import static com.sk89q.worldedit.util.translation.LocalisationHelpers.pluraliseI18n;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.IncompleteRegionException;
@ -101,7 +100,7 @@ public class UtilityCommands {
BlockVector3 pos = session.getPlacementPosition(actor); BlockVector3 pos = session.getPlacementPosition(actor);
int affected = editSession.fillXZ(pos, pattern, radius, depth, false); int affected = editSession.fillXZ(pos, pattern, radius, depth, false);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.fill.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.fill.created", TextComponent.of(affected)));
return affected; return affected;
} }
@ -125,7 +124,7 @@ public class UtilityCommands {
BlockVector3 pos = session.getPlacementPosition(actor); BlockVector3 pos = session.getPlacementPosition(actor);
int affected = editSession.fillXZ(pos, pattern, radius, depth, true); int affected = editSession.fillXZ(pos, pattern, radius, depth, true);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.fillr.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.fillr.created", TextComponent.of(affected)));
return affected; return affected;
} }
@ -143,7 +142,7 @@ public class UtilityCommands {
radius = Math.max(0, radius); radius = Math.max(0, radius);
we.checkMaxRadius(radius); we.checkMaxRadius(radius);
int affected = editSession.drainArea(session.getPlacementPosition(actor), radius, waterlogged); int affected = editSession.drainArea(session.getPlacementPosition(actor), radius, waterlogged);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.drain.drained", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.drain.drained", TextComponent.of(affected)));
return affected; return affected;
} }
@ -160,7 +159,7 @@ public class UtilityCommands {
radius = Math.max(0, radius); radius = Math.max(0, radius);
we.checkMaxRadius(radius); we.checkMaxRadius(radius);
int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.LAVA); int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.LAVA);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.fixlava.fixed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.fixlava.fixed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -177,7 +176,7 @@ public class UtilityCommands {
radius = Math.max(0, radius); radius = Math.max(0, radius);
we.checkMaxRadius(radius); we.checkMaxRadius(radius);
int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.WATER); int affected = editSession.fixLiquid(session.getPlacementPosition(actor), radius, BlockTypes.WATER);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.fixwater.fixed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.fixwater.fixed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -198,7 +197,7 @@ public class UtilityCommands {
height = height != null ? Math.min((world.getMaxY() + 1), height + 1) : (world.getMaxY() + 1); height = height != null ? Math.min((world.getMaxY() + 1), height + 1) : (world.getMaxY() + 1);
int affected = editSession.removeAbove(session.getPlacementPosition(actor), size, height); int affected = editSession.removeAbove(session.getPlacementPosition(actor), size, height);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.removeabove.removed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.removeabove.removed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -219,7 +218,7 @@ public class UtilityCommands {
height = height != null ? Math.min((world.getMaxY() + 1), height + 1) : (world.getMaxY() + 1); height = height != null ? Math.min((world.getMaxY() + 1), height + 1) : (world.getMaxY() + 1);
int affected = editSession.removeBelow(session.getPlacementPosition(actor), size, height); int affected = editSession.removeBelow(session.getPlacementPosition(actor), size, height);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.removebelow.removed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.removebelow.removed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -239,7 +238,7 @@ public class UtilityCommands {
we.checkMaxRadius(radius); we.checkMaxRadius(radius);
int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, radius); int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, radius);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.removenear.removed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.removenear.removed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -270,7 +269,7 @@ public class UtilityCommands {
} }
int affected = editSession.replaceBlocks(region, from, to); int affected = editSession.replaceBlocks(region, from, to);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.replacenear.replaced", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.replacenear.replaced", TextComponent.of(affected)));
return affected; return affected;
} }
@ -288,7 +287,7 @@ public class UtilityCommands {
we.checkMaxRadius(size); we.checkMaxRadius(size);
int affected = editSession.simulateSnow(session.getPlacementPosition(actor), size); int affected = editSession.simulateSnow(session.getPlacementPosition(actor), size);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.snow.created", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.snow.created", TextComponent.of(affected)));
return affected; return affected;
} }
@ -306,7 +305,7 @@ public class UtilityCommands {
we.checkMaxRadius(size); we.checkMaxRadius(size);
int affected = editSession.thaw(session.getPlacementPosition(actor), size); int affected = editSession.thaw(session.getPlacementPosition(actor), size);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.thaw.removed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.thaw.removed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -327,7 +326,7 @@ public class UtilityCommands {
final boolean onlyNormalDirt = !convertCoarse; final boolean onlyNormalDirt = !convertCoarse;
final int affected = editSession.green(session.getPlacementPosition(actor), size, onlyNormalDirt); final int affected = editSession.green(session.getPlacementPosition(actor), size, onlyNormalDirt);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.green.changed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.green.changed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -350,7 +349,7 @@ public class UtilityCommands {
Mask mask = new BlockTypeMask(editSession, BlockTypes.FIRE); Mask mask = new BlockTypeMask(editSession, BlockTypes.FIRE);
int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, size); int affected = editSession.removeNear(session.getPlacementPosition(actor), mask, size);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.extinguish.removed", affected), TextComponent.of(affected))); actor.printInfo(TranslatableComponent.of("worldedit.extinguish.removed", TextComponent.of(affected)));
return affected; return affected;
} }
@ -408,7 +407,7 @@ public class UtilityCommands {
int killed = killMatchingEntities(radius, actor, flags::createFunction); int killed = killMatchingEntities(radius, actor, flags::createFunction);
actor.printInfo(TranslatableComponent.of( actor.printInfo(TranslatableComponent.of(
pluraliseI18n("worldedit.butcher.killed", killed), "worldedit.butcher.killed",
TextComponent.of(killed), TextComponent.of(killed),
TextComponent.of(radius) TextComponent.of(radius)
)); ));
@ -434,7 +433,7 @@ public class UtilityCommands {
} }
int removed = killMatchingEntities(radius, actor, remover::createFunction); int removed = killMatchingEntities(radius, actor, remover::createFunction);
actor.printInfo(TranslatableComponent.of(pluraliseI18n("worldedit.remove.removed", removed), TextComponent.of(removed))); actor.printInfo(TranslatableComponent.of("worldedit.remove.removed", TextComponent.of(removed)));
return removed; return removed;
} }

View File

@ -345,11 +345,11 @@ public class ForwardExtentCopy implements Operation {
@Override @Override
public Iterable<Component> getStatusMessages() { public Iterable<Component> getStatusMessages() {
List<Component> messages = new ArrayList<>(); List<Component> messages = new ArrayList<>();
messages.add(TranslatableComponent.of(pluraliseI18n("worldedit.operation.affected.block", affectedBlocks), messages.add(TranslatableComponent.of("worldedit.operation.affected.block",
TextComponent.of(affectedBlocks)).color(TextColor.LIGHT_PURPLE)); TextComponent.of(affectedBlocks)).color(TextColor.LIGHT_PURPLE));
messages.add(TranslatableComponent.of(pluraliseI18n("worldedit.operation.affected.biome", affectedBiomeCols), messages.add(TranslatableComponent.of("worldedit.operation.affected.biome",
TextComponent.of(affectedBiomeCols)).color(TextColor.LIGHT_PURPLE)); TextComponent.of(affectedBiomeCols)).color(TextColor.LIGHT_PURPLE));
messages.add(TranslatableComponent.of(pluraliseI18n("worldedit.operation.affected.entity", affectedEntities), messages.add(TranslatableComponent.of("worldedit.operation.affected.entity",
TextComponent.of(affectedEntities)).color(TextColor.LIGHT_PURPLE)); TextComponent.of(affectedEntities)).color(TextColor.LIGHT_PURPLE));
return messages; return messages;

View File

@ -189,7 +189,7 @@ public abstract class BreadthFirstSearch implements Operation {
@Override @Override
public Iterable<Component> getStatusMessages() { public Iterable<Component> getStatusMessages() {
return Lists.newArrayList(TranslatableComponent.of( return Lists.newArrayList(TranslatableComponent.of(
pluraliseI18n("worldedit.operation.affected.block", getAffected()), "worldedit.operation.affected.block",
TextComponent.of(getAffected()) TextComponent.of(getAffected())
).color(TextColor.LIGHT_PURPLE)); ).color(TextColor.LIGHT_PURPLE));
} }

View File

@ -86,7 +86,7 @@ public class EntityVisitor implements Operation {
@Override @Override
public Iterable<Component> getStatusMessages() { public Iterable<Component> getStatusMessages() {
return Lists.newArrayList(TranslatableComponent.of( return Lists.newArrayList(TranslatableComponent.of(
pluraliseI18n("worldedit.operation.affected.entity", getAffected()), "worldedit.operation.affected.entity",
TextComponent.of(getAffected()) TextComponent.of(getAffected())
).color(TextColor.LIGHT_PURPLE)); ).color(TextColor.LIGHT_PURPLE));
} }

View File

@ -87,7 +87,7 @@ public class FlatRegionVisitor implements Operation {
@Override @Override
public Iterable<Component> getStatusMessages() { public Iterable<Component> getStatusMessages() {
return Lists.newArrayList(TranslatableComponent.of( return Lists.newArrayList(TranslatableComponent.of(
pluraliseI18n("worldedit.operation.affected.column", getAffected()), "worldedit.operation.affected.column",
TextComponent.of(getAffected()) TextComponent.of(getAffected())
).color(TextColor.LIGHT_PURPLE)); ).color(TextColor.LIGHT_PURPLE));
} }

View File

@ -74,7 +74,7 @@ public class RegionVisitor implements Operation {
@Override @Override
public Iterable<Component> getStatusMessages() { public Iterable<Component> getStatusMessages() {
return Lists.newArrayList(TranslatableComponent.of( return Lists.newArrayList(TranslatableComponent.of(
pluraliseI18n("worldedit.operation.affected.block", getAffected()), "worldedit.operation.affected.block",
TextComponent.of(getAffected()) TextComponent.of(getAffected())
).color(TextColor.LIGHT_PURPLE)); ).color(TextColor.LIGHT_PURPLE));
} }

View File

@ -1,42 +0,0 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.util.translation;
public class LocalisationHelpers {
private LocalisationHelpers() {
}
/**
* Turn a translation key into a ".singular" or ".plural"
* depending on what the given number is.
*
* @param translationKey The base translation key
* @param number The number
* @return The key with .plural or .singular appended
*/
public static String pluraliseI18n(String translationKey, float number) {
if (number == 1) {
return translationKey + ".singular";
} else {
return translationKey + ".plural";
}
}
}

View File

@ -1,16 +1,11 @@
{ {
"worldedit.expand.description.vert": "Vertically expand the selection to world limits.", "worldedit.expand.description.vert": "Vertically expand the selection to world limits.",
"worldedit.expand.expanded.singular": "Region expanded {0} block", "worldedit.expand.expanded": "Region expanded {0} blocks",
"worldedit.expand.expanded.plural": "Region expanded {0} blocks", "worldedit.expand.expanded.vert": "Region expanded {0} blocks (top-to-bottom).",
"worldedit.expand.expanded.vert.singular": "Region expanded {0} block (top-to-bottom).",
"worldedit.expand.expanded.vert.plural": "Region expanded {0} blocks (top-to-bottom).",
"worldedit.biomeinfo.lineofsight.singular": "Biome at line of sight point: {0}", "worldedit.biomeinfo.lineofsight": "Biomes at line of sight point: {0}",
"worldedit.biomeinfo.lineofsight.plural": "Biomes at line of sight point: {0}", "worldedit.biomeinfo.position": "Biomes at your position: {0}",
"worldedit.biomeinfo.position.singular": "Biome at your position: {0}", "worldedit.biomeinfo.selection": "Biomes in your selection: {0}",
"worldedit.biomeinfo.position.plural": "Biomes at your position: {0}",
"worldedit.biomeinfo.selection.singular": "Biome in your selection: {0}",
"worldedit.biomeinfo.selection.plural": "Biomes in your selection: {0}",
"worldedit.bruch.radius-too-large": "Maximum allowed brush radius: {0}", "worldedit.bruch.radius-too-large": "Maximum allowed brush radius: {0}",
"worldedit.brush.apply.description": "Apply brush, apply a function to every block", "worldedit.brush.apply.description": "Apply brush, apply a function to every block",
@ -34,8 +29,7 @@
"worldedit.brush.operation.equip": "Set brush to {0}.", "worldedit.brush.operation.equip": "Set brush to {0}.",
"worldedit.brush.none.equip": "Brush unbound from your current item.", "worldedit.brush.none.equip": "Brush unbound from your current item.",
"worldedit.setbiome.changed.singular": "Biomes were changed in {0} column. You may have to rejoin your game (or close and reopen your world) to see a change.", "worldedit.setbiome.changed": "Biomes were changed in {0} columns. You may have to rejoin your game (or close and reopen your world) to see a change.",
"worldedit.setbiome.changed.plural": "Biomes were changed in {0} columns. You may have to rejoin your game (or close and reopen your world) to see a change.",
"worldedit.drawsel.disabled": "Server CUI disabled.", "worldedit.drawsel.disabled": "Server CUI disabled.",
"worldedit.drawsel.enabled": "Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32.", "worldedit.drawsel.enabled": "Server CUI enabled. This only supports cuboid regions, with a maximum size of 32x32x32.",
@ -99,37 +93,22 @@
"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.drain.drained.singular": "{0} block has been drained.", "worldedit.drain.drained": "{0} blocks have been drained.",
"worldedit.drain.drained.plural": "{0} blocks have been drained.", "worldedit.fill.created": "{0} blocks have been filled.",
"worldedit.fill.created.singular": "{0} block has been filled.", "worldedit.fillr.created": "{0} blocks have been filled.",
"worldedit.fill.created.plural": "{0} blocks have been filled.", "worldedit.fixlava.fixed": "{0} blocks have been fixed.",
"worldedit.fillr.created.singular": "{0} block has been filled.", "worldedit.fixwater.fixed": "{0} blocks have been fixed.",
"worldedit.fillr.created.plural": "{0} blocks have been filled.", "worldedit.removeabove.removed": "{0} blocks have been removed.",
"worldedit.fixlava.fixed.singular": "{0} block has been fixed.", "worldedit.removebelow.removed": "{0} blocks have been removed.",
"worldedit.fixlava.fixed.plural": "{0} blocks have been fixed.", "worldedit.removenear.removed": "{0} blocks have been removed.",
"worldedit.fixwater.fixed.singular": "{0} block has been fixed.", "worldedit.replacenear.replaced": "{0} blocks have been replaced.",
"worldedit.fixwater.fixed.plural": "{0} blocks have been fixed.", "worldedit.snow.created": "{0} surfaces have been covered.",
"worldedit.removeabove.removed.singular": "{0} block has been removed.", "worldedit.thaw.removed": "{0} blocks have been thawed.",
"worldedit.removeabove.removed.plural": "{0} blocks have been removed.", "worldedit.green.changed": "{0} blocks have been greened.",
"worldedit.removebelow.removed.singular": "{0} block has been removed.", "worldedit.extinguish.removed": "{0} fires have been extinguished.",
"worldedit.removebelow.removed.plural": "{0} blocks have been removed.", "worldedit.butcher.killed": "{0} mobs have been killed in a radius of {1}.",
"worldedit.removenear.removed.singular": "{0} block has been removed.",
"worldedit.removenear.removed.plural": "{0} blocks have been removed.",
"worldedit.replacenear.replaced.singular": "{0} block has been replaced.",
"worldedit.replacenear.replaced.plural": "{0} blocks have been replaced.",
"worldedit.snow.created.singular": "{0} surface has been covered.",
"worldedit.snow.created.plural": "{0} surfaces have been covered.",
"worldedit.thaw.removed.singular": "{0} block has been thawed.",
"worldedit.thaw.removed.plural": "{0} blocks have been thawed.",
"worldedit.green.changed.singular": "{0} block has been greened.",
"worldedit.green.changed.plural": "{0} blocks have been greened.",
"worldedit.extinguish.removed.singular": "{0} fire has been extinguished.",
"worldedit.extinguish.removed.plural": "{0} fires have been extinguished.",
"worldedit.butcher.killed.singular": "{0} mob has been killed in a radius of {1}.",
"worldedit.butcher.killed.plural": "{0} mobs have been killed in a radius of {1}.",
"worldedit.butcher.explain-all": "Use -1 to remove all mobs in loaded chunks", "worldedit.butcher.explain-all": "Use -1 to remove all mobs in loaded chunks",
"worldedit.remove.removed.singular": "{0} entity has been marked for removal.", "worldedit.remove.removed": "{0} entities have been marked for removal.",
"worldedit.remove.removed.plural": "{0} entities have been marked for removal.",
"worldedit.remove.explain-all": "Use -1 to remove all entities in loaded chunks", "worldedit.remove.explain-all": "Use -1 to remove all entities in loaded chunks",
"worldedit.calc.invalid": "'{0}' could not be parsed as a valid expression", "worldedit.calc.invalid": "'{0}' could not be parsed as a valid expression",
@ -142,47 +121,30 @@
"worldedit.set.done": "Operation completed.", "worldedit.set.done": "Operation completed.",
"worldedit.set.done.verbose": "Operation completed ({0}).", "worldedit.set.done.verbose": "Operation completed ({0}).",
"worldedit.line.changed.singular": "{0} block has been changed.", "worldedit.line.changed": "{0} blocks have been changed.",
"worldedit.line.changed.plural": "{0} blocks have been changed.",
"worldedit.line.cuboid-only": "//line only works with cuboid selections", "worldedit.line.cuboid-only": "//line only works with cuboid selections",
"worldedit.curve.changed.singular": "{0} block has been changed.", "worldedit.curve.changed": "{0} blocks have been changed.",
"worldedit.curve.changed.plural": "{0} blocks have been changed.",
"worldedit.curve.convex-only": "//curve only works with convex polyhedral selections", "worldedit.curve.convex-only": "//curve only works with convex polyhedral selections",
"worldedit.replace.replaced.singular": "{0} block has been replaced.", "worldedit.replace.replaced": "{0} blocks have been replaced.",
"worldedit.replace.replaced.plural": "{0} blocks have been replaced.", "worldedit.stack.changed": "{0} blocks changed. Undo with //undo",
"worldedit.stack.changed.singular": "{0} block changed. Undo with //undo",
"worldedit.stack.changed.plural": "{0} blocks changed. Undo with //undo",
"worldedit.regen.regenerated": "Region regenerated.", "worldedit.regen.regenerated": "Region regenerated.",
"worldedit.walls.changed.singular": "{0} block has been changed.", "worldedit.walls.changed": "{0} blocks have been changed.",
"worldedit.walls.changed.plural": "{0} blocks have been changed.", "worldedit.faces.changed": "{0} blocks have been changed.",
"worldedit.faces.changed.singular": "{0} block has been changed.", "worldedit.overlay.overlaid": "{0} blocks have been overlaid.",
"worldedit.faces.changed.plural": "{0} blocks have been changed.", "worldedit.naturalize.naturalized": "{0} block(s) have been made to look more natural.",
"worldedit.overlay.overlaid.singular": "{0} block has been overlaid.", "worldedit.center.changed": "Center set. ({0} blocks changed)",
"worldedit.overlay.overlaid.plural": "{0} blocks have been overlaid.", "worldedit.smooth.changed": "Terrain's height map smoothed. {0} blocks changed.",
"worldedit.naturalize.naturalized.singular": "{0} block has been made to look more natural.", "worldedit.move.moved": "{0} blocks moved.",
"worldedit.naturalize.naturalized.plural": "{0} block(s) have been made to look more natural.", "worldedit.deform.deformed": "{0} blocks have been deformed.",
"worldedit.center.changed.singular": "Center set. ({0} block changed)", "worldedit.hollow.changed": "{0} blocks have been changed.",
"worldedit.center.changed.plural": "Center set. ({0} blocks changed)", "worldedit.forest.created": "{0} trees created.",
"worldedit.smooth.changed.singular": "Terrain's height map smoothed. {0} block changed.", "worldedit.flora.created": "{0} flora created.",
"worldedit.smooth.changed.plural": "Terrain's height map smoothed. {0} blocks changed.",
"worldedit.move.moved.singular": "{0} block moved.",
"worldedit.move.moved.plural": "{0} blocks moved.",
"worldedit.deform.deformed.singular": "{0} block has been deformed.",
"worldedit.deform.deformed.plural": "{0} blocks have been deformed.",
"worldedit.hollow.changed.singular": "{0} block has been changed.",
"worldedit.hollow.changed.plural": "{0} blocks have been changed.",
"worldedit.forest.created.singular": "{0} tree created.",
"worldedit.forest.created.plural": "{0} trees created.",
"worldedit.flora.created.singular": "{0} flora created.",
"worldedit.flora.created.plural": "{0} flora created.",
"worldedit.unstuck.moved": "There you go!", "worldedit.unstuck.moved": "There you go!",
"worldedit.ascend.obstructed": "No free spot above you found.", "worldedit.ascend.obstructed": "No free spot above you found.",
"worldedit.ascend.moved.singular": "Ascended a level.", "worldedit.ascend.moved": "Ascended {0} levels.",
"worldedit.ascend.moved.plural": "Ascended {0} levels.",
"worldedit.descend.obstructed": "No free spot below you found.", "worldedit.descend.obstructed": "No free spot below you found.",
"worldedit.descend.moved.singular": "Descended a level.", "worldedit.descend.moved": "Descended {0} levels.",
"worldedit.descend.moved.plural": "Descended {0} levels.",
"worldedit.ceil.obstructed": "No free spot above you found.", "worldedit.ceil.obstructed": "No free spot above you found.",
"worldedit.ceil.moved": "Woosh!", "worldedit.ceil.moved": "Woosh!",
"worldedit.thru.obstructed": "No free spot ahead of you found.", "worldedit.thru.obstructed": "No free spot ahead of you found.",
@ -193,21 +155,14 @@
"worldedit.up.moved": "Woosh!", "worldedit.up.moved": "Woosh!",
"worldedit.cyl.invalid-radius": "You must either specify 1 or 2 radius values.", "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": "{0} blocks have 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.invalid-radius": "You must either specify 1 or 3 radius values.",
"worldedit.sphere.created.singular": "{0} block has been created.", "worldedit.sphere.created": "{0} blocks have been created.",
"worldedit.sphere.created.plural": "{0} blocks have been created.", "worldedit.forestgen.created": "{0} trees created.",
"worldedit.forestgen.created.singular": "{0} tree created.", "worldedit.pumpkins.created": "{0} pumpkin patches created.",
"worldedit.forestgen.created.plural": "{0} trees created.", "worldedit.pyramid.created": "{0} blocks have been created.",
"worldedit.pumpkins.created.singular": "{0} pumpkin patch created.", "worldedit.generate.created": "{0} blocks have been created.",
"worldedit.pumpkins.created.plural": "{0} pumpkin patches created.", "worldedit.generate.changed": "{0} columns affected.",
"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.reload.config": "Configuration reloaded!",
"worldedit.report.written": "WorldEdit report written to {0}", "worldedit.report.written": "WorldEdit report written to {0}",
@ -253,14 +208,10 @@
"worldedit.superpickaxe.mode.recursive": "Mode is now recursive. 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.superpickaxe.max-range": "Maximum range is {0}.",
"worldedit.operation.affected.biome.singular": "{0} biome affected", "worldedit.operation.affected.biome": "{0} biomes affected",
"worldedit.operation.affected.biome.plural": "{0} biomes affected", "worldedit.operation.affected.block": "{0} blocks affected",
"worldedit.operation.affected.block.singular": "{0} block affected", "worldedit.operation.affected.column": "{0} columns affected",
"worldedit.operation.affected.block.plural": "{0} blocks affected", "worldedit.operation.affected.entity": "{0} entities affected",
"worldedit.operation.affected.column.singular": "{0} column affected",
"worldedit.operation.affected.column.plural": "{0} columns affected",
"worldedit.operation.affected.entity.singular": "{0} entity affected",
"worldedit.operation.affected.entity.plural": "{0} entities affected",
"worldedit.operation.deform.expression": "deformed using {0}", "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."