Finish up transition to captions

This commit is contained in:
NotMyFault 2021-04-04 19:56:57 +02:00
parent 7b9e8a0d79
commit a9d1202ce1
36 changed files with 259 additions and 128 deletions

View File

@ -97,7 +97,7 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements
@Override
public void print(Component component) {
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
TextAdapter.sendMessage(sender, WorldEditText.format(component, getLocale()));
}
@Override

View File

@ -100,7 +100,7 @@ public class BukkitCommandSender extends AbstractNonPlayerActor {
@Override
public void print(Component component) {
TextAdapter.sendComponent(sender, WorldEditText.format(component, getLocale()));
TextAdapter.sendMessage(sender, WorldEditText.format(component, getLocale()));
}
@Override

View File

@ -204,7 +204,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
@Override
public void print(Component component) {
component = Caption.color(TranslatableComponent.of("prefix", component), getLocale());
TextAdapter.sendComponent(player, component);
TextAdapter.sendMessage(player, WorldEditText.format(component, getLocale()));
}
@Override

View File

@ -20,6 +20,7 @@
package com.sk89q.worldedit.bukkit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
/**
* Thrown if the world has been unloaded.
@ -30,6 +31,6 @@ class WorldUnloadedException extends WorldEditException {
* Create a new instance.
*/
WorldUnloadedException() {
super("The world was unloaded already");
super(TranslatableComponent.of("worldedit.error.world-unloaded"));
}
}

View File

@ -1,6 +1,7 @@
package com.boydti.fawe.command;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.lang.reflect.InvocationTargetException;
import java.util.List;

View File

@ -9,6 +9,7 @@ import com.sk89q.worldedit.function.visitor.RecursiveVisitor;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.AbstractRegion;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import org.jetbrains.annotations.NotNull;
@ -105,12 +106,12 @@ public class FuzzyRegion extends AbstractRegion {
@Override
public void expand(BlockVector3... changes) throws RegionOperationException {
throw new RegionOperationException("Selection cannot expand");
throw new RegionOperationException(TranslatableComponent.of("fawe.error.selection-expand"));
}
@Override
public void contract(BlockVector3... changes) throws RegionOperationException {
throw new RegionOperationException("Selection cannot contract");
throw new RegionOperationException(TranslatableComponent.of("fawe.error.selection-contract"));
}
@Override
@ -120,7 +121,7 @@ public class FuzzyRegion extends AbstractRegion {
@Override
public void shift(BlockVector3 change) throws RegionOperationException {
throw new RegionOperationException("Selection cannot be shifted");
throw new RegionOperationException(TranslatableComponent.of("fawe.error.selection-shift"));
}
public void setExtent(EditSession extent) {

View File

@ -240,11 +240,11 @@ public class EditSessionBuilder {
}
if (Settings.IMP.EXTENT.DEBUG) {
if (event.getActor() != null) {
event.getActor().printDebug("Potentially unsafe extent blocked: " + toReturn.getClass().getName());
event.getActor().printDebug(" - For area restrictions, it is recommended to use the FaweAPI");
event.getActor().printDebug(" - For block logging, it is recommended to use BlocksHub");
event.getActor().printDebug(" - To allow this plugin add it to the FAWE `allowed-plugins` list");
event.getActor().printDebug(" - To hide this message set `debug` to false in the FAWE config.yml");
event.getActor().printDebug(TranslatableComponent.of("Potentially unsafe extent blocked: " + toReturn.getClass().getName()));
event.getActor().printDebug(TranslatableComponent.of(" - For area restrictions, it is recommended to use the FaweAPI"));
event.getActor().printDebug(TranslatableComponent.of(" - For block logging, it is recommended to use BlocksHub"));
event.getActor().printDebug(TranslatableComponent.of(" - To allow this plugin add it to the FAWE `allowed-plugins` list"));
event.getActor().printDebug(TranslatableComponent.of(" - To hide this message set `debug` to false in the FAWE config.yml"));
} else {
LOGGER.debug("Potentially unsafe extent blocked: " + toReturn.getClass().getName());
LOGGER.debug(" - For area restrictions, it is recommended to use the FaweAPI");

View File

@ -6,6 +6,9 @@ import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.platform.binding.ProvideBindings;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.w3c.dom.Text;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
@ -172,7 +175,7 @@ public class ImageUtil {
try {
return MainUtil.readImage(getInputStream(uri));
} catch (IOException e) {
throw new InputParseException(e.getMessage());
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
}
}
@ -185,7 +188,7 @@ public class ImageUtil {
}
return new URL(uriStr).openStream();
} catch (IOException e) {
throw new InputParseException(e.getMessage());
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
}
}
@ -208,9 +211,9 @@ public class ImageUtil {
Settings.IMP.PATHS.HEIGHTMAP), arg);
return MainUtil.readImage(file);
}
throw new InputParseException("Invalid image " + arg);
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-image", TextComponent.of(arg)));
} catch (IOException e) {
throw new InputParseException(e.getMessage());
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
}
}
@ -227,16 +230,16 @@ public class ImageUtil {
File file = MainUtil.getFile(MainUtil.getFile(Fawe.imp().getDirectory(),
Settings.IMP.PATHS.HEIGHTMAP), arg);
if (!file.exists()) {
throw new InputParseException("File not found " + file);
throw new InputParseException(TranslatableComponent.of("fawe.error.file-not-found", TextComponent.of(String.valueOf(file))));
}
if (file.isDirectory()) {
throw new InputParseException("File is a directory " + file);
throw new InputParseException(TranslatableComponent.of("fawe.error.file-is-invalid-directory", TextComponent.of(String.valueOf(file))));
}
return file.toURI();
}
throw new InputParseException("Invalid image " + arg);
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-image", TextComponent.of(arg)));
} catch (IOException | URISyntaxException e) {
throw new InputParseException(e.getMessage());
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
}
}
}

View File

@ -315,7 +315,7 @@ public final class WorldEdit {
}
if (f == null) {
throw new FileSelectionAbortedException("No file selected");
throw new FileSelectionAbortedException(TranslatableComponent.of("worldedit.error.no-file-selected"));
}
} else {
List<String> exts = extensions == null ? ImmutableList.of(defaultExt) : Lists.asList(defaultExt, extensions);
@ -334,12 +334,12 @@ public final class WorldEdit {
boolean isSym = existingParent != null && !existingParent.toRealPath().equals(existingParent);
if (!inDir || (!getConfiguration().allowSymlinks && isSym)) {
throw new FilenameResolutionException(filename, "Path is outside allowable root");
throw new FilenameResolutionException(filename, TranslatableComponent.of("worldedit.error.file-resolution.outside-root"));
}
return filePath.toFile();
} catch (IOException e) {
throw new FilenameResolutionException(filename, "Failed to resolve path");
throw new FilenameResolutionException(filename, TranslatableComponent.of("worldedit.error.file-resolution.resolve-failed"));
}
}
@ -366,7 +366,7 @@ public final class WorldEdit {
result = getSafeFileWithExtension(dir, filename, iter.next());
}
if (result == null) {
throw new InvalidFilenameException(filename, "Invalid characters or extension missing");
throw new InvalidFilenameException(filename, TranslatableComponent.of("worldedit.error.invalid-filename.invalid-characters"));
}
return result;
}

View File

@ -50,6 +50,7 @@ import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
import com.sk89q.worldedit.internal.command.CommandUtil;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
import com.sk89q.worldedit.util.auth.AuthorizationException;
import com.sk89q.worldedit.util.formatting.component.PaginationBox;
import com.sk89q.worldedit.util.formatting.component.SideEffectBox;
import com.sk89q.worldedit.util.formatting.text.Component;
@ -323,7 +324,7 @@ public class GeneralCommands {
@Arg(desc = "The new draw selection state", def = "")
Boolean drawSelection) throws WorldEditException {
if (!WorldEdit.getInstance().getConfiguration().serverSideCUI) {
throw new DisallowedUsageException("This functionality is disabled in the configuration!");
throw new AuthorizationException(TranslatableComponent.of("worldedit.error.disabled"));
}
boolean useServerCui = session.shouldUseServerCUI();
if (drawSelection != null && drawSelection == useServerCui) {
@ -508,7 +509,7 @@ public class GeneralCommands {
int min = Integer.parseInt(arguments.get(0));
int max = Integer.parseInt(arguments.get(1));
if (min < 0 || max > 100) {
throw new InputParseException("Complexity must be in the range 0-100");
throw new InputParseException(TranslatableComponent.of("fawe.error.too-simple"));
}
if (min != 0 || max != 100) {
util = new CleanTextureUtil(util, min, max);

View File

@ -341,10 +341,10 @@ public class HistorySubCommands {
return;
}
if (other == null && radius == 0 && timeDiff == 0) {
throw new InsufficientArgumentsException("User must be provided");
throw new InsufficientArgumentsException(TranslatableComponent.of("fawe.error.invalid-user"));
}
checkCommandArgument(radius > 0, "Radius must be >= 0");
checkCommandArgument(timeDiff > 0, "Time must be >= 0");
checkCommandArgument(radius > 0, TranslatableComponent.of("fawe.error.radius-too-small"));
checkCommandArgument(timeDiff > 0, TranslatableComponent.of("fawe.error.time-too-less"));
Location origin = player.getLocation();
String pageCommand = "/" + arguments.get().replaceAll("-p [0-9]+", "").trim();

View File

@ -47,6 +47,7 @@ import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
import org.w3c.dom.Text;
import java.io.File;
import java.io.IOException;
@ -163,13 +164,11 @@ public class WorldEditCommands {
Map<Thread, StackTraceElement[]> stacks = Thread.getAllStackTraces();
for (Map.Entry<Thread, StackTraceElement[]> entry : stacks.entrySet()) {
Thread thread = entry.getKey();
actor.printDebug(
"--------------------------------------------------------------------------------------------");
actor.printDebug(
"Thread: " + thread.getName() + " | Id: " + thread.getId() + " | Alive: " + thread
.isAlive());
actor.printDebug(TranslatableComponent.of(
"--------------------------------------------------------------------------------------------"));
actor.printDebug("Thread: " + thread.getName() + " | Id: " + thread.getId() + " | Alive: " + thread.isAlive());
for (StackTraceElement elem : entry.getValue()) {
actor.printDebug(elem.toString());
actor.printDebug(TranslatableComponent.of(elem.toString()));
}
}
}

View File

@ -46,6 +46,8 @@ import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
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.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -429,12 +431,12 @@ public interface Player extends Entity, Actor {
getSession().setClipboard(holder);
}
} catch (Exception event) {
printError("====== INVALID CLIPBOARD ======");
printError(TranslatableComponent.of("====== INVALID CLIPBOARD ======"));
event.printStackTrace();
printError("===============---=============");
printError("This shouldn't result in any failure");
printError("File: " + file.getName() + " (len:" + file.length() + ")");
printError("===============---=============");
printError(TranslatableComponent.of("fawe.error.stacktrace"));
printError(TranslatableComponent.of("fawe.error.no-failure"));
printError(TranslatableComponent.of("File: ", TextComponent.of(file.getName()), TextComponent.of(" (len:"), TextComponent.of(file.length()), TextComponent.of(")")));
printError(TranslatableComponent.of("fawe.error.stacktrace"));
}
}
}

View File

@ -48,6 +48,8 @@ import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
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.BlockCategories;
@ -80,12 +82,15 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
try {
return ((Player) actor).getBlockInHand(handSide);
} catch (NotABlockException e) {
throw new InputParseException("You're not holding a block!");
throw new InputParseException(e.getRichMessage());
} catch (WorldEditException e) {
throw new InputParseException("Unknown error occurred: " + e.getMessage(), e);
throw new InputParseException(TranslatableComponent.of("worldedit.error.unknown", e.getRichMessage()), e);
}
} else {
throw new InputParseException("The user is not a player!");
throw new InputParseException(TranslatableComponent.of(
"worldedit.error.parser.player-only",
TextComponent.of(handSide == HandSide.MAIN_HAND ? "hand" : "offhand")
));
}
}
@ -175,35 +180,51 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
try {
String[] parts = parseableData.split("=");
if (parts.length != 2) {
throw new NoMatchException("Bad state format in " + parseableData);
throw new InputParseException(
TranslatableComponent.of("worldedit.error.parser.bad-state-format",
TextComponent.of(parseableData))
);
}
@SuppressWarnings("unchecked")
Property<Object> propertyKey = (Property<Object>) type.getPropertyMap().get(parts[0]);
if (propertyKey == null) {
if (context.getActor() != null) {
throw new NoMatchException("Unknown property " + parts[0] + " for block " + type.getId());
throw new NoMatchException(TranslatableComponent.of(
"worldedit.error.parser.unknown-property",
TextComponent.of(parts[0]),
TextComponent.of(type.getId())
));
} else {
WorldEdit.logger.debug("Unknown property " + parts[0] + " for block " + type.getId());
}
return Maps.newHashMap();
}
if (blockStates.containsKey(propertyKey)) {
throw new NoMatchException("Duplicate property " + parts[0]);
throw new InputParseException(TranslatableComponent.of(
"worldedit.error.parser.duplicate-property",
TextComponent.of(parts[0])
));
}
Object value;
try {
value = propertyKey.getValueFor(parts[1]);
} catch (IllegalArgumentException e) {
throw new NoMatchException("Unknown value " + parts[1] + " for state " + parts[0]);
throw new NoMatchException(TranslatableComponent.of(
"worldedit.error.parser.unknown-value",
TextComponent.of(parts[1]),
TextComponent.of(propertyKey.getName())
));
}
blockStates.put(propertyKey, value);
} catch (NoMatchException e) {
throw e; // Pass-through
} catch (Exception e) {
WorldEdit.logger.warn("Unknown state '" + parseableData + "'", e);
throw new NoMatchException("Unknown state '" + parseableData + "'");
throw new InputParseException(TranslatableComponent.of(
"worldedit.error.parser.bad-state-format",
TextComponent.of(parseableData)
));
}
}
}
@ -243,14 +264,14 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
try {
String[] split = blockAndExtraData[0].split(":", 2);
if (split.length == 0) {
throw new InputParseException("Invalid colon.");
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-colon"));
} else if (split.length == 1) {
state = LegacyMapper.getInstance().getBlockFromLegacy(Integer.parseInt(split[0]));
} else if (MathMan.isInteger(split[0])) {
int id = Integer.parseInt(split[0]);
int data = Integer.parseInt(split[1]);
if (data < 0 || data >= 16) {
throw new InputParseException("Invalid data " + data);
throw new InputParseException(TranslatableComponent.of("fawe.error.parser.invalid-data", TextComponent.of(data)));
}
state = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
} else {
@ -258,7 +279,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
if (type != null) {
int data = Integer.parseInt(split[1]);
if (data < 0 || data >= 16) {
throw new InputParseException("Invalid data " + data);
throw new InputParseException(TranslatableComponent.of("fawe.error.parser.invalid-data", TextComponent.of(data)));
}
state = LegacyMapper.getInstance().getBlockFromLegacy(type.getLegacyCombinedId() >> 4, data);
}
@ -277,11 +298,11 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
} else {
typeString = blockAndExtraData[0].substring(0, stateStart);
if (stateStart + 1 >= blockAndExtraData[0].length()) {
throw new InputParseException("Invalid format. Hanging bracket @ " + stateStart + ".");
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.hanging-lbracket", TextComponent.of(stateStart)));
}
int stateEnd = blockAndExtraData[0].lastIndexOf(']');
if (stateEnd < 0) {
throw new InputParseException("Invalid format. Unclosed property.");
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-rbracket"));
}
stateString = blockAndExtraData[0].substring(stateStart + 1, blockAndExtraData[0].length() - 1);
}
@ -290,7 +311,10 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
stateProperties = stateString.split(",");
}
if (typeString.isEmpty()) {
throw new InputParseException("Invalid format");
throw new InputParseException(TranslatableComponent.of(
"worldedit.error.parser.bad-state-format",
TextComponent.of(blockAndExtraData[0])
));
}
if ("hand".equalsIgnoreCase(typeString)) {
// Get the block type from the item in the user's hand.
@ -310,25 +334,25 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
try {
primaryPosition = context.requireSession().getRegionSelector(world).getVertices().get(index - 1);
} catch (IncompleteRegionException e) {
throw new InputParseException("Your selection is not complete.");
throw new InputParseException(TranslatableComponent.of("worldedit.error.incomplete-region"));
}
state = world.getBlock(primaryPosition);
} else if (typeString.matches("slot[0-9]+")) {
int slot = Integer.parseInt(typeString.substring(4)) - 1;
Actor actor = context.requireActor();
if (!(actor instanceof Player)) {
throw new InputParseException("The user is not a player!");
throw new InputParseException(TranslatableComponent.of("worldedit.command.player-only"));
}
Player player = (Player) actor;
BlockBag bag = player.getInventoryBlockBag();
if (!(bag instanceof SlottableBlockBag)) {
throw new InputParseException("Unsupported!");
throw new InputParseException(TranslatableComponent.of("fawe.error.unsupported"));
}
SlottableBlockBag slottable = (SlottableBlockBag) bag;
BaseItem item = slottable.getItem(slot);
if (!item.getType().hasBlockType()) {
throw new InputParseException("You're not holding a block!");
throw new InputParseException(TranslatableComponent.of("worldedit.error.not-a-block"));
}
state = item.getType().getBlockType().getDefaultState();
nbt = item.getNbtData();
@ -339,8 +363,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
state = type.getDefaultState();
}
if (state == null) {
throw new NoMatchException(
"Does not match a valid block type: '" + input + "'");
throw new NoMatchException(TranslatableComponent.of("fawe.error.invalid-block-type", TextComponent.of(input)));
}
}
if (nbt == null) {
@ -371,7 +394,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
}
// this should be impossible but IntelliJ isn't that smart
if (state == null) {
throw new NoMatchException("Does not match a valid block type: '" + input + "'");
throw new NoMatchException(TranslatableComponent.of("fawe.error.invalid-block-type", TextComponent.of(input)));
}
if (blockAndExtraData.length > 1 && blockAndExtraData[1].startsWith("{")) {
@ -379,7 +402,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
try {
nbt = JSON2NBT.getTagFromJson(joined);
} catch (NBTException e) {
throw new NoMatchException(e.getMessage());
throw new NoMatchException(TranslatableComponent.of(e.getMessage()));
}
}
@ -390,7 +413,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
Actor actor = context.requireActor();
if (actor != null && !actor.hasPermission("worldedit.anyblock")
&& worldEdit.getConfiguration().disallowedBlocks.contains(blockType.getId())) {
throw new DisallowedUsageException("You are not allowed to use '" + input + "'");
throw new DisallowedUsageException(TranslatableComponent.of("fawe.error.block.not.allowed", TextComponent.of(input)));
}
}
@ -413,11 +436,11 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
String mobName = blockAndExtraData[1];
EntityType ent = EntityTypes.get(mobName.toLowerCase(Locale.ROOT));
if (ent == null) {
throw new NoMatchException("Unknown entity type '" + mobName + "'");
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-entity", TextComponent.of(mobName)));
}
mobName = ent.getId();
if (!worldEdit.getPlatformManager().queryCapability(Capability.USER_COMMANDS).isValidMobType(mobName)) {
throw new NoMatchException("Unknown mob type '" + mobName + "'");
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-mob", TextComponent.of(mobName)));
}
return validate(context, new MobSpawnerBlock(state, mobName));
} else {
@ -442,12 +465,12 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
if (context.isRestricted()) {
Actor actor = context.requireActor();
if (!actor.hasPermission("worldedit.anyblock") && worldEdit.getConfiguration().checkDisallowedBlocks(holder)) {
throw new DisallowedUsageException(Caption.toString(Caption.of("fawe.error.block.not.allowed", holder)));
throw new DisallowedUsageException(TranslatableComponent.of("fawe.error.block.not.allowed", TextComponent.of(String.valueOf(holder))));
}
CompoundTag nbt = holder.getNbtData();
if (nbt != null) {
if (!actor.hasPermission("worldedit.anyblock")) {
throw new DisallowedUsageException("You are not allowed to use nbt'");
throw new DisallowedUsageException(TranslatableComponent.of("fawe.error.nbt.forbidden"));
}
}
}

View File

@ -29,6 +29,8 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
@ -56,7 +58,7 @@ public class DefaultItemParser extends InputParser<BaseItem> {
String[] split = input.split(":");
ItemType type;
if (split.length == 0) {
throw new InputParseException("Invalid colon.");
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-colon"));
} else if (split.length == 1) {
type = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]));
} else {
@ -83,7 +85,7 @@ public class DefaultItemParser extends InputParser<BaseItem> {
}
if (item == null) {
throw new InputParseException("'" + input + "' did not match any item");
throw new InputParseException(TranslatableComponent.of("worldedit.error.unknown-item", TextComponent.of(input)));
} else {
return item;
}
@ -93,7 +95,10 @@ public class DefaultItemParser extends InputParser<BaseItem> {
if (actor instanceof Player) {
return ((Player) actor).getItemInHand(handSide);
} else {
throw new InputParseException("The user is not a player!");
throw new InputParseException(TranslatableComponent.of(
"worldedit.error.parser.player-only",
TextComponent.of(handSide == HandSide.MAIN_HAND ? "hand" : "offhand")
));
}
}

View File

@ -5,6 +5,8 @@ import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@ -141,7 +143,7 @@ public abstract class RichParser<E> extends InputParser<E> {
arguments.add(input.substring(openIndex + 1));
}
if (requireClosing && open != 0) {
throw new InputParseException("Invalid bracketing, are you missing a '[' or ']'?");
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-bracketing", TextComponent.of("'[' or ']'?")));
}
return arguments.toArray(new String[0]);
}

View File

@ -26,6 +26,8 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.BlockCategoryMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.block.BlockCategory;
import java.util.Locale;
@ -51,7 +53,7 @@ public class BlockCategoryMaskParser extends InputParser<Mask> {
// This means it's a tag mask.
BlockCategory category = BlockCategory.REGISTRY.get(input.substring(2).toLowerCase(Locale.ROOT));
if (category == null) {
throw new InputParseException("Unrecognised tag '" + input.substring(2) + '\'');
throw new InputParseException(TranslatableComponent.of("fawe.error.unrecognised-tag", TextComponent.of(input.substring(2)), TextComponent.of("\\")));
} else {
return new BlockCategoryMask(context.requireExtent(), category);
}

View File

@ -26,6 +26,8 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.BlockStateMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.util.stream.Stream;
@ -56,7 +58,7 @@ public class BlockStateMaskParser extends InputParser<Mask> {
Splitter.on(',').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(states),
strict);
} catch (Exception e) {
throw new InputParseException("Invalid states.", e);
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-states", TextComponent.of(String.valueOf(e))));
}
}
}

View File

@ -30,6 +30,8 @@ import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment;
import com.sk89q.worldedit.session.SessionOwner;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.util.function.IntSupplier;
import java.util.stream.Stream;
@ -66,7 +68,7 @@ public class ExpressionMaskParser extends InputParser<Mask> {
}
return new ExpressionMask(exp);
} catch (ExpressionException e) {
throw new InputParseException("Invalid expression: " + e.getMessage());
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-expression", TextComponent.of(e.getMessage())));
}
}
}

View File

@ -25,6 +25,7 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.Masks;
import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.util.stream.Stream;
@ -54,7 +55,7 @@ public class NegateMaskParser extends InputParser<Mask> {
if (input.length() > 1) {
return Masks.negate(worldEdit.getMaskFactory().parseFromInput(input.substring(1), context));
} else {
throw new InputParseException("Can't negate nothing!");
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.negate-nothing"));
}
}
}

View File

@ -27,6 +27,7 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.RegionMask;
import com.sk89q.worldedit.internal.registry.SimpleInputParser;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.util.List;
@ -48,7 +49,7 @@ public class RegionMaskParser extends SimpleInputParser<Mask> {
try {
return new RegionMask(context.requireSession().getSelection(context.requireWorld()).clone());
} catch (IncompleteRegionException e) {
throw new InputParseException("Please make a selection first.");
throw new InputParseException(TranslatableComponent.of("worldedit.error.incomplete-region"));
}
}
}

View File

@ -63,7 +63,7 @@ public class BiomePatternParser extends RichParser<Pattern> {
@Override
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
if (arguments.length != 1) {
throw new InputParseException("Invalid amount of arguments. Expected: #biome[<biome>]");
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-arguments", TextComponent.of("#biome[<biome>]")));
}
BiomeType biomeType = BiomeTypes.get(arguments[0]);
if (biomeType == null) {

View File

@ -26,6 +26,8 @@ import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.pattern.RandomPattern;
import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.block.BlockCategory;
import com.sk89q.worldedit.world.block.BlockType;
@ -58,13 +60,13 @@ public class BlockCategoryPatternParser extends InputParser<Pattern> {
BlockCategory category = BlockCategory.REGISTRY.get(tag);
if (category == null) {
throw new InputParseException("Unknown block tag: " + tag);
throw new InputParseException(TranslatableComponent.of("fawe.error.unknown-block-tag", TextComponent.of(tag)));
}
RandomPattern randomPattern = new RandomPattern();
Set<BlockType> blocks = category.getAll();
if (blocks.isEmpty()) {
throw new InputParseException("Block tag " + category.getId() + " had no blocks!");
throw new InputParseException(TranslatableComponent.of("fawe.error.block-tag-no-blocks", TextComponent.of(category.getId())));
}
if (anyState) {

View File

@ -30,6 +30,8 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.internal.registry.InputParser;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.util.Locale;
import java.util.stream.Stream;
@ -78,11 +80,11 @@ public class ClipboardPatternParser extends InputParser<Pattern> {
String coords = offsetParts[1];
if (coords.length() < 7 // min length of `[x,y,z]`
|| coords.charAt(0) != '[' || coords.charAt(coords.length() - 1) != ']') {
throw new InputParseException("Offset specified with @ but no offset given. Use '#copy@[x,y,z]'.");
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.clipboard.missing-offset"));
}
String[] offsetSplit = coords.substring(1, coords.length() - 1).split(",");
if (offsetSplit.length != 3) {
throw new InputParseException("Clipboard offset needs x,y,z coordinates.");
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.clipboard.missing-coordinates"));
}
offset = BlockVector3.at(
Integer.valueOf(offsetSplit[0]),
@ -97,10 +99,10 @@ public class ClipboardPatternParser extends InputParser<Pattern> {
Clipboard clipboard = holder.getClipboard();
return new ClipboardPattern(clipboard, offset);
} catch (EmptyClipboardException e) {
throw new InputParseException("To use #clipboard, please first copy something to your clipboard");
throw new InputParseException(TranslatableComponent.of("fawe.error.empty-clipboard", TextComponent.of("#clipboard")));
}
} else {
throw new InputParseException("No session is available, so no clipboard is available");
throw new InputParseException(TranslatableComponent.of("fawe.error.no-session"));
}
}

View File

@ -23,6 +23,7 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.extension.factory.MaskFactory;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import org.enginehub.piston.inject.InjectedValueAccess;
@ -156,7 +157,7 @@ public class ParserContext {
public Extent requireExtent() throws InputParseException {
Extent extent = getExtent();
if (extent == null) {
throw new InputParseException("No Extent is known");
throw new InputParseException(TranslatableComponent.of("worldedit.error.missing-extent"));
}
return extent;
}
@ -170,7 +171,7 @@ public class ParserContext {
public LocalSession requireSession() throws InputParseException {
LocalSession session = getSession();
if (session == null) {
throw new InputParseException("No LocalSession is known");
throw new InputParseException(TranslatableComponent.of("worldedit.error.missing-session"));
}
return session;
}
@ -184,7 +185,7 @@ public class ParserContext {
public World requireWorld() throws InputParseException {
World world = getWorld();
if (world == null) {
throw new InputParseException("No world is known");
throw new InputParseException(TranslatableComponent.of("worldedit.error.missing-world"));
}
return world;
}
@ -198,7 +199,7 @@ public class ParserContext {
public Actor requireActor() throws InputParseException {
Actor actor = getActor();
if (actor == null) {
throw new InputParseException("No actor is known");
throw new InputParseException(TranslatableComponent.of("worldedit.error.missing-actor"));
}
return actor;
}

View File

@ -24,6 +24,7 @@ import com.boydti.fawe.object.task.AsyncNotifyQueue;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.io.File;
import java.util.Map;
@ -70,7 +71,7 @@ public abstract class AbstractNonPlayerActor implements Actor {
throwable = throwable.getCause();
}
if (throwable instanceof WorldEditException) {
printError(throwable.getLocalizedMessage());
printError(TranslatableComponent.of(throwable.getLocalizedMessage()));
} else {
FaweException fe = FaweException.get(throwable);
if (fe != null) {

View File

@ -86,7 +86,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable {
throwable = throwable.getCause();
}
if (throwable instanceof WorldEditException) {
printError(throwable.getLocalizedMessage());
printError(TranslatableComponent.of(throwable.getLocalizedMessage()));
} else {
FaweException fe = FaweException.get(throwable);
if (fe != null) {

View File

@ -47,6 +47,7 @@ import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.eventbus.Subscribe;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import org.apache.logging.log4j.Logger;
@ -408,8 +409,8 @@ public class PlatformManager {
if (faweException != null) {
actor.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason", faweException.getComponent()));
} else {
actor.printError("Please report this error: [See console]");
actor.printRaw(e.getClass().getName() + ": " + e.getMessage());
actor.printError(TranslatableComponent.of("worldedit.command.error.report"));
actor.print(TranslatableComponent.of(e.getClass().getName(), TextComponent.of(": "), TextComponent.of(e.getMessage())));
e.printStackTrace();
}
}
@ -463,8 +464,8 @@ public class PlatformManager {
if (faweException != null) {
player.print(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason", faweException.getComponent()));
} else {
player.printError("Please report this error: [See console]");
player.printRaw(e.getClass().getName() + ": " + e.getMessage());
player.printError(TranslatableComponent.of("worldedit.command.error.report"));
player.print(TranslatableComponent.of(e.getClass().getName() + ": " + e.getMessage()));
e.printStackTrace();
}
} finally {

View File

@ -20,6 +20,8 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Identifiable;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
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;
@ -114,7 +116,7 @@ public class ConsumeBindings extends Bindings {
uuid = Fawe.imp().getUUID(argument);
}
if (uuid == null) {
throw new InputParseException(Caption.toString(Caption.of("fawe.error.player.not.found", argument)));
throw new InputParseException(TranslatableComponent.of("fawe.error.player.not.found", TextComponent.of(argument)));
}
return uuid;
}
@ -154,7 +156,7 @@ public class ConsumeBindings extends Bindings {
try {
return getWorldEdit().getBlockFactory().parseFromInput(argument, parserContext);
} catch (NoMatchException e) {
throw new InputParseException(e.getMessage());
throw new InputParseException(TranslatableComponent.of(e.getMessage()));
}
}
}

View File

@ -42,7 +42,7 @@ public class ProvideBindings extends Bindings {
if (actor.isPlayer()) {
return (Player) actor;
}
throw new InputParseException("This command must be used with a player.");
throw new InputParseException(TranslatableComponent.of("worldedit.command.player-only"));
}
@Binding

View File

@ -544,7 +544,7 @@ public interface Extent extends InputExtent, OutputExtent {
* @return the number of blocks that matched the mask
*/
default int countBlocks(Region region, Mask searchMask) {
RegionVisitor visitor = new RegionVisitor(region, position -> searchMask.test(position));
RegionVisitor visitor = new RegionVisitor(region, searchMask::test);
Operations.completeBlindly(visitor);
return visitor.getAffected();
}

View File

@ -34,6 +34,8 @@ import com.google.common.io.Files;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import java.io.File;
import java.io.IOException;
@ -208,7 +210,7 @@ public class ClipboardFormats {
f = player.openFileOpenDialog(extensions);
if (f == null || !f.exists()) {
if (message) {
player.printError("Schematic " + input + " does not exist! (" + f + ")");
player.printError(TranslatableComponent.of("worldedit.schematic.load.does-not-exist", TextComponent.of(input)));
}
return null;
}

View File

@ -10,6 +10,8 @@ import com.sk89q.worldedit.registry.state.AbstractProperty;
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.registry.state.PropertyKey;
import com.sk89q.worldedit.registry.state.PropertyKeySet;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
@ -125,7 +127,7 @@ public class BlockMaskBuilder {
}
}
if (blockTypeList.isEmpty()) {
throw new InputParseException("No block found for " + input);
throw new InputParseException(TranslatableComponent.of("fawe.error.no-block-found", TextComponent.of(input)));
}
if (blockTypeList.size() == 1) {
type = blockTypeList.get(0);

View File

@ -38,6 +38,7 @@ import com.sk89q.worldedit.internal.expression.ExpressionException;
import com.sk89q.worldedit.regions.RegionOperationException;
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.io.file.FileSelectionAbortedException;
import com.sk89q.worldedit.util.io.file.FilenameResolutionException;
import com.sk89q.worldedit.util.io.file.InvalidFilenameException;
@ -75,26 +76,25 @@ public class WorldEditExceptionConverter extends ExceptionConverterHelper {
final Matcher matcher = numberFormat.matcher(e.getMessage());
if (matcher.matches()) {
throw newCommandException("Number expected; string \"" + matcher.group(1)
+ "\" given.", e);
throw newCommandException(TranslatableComponent.of("worldedit.error.invalid-number.matches", TextComponent.of(matcher.group(1))), e);
} else {
throw newCommandException("Number expected; string given.", e);
throw newCommandException(TranslatableComponent.of("worldedit.error.invalid-number"), e);
}
}
@ExceptionMatch
public void convert(IncompleteRegionException e) throws CommandException {
throw newCommandException("Make a region selection first.", e);
throw newCommandException(TranslatableComponent.of("worldedit.error.incomplete-region"), e);
}
@ExceptionMatch
public void convert(MissingWorldException e) throws CommandException {
throw newCommandException("You need to provide a world (Try //world)", e);
throw newCommandException(e.getRichMessage(), e);
}
@ExceptionMatch
public void convert(UnknownItemException e) throws CommandException {
throw newCommandException("Block name '" + e.getID() + "' was not recognized.", e);
throw newCommandException(TranslatableComponent.of("worldedit.error.unknown-block", TextComponent.of(e.getID())), e);
}
@ExceptionMatch
@ -104,39 +104,43 @@ public class WorldEditExceptionConverter extends ExceptionConverterHelper {
@ExceptionMatch
public void convert(DisallowedItemException e) throws CommandException {
throw newCommandException("Block '" + e.getID()
+ "' not allowed (see WorldEdit configuration).", e);
throw newCommandException(TranslatableComponent.of("worldedit.error.disallowed-block", TextComponent.of(e.getID())), e);
}
@ExceptionMatch
public void convert(MaxChangedBlocksException e) throws CommandException {
throw newCommandException("Max blocks changed in an operation reached ("
+ e.getBlockLimit() + ").", e);
throw newCommandException(TranslatableComponent.of("worldedit.error.max-changes", TextComponent.of(e.getBlockLimit())), e);
}
@ExceptionMatch
public void convert(MaxBrushRadiusException e) throws CommandException {
throw newCommandException("Maximum brush radius (in configuration): " + worldEdit.getConfiguration().maxBrushRadius, e);
throw newCommandException(
TranslatableComponent.of("worldedit.error.max-brush-radius", TextComponent.of(worldEdit.getConfiguration().maxBrushRadius)),
e
);
}
@ExceptionMatch
public void convert(MaxRadiusException e) throws CommandException {
throw newCommandException("Maximum radius (in configuration): " + worldEdit.getConfiguration().maxRadius, e);
throw newCommandException(
TranslatableComponent.of("worldedit.error.max-radius", TextComponent.of(worldEdit.getConfiguration().maxRadius)),
e
);
}
@ExceptionMatch
public void convert(UnknownDirectionException e) throws CommandException {
throw newCommandException("Unknown direction: " + e.getDirection(), e);
throw newCommandException(e.getRichMessage(), e);
}
@ExceptionMatch
public void convert(InsufficientArgumentsException e) throws CommandException {
throw newCommandException(e.getMessage(), e);
throw newCommandException(e.getRichMessage(), e);
}
@ExceptionMatch
public void convert(RegionOperationException e) throws CommandException {
throw newCommandException(e.getMessage(), e);
throw newCommandException(e.getRichMessage(), e);
}
@ExceptionMatch
@ -146,40 +150,41 @@ public class WorldEditExceptionConverter extends ExceptionConverterHelper {
@ExceptionMatch
public void convert(EmptyClipboardException e) throws CommandException {
throw newCommandException("Your clipboard is empty. Use //copy first.", e);
throw newCommandException(TranslatableComponent.of("worldedit.error.empty-clipboard"), e);
}
@ExceptionMatch
public void convert(InvalidFilenameException e) throws CommandException {
throw newCommandException("Filename '" + e.getFilename() + "' invalid: "
+ e.getMessage(), e);
throw newCommandException(
TranslatableComponent.of("worldedit.error.invalid-filename", TextComponent.of(e.getFilename()), e.getRichMessage()),
e
);
}
@ExceptionMatch
public void convert(FilenameResolutionException e) throws CommandException {
throw newCommandException(
"File '" + e.getFilename() + "' resolution error: " + e.getMessage(), e);
TranslatableComponent.of("worldedit.error.file-resolution", TextComponent.of(e.getFilename()), e.getRichMessage()),
e
);
}
@ExceptionMatch
public void convert(InvalidToolBindException e) throws CommandException {
throw newCommandException(
TextComponent.builder("Can't bind tool to ")
.append(e.getItemType().getRichName())
.append(": " + e.getMessage())
.build(),
e
TranslatableComponent.of("worldedit.tool.error.cannot-bind", e.getItemType().getRichName(), e.getRichMessage()),
e
);
}
@ExceptionMatch
public void convert(FileSelectionAbortedException e) throws CommandException {
throw newCommandException("File selection aborted.", e);
throw newCommandException(TranslatableComponent.of("worldedit.error.file-aborted"), e);
}
@ExceptionMatch
public void convert(WorldEditException e) throws CommandException {
throw newCommandException(e.getMessage(), e);
throw newCommandException(e.getRichMessage(), e);
}
// Prevent investigation into UsageExceptions

View File

@ -25,6 +25,7 @@ import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.history.changeset.ChangeSet;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
@ -94,7 +95,7 @@ public abstract class PaginationBox extends MessageBox {
}
int pageCount = (int) Math.ceil(getComponentsSize() / (double) componentsPerPage);
if (page < 1 || page > pageCount) {
throw new InvalidComponentException("Invalid page number.");
throw new InvalidComponentException(TranslatableComponent.of("worldedit.error.invalid-page"));
}
currentPage = page;
final int lastComp = Math.min(page * componentsPerPage, getComponentsSize());

View File

@ -105,8 +105,33 @@
"fawe.error.mask.angle": "Cannot combine degree with block-step",
"fawe.error.invalid-flag": "The flag {0} is not applicable here",
"fawe.error.lighting": "Error when attempting lighting. You may need to reload the chunks to see the edit.",
"fawe.error.parser.invalid-data": "Invalid data: {0}",
"fawe.error.unsupported": "Unsupported!",
"fawe.error.invalid-block-type": "Does not match a valid block type: {0}",
"fawe.error.nbt.forbidden": "You are not allowed to use nbt.",
"fawe.error.invalid-arguments": "Invalid amount of arguments. Expected: {0}",
"fawe.error.unrecognised-tag": "Unrecognised tag: {0} {1}",
"fawe.error.unknown-block-tag": "Unknown block tag: {0}",
"fawe.error.block-tag-no-blocks": "Block tag '{0}' had no blocks.",
"fawe.error.no-block-found": "No block found for '{0}'.",
"fawe.error.invalid-states": "Invalid states: {0}",
"fawe.error.no-session": "No session is available, so no clipboard is available.",
"fawe.error.empty-clipboard": "To use '{0}', please first copy something to your clipboard",
"fawe.error.selection-expand": "Selection cannot expand.",
"fawe.error.selection-contract": "Selection cannot expand.",
"fawe.error.selection-shift": "Selection cannot be shifted.",
"fawe.error.invalid-user": "User must be provided.",
"fawe.error.radius-too-small": "Radius must be >=0",
"fawe.error.time-too-less": "Time must be >=0",
"fawe.error.invalid-image": "Invalid image: {0}",
"fawe.error.file-not-found": "File not found: {0}",
"fawe.error.file-is-invalid-directory": "File is a directory: {0}",
"fawe.error.stacktrace": "===============---=============",
"fawe.error.no-failure": "This shouldn't result in any failure",
"fawe.error.invalid-bracketing": "Invalid bracketing, are you missing a '{0}'.",
"fawe.error.too-simple": "Complexity must be in the range 0-100",
"fawe.cancel.worldedit.cancel.count": "Cancelled {0} edits.",
"fawe.cancel.worldedit.cancel.count": "Cancelled {0} edits.",
"fawe.cancel.worldedit.cancel.reason.confirm": "Use //confirm to execute {2}",
"fawe.cancel.worldedit.cancel.reason.confirm.region": "Your selection is large ({0} -> {1}, containing {3} blocks). Use //confirm to execute {2}",
"fawe.cancel.worldedit.cancel.reason.confirm.radius": "Your radius is large ({0} > {1}). Use //confirm to execute {2}",
@ -178,7 +203,48 @@
"worldedit.biomeinfo.position": "Biomes at your position: {0}",
"worldedit.biomeinfo.selection": "Biomes in your selection: {0}",
"worldedit.error.disabled": "This functionality is disabled (see WorldEdit configuration).",
"worldedit.error.no-match": "No match for '{0}'.",
"worldedit.error.unknown": "Unknown error occurred: {0}",
"worldedit.error.parser.player-only": "Input '{0}' requires a player!",
"worldedit.error.parser.bad-state-format": "Bad state format in {0}",
"worldedit.error.parser.unknown-property": "Unknown property '{0}' for block '{1}'",
"worldedit.error.parser.duplicate-property": "Duplicate property: {0}",
"worldedit.error.parser.unknown-value": "Unknown value '{0}' for property '{1}'",
"worldedit.error.parser.invalid-colon": "Invalid colon.",
"worldedit.error.parser.hanging-lbracket": "Invalid format. Hanging bracket at '{0}'.",
"worldedit.error.parser.missing-rbracket": "State is missing trailing ']'",
"worldedit.error.incomplete-region": "Make a region selection first.",
"worldedit.error.not-a-block": "This item is not a block.",
"worldedit.error.unknown-entity": "Entity name '{0}' was not recognized.",
"worldedit.error.unknown-mob": "Mob name '{0}' was not recognized.",
"worldedit.error.parser.clipboard.missing-offset": "Offset specified with @ but no offset given. Use '#copy@[x,y,z]'.",
"worldedit.error.parser.clipboard.missing-coordinates": "Clipboard offset needs x,y,z coordinates.",
"worldedit.error.unknown-item": "Item name '{0}' was not recognized.",
"worldedit.error.parser.invalid-expression": "Invalid expression: {0}",
"worldedit.error.parser.negate-nothing": "Cannot negate nothing!",
"worldedit.error.invalid-page": "Invalid page number",
"worldedit.error.missing-extent": "No Extent is known",
"worldedit.error.missing-session": "No LocalSession is known",
"worldedit.error.missing-world": "You need to provide a world (Try //world)",
"worldedit.error.missing-actor": "No actor is known",
"worldedit.error.no-file-selected": "No file selected.",
"worldedit.error.file-resolution.outside-root": "Path is outside allowable root",
"worldedit.error.file-resolution.resolve-failed": "Failed to resolve path",
"worldedit.error.invalid-filename.invalid-characters": "Invalid characters or extension missing",
"worldedit.error.invalid-number.matches": "Number expected; string \"{0}\" given.",
"worldedit.error.invalid-number": "Number expected; string given.",
"worldedit.error.unknown-block": "Block name '{0}' was not recognized.",
"worldedit.error.disallowed-block": "Block '{0}' not allowed (see WorldEdit configuration).",
"worldedit.error.max-changes": "Max blocks changed in an operation reached ({0}).",
"worldedit.error.max-brush-radius": "Maximum brush radius (in configuration): {0}",
"worldedit.error.max-radius": "Maximum radius (in configuration): {0}",
"worldedit.error.empty-clipboard": "Your clipboard is empty. Use //copy first.",
"worldedit.error.invalid-filename": "Filename '{0}' invalid: {1}",
"worldedit.error.file-resolution": "File '{0}' resolution error: {1}",
"worldedit.tool.error.cannot-bind": "Can't bind tool to {0}: {1}",
"worldedit.error.file-aborted": "File selection aborted.",
"worldedit.error.world-unloaded": "The world was unloaded already.",
"worldedit.brush.radius-too-large": "Maximum allowed brush radius: {0}",
"worldedit.brush.apply.description": "Apply brush, apply a function to every block",