mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 20:16:41 +00:00
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.AdjacentMaskParser;
|
||||
import com.sk89q.worldedit.extension.factory.parser.mask.AirMaskParser;
|
||||
@ -138,14 +139,14 @@ public final class MaskFactory extends AbstractFactory<Mask> {
|
||||
}
|
||||
}
|
||||
if (match == null) {
|
||||
throw new NoMatchException(TranslatableComponent.of("worldedit.error.no-match", TextComponent.of(component)));
|
||||
throw new NoMatchException(Caption.of("worldedit.error.no-match", TextComponent.of(component)));
|
||||
}
|
||||
masks.add(match);
|
||||
}
|
||||
|
||||
switch (masks.size()) {
|
||||
case 0:
|
||||
throw new NoMatchException(TranslatableComponent.of("worldedit.error.no-match", TextComponent.of(input)));
|
||||
throw new NoMatchException(Caption.of("worldedit.error.no-match", TextComponent.of(input)));
|
||||
case 1:
|
||||
return masks.get(0).optimize();
|
||||
default:
|
||||
|
@ -84,10 +84,10 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
} catch (NotABlockException e) {
|
||||
throw new InputParseException(e.getRichMessage());
|
||||
} catch (WorldEditException e) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.unknown", e.getRichMessage()), e);
|
||||
throw new InputParseException(Caption.of("worldedit.error.unknown", e.getRichMessage()), e);
|
||||
}
|
||||
} else {
|
||||
throw new InputParseException(TranslatableComponent.of(
|
||||
throw new InputParseException(Caption.of(
|
||||
"worldedit.error.parser.player-only",
|
||||
TextComponent.of(handSide == HandSide.MAIN_HAND ? "hand" : "offhand")
|
||||
));
|
||||
@ -181,7 +181,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
String[] parts = parseableData.split("=");
|
||||
if (parts.length != 2) {
|
||||
throw new InputParseException(
|
||||
TranslatableComponent.of("worldedit.error.parser.bad-state-format",
|
||||
Caption.of("worldedit.error.parser.bad-state-format",
|
||||
TextComponent.of(parseableData))
|
||||
);
|
||||
}
|
||||
@ -190,7 +190,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
Property<Object> propertyKey = (Property<Object>) type.getPropertyMap().get(parts[0]);
|
||||
if (propertyKey == null) {
|
||||
if (context.getActor() != null) {
|
||||
throw new NoMatchException(TranslatableComponent.of(
|
||||
throw new NoMatchException(Caption.of(
|
||||
"worldedit.error.parser.unknown-property",
|
||||
TextComponent.of(parts[0]),
|
||||
TextComponent.of(type.getId())
|
||||
@ -201,7 +201,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
if (blockStates.containsKey(propertyKey)) {
|
||||
throw new InputParseException(TranslatableComponent.of(
|
||||
throw new InputParseException(Caption.of(
|
||||
"worldedit.error.parser.duplicate-property",
|
||||
TextComponent.of(parts[0])
|
||||
));
|
||||
@ -210,7 +210,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
try {
|
||||
value = propertyKey.getValueFor(parts[1]);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new NoMatchException(TranslatableComponent.of(
|
||||
throw new NoMatchException(Caption.of(
|
||||
"worldedit.error.parser.unknown-value",
|
||||
TextComponent.of(parts[1]),
|
||||
TextComponent.of(propertyKey.getName())
|
||||
@ -221,7 +221,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
} catch (NoMatchException e) {
|
||||
throw e; // Pass-through
|
||||
} catch (Exception e) {
|
||||
throw new InputParseException(TranslatableComponent.of(
|
||||
throw new InputParseException(Caption.of(
|
||||
"worldedit.error.parser.bad-state-format",
|
||||
TextComponent.of(parseableData)
|
||||
));
|
||||
@ -264,14 +264,14 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
try {
|
||||
String[] split = blockAndExtraData[0].split(":", 2);
|
||||
if (split.length == 0) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-colon"));
|
||||
throw new InputParseException(Caption.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(TranslatableComponent.of("fawe.error.parser.invalid-data", TextComponent.of(data)));
|
||||
throw new InputParseException(Caption.of("fawe.error.parser.invalid-data", TextComponent.of(data)));
|
||||
}
|
||||
state = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
||||
} else {
|
||||
@ -279,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(TranslatableComponent.of("fawe.error.parser.invalid-data", TextComponent.of(data)));
|
||||
throw new InputParseException(Caption.of("fawe.error.parser.invalid-data", TextComponent.of(data)));
|
||||
}
|
||||
state = LegacyMapper.getInstance().getBlockFromLegacy(type.getLegacyCombinedId() >> 4, data);
|
||||
}
|
||||
@ -298,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(TranslatableComponent.of("worldedit.error.parser.hanging-lbracket", TextComponent.of(stateStart)));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.hanging-lbracket", TextComponent.of(stateStart)));
|
||||
}
|
||||
int stateEnd = blockAndExtraData[0].lastIndexOf(']');
|
||||
if (stateEnd < 0) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-rbracket"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.missing-rbracket"));
|
||||
}
|
||||
stateString = blockAndExtraData[0].substring(stateStart + 1, blockAndExtraData[0].length() - 1);
|
||||
}
|
||||
@ -311,7 +311,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
stateProperties = stateString.split(",");
|
||||
}
|
||||
if (typeString.isEmpty()) {
|
||||
throw new InputParseException(TranslatableComponent.of(
|
||||
throw new InputParseException(Caption.of(
|
||||
"worldedit.error.parser.bad-state-format",
|
||||
TextComponent.of(blockAndExtraData[0])
|
||||
));
|
||||
@ -334,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(TranslatableComponent.of("worldedit.error.incomplete-region"));
|
||||
throw new InputParseException(Caption.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(TranslatableComponent.of("worldedit.command.player-only"));
|
||||
throw new InputParseException(Caption.of("worldedit.command.player-only"));
|
||||
}
|
||||
Player player = (Player) actor;
|
||||
BlockBag bag = player.getInventoryBlockBag();
|
||||
if (!(bag instanceof SlottableBlockBag)) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.unsupported"));
|
||||
throw new InputParseException(Caption.of("fawe.error.unsupported"));
|
||||
}
|
||||
SlottableBlockBag slottable = (SlottableBlockBag) bag;
|
||||
BaseItem item = slottable.getItem(slot);
|
||||
|
||||
if (!item.getType().hasBlockType()) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.not-a-block"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.not-a-block"));
|
||||
}
|
||||
state = item.getType().getBlockType().getDefaultState();
|
||||
nbt = item.getNbtData();
|
||||
@ -363,7 +363,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
state = type.getDefaultState();
|
||||
}
|
||||
if (state == null) {
|
||||
throw new NoMatchException(TranslatableComponent.of("fawe.error.invalid-block-type", TextComponent.of(input)));
|
||||
throw new NoMatchException(Caption.of("fawe.error.invalid-block-type", TextComponent.of(input)));
|
||||
}
|
||||
}
|
||||
if (nbt == null) {
|
||||
@ -394,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(TranslatableComponent.of("fawe.error.invalid-block-type", TextComponent.of(input)));
|
||||
throw new NoMatchException(Caption.of("fawe.error.invalid-block-type", TextComponent.of(input)));
|
||||
}
|
||||
|
||||
if (blockAndExtraData.length > 1 && blockAndExtraData[1].startsWith("{")) {
|
||||
@ -402,7 +402,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
||||
try {
|
||||
nbt = JSON2NBT.getTagFromJson(joined);
|
||||
} catch (NBTException e) {
|
||||
throw new NoMatchException(TranslatableComponent.of(e.getMessage()));
|
||||
throw new NoMatchException(Caption.of(e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -413,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(TranslatableComponent.of("fawe.error.block.not.allowed", TextComponent.of(input)));
|
||||
throw new DisallowedUsageException(Caption.of("fawe.error.block.not.allowed", TextComponent.of(input)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,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(TranslatableComponent.of("worldedit.error.unknown-entity", TextComponent.of(mobName)));
|
||||
throw new NoMatchException(Caption.of("worldedit.error.unknown-entity", TextComponent.of(mobName)));
|
||||
}
|
||||
mobName = ent.getId();
|
||||
if (!worldEdit.getPlatformManager().queryCapability(Capability.USER_COMMANDS).isValidMobType(mobName)) {
|
||||
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-mob", TextComponent.of(mobName)));
|
||||
throw new NoMatchException(Caption.of("worldedit.error.unknown-mob", TextComponent.of(mobName)));
|
||||
}
|
||||
return validate(context, new MobSpawnerBlock(state, mobName));
|
||||
} else {
|
||||
@ -465,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(TranslatableComponent.of("fawe.error.block.not.allowed", TextComponent.of(String.valueOf(holder))));
|
||||
throw new DisallowedUsageException(Caption.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(TranslatableComponent.of("fawe.error.nbt.forbidden"));
|
||||
throw new DisallowedUsageException(Caption.of("fawe.error.nbt.forbidden"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
@ -58,7 +59,7 @@ public class DefaultItemParser extends InputParser<BaseItem> {
|
||||
String[] split = input.split(":");
|
||||
ItemType type;
|
||||
if (split.length == 0) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-colon"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.invalid-colon"));
|
||||
} else if (split.length == 1) {
|
||||
type = LegacyMapper.getInstance().getItemFromLegacy(Integer.parseInt(split[0]));
|
||||
} else {
|
||||
@ -85,7 +86,7 @@ public class DefaultItemParser extends InputParser<BaseItem> {
|
||||
}
|
||||
|
||||
if (item == null) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.unknown-item", TextComponent.of(input)));
|
||||
throw new InputParseException(Caption.of("worldedit.error.unknown-item", TextComponent.of(input)));
|
||||
} else {
|
||||
return item;
|
||||
}
|
||||
@ -95,7 +96,7 @@ public class DefaultItemParser extends InputParser<BaseItem> {
|
||||
if (actor instanceof Player) {
|
||||
return ((Player) actor).getItemInHand(handSide);
|
||||
} else {
|
||||
throw new InputParseException(TranslatableComponent.of(
|
||||
throw new InputParseException(Caption.of(
|
||||
"worldedit.error.parser.player-only",
|
||||
TextComponent.of(handSide == HandSide.MAIN_HAND ? "hand" : "offhand")
|
||||
));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -143,7 +144,7 @@ public abstract class RichParser<E> extends InputParser<E> {
|
||||
arguments.add(input.substring(openIndex + 1));
|
||||
}
|
||||
if (requireClosing && open != 0) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-bracketing", TextComponent.of("'[' or ']'?")));
|
||||
throw new InputParseException(Caption.of("fawe.error.invalid-bracketing", TextComponent.of("'[' or ']'?")));
|
||||
}
|
||||
return arguments.toArray(new String[0]);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.object.mask.AngleMask;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
@ -40,7 +41,7 @@ public class AngleMaskParser extends RichParser<Mask> {
|
||||
String maxArg = arguments[1];
|
||||
boolean degree = minArg.endsWith("d");
|
||||
if (degree ^ maxArg.endsWith("d")) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.mask.angle"));
|
||||
throw new InputParseException(Caption.of("fawe.error.mask.angle"));
|
||||
}
|
||||
boolean overlay = false;
|
||||
if (arguments.length > 2) {
|
||||
@ -49,7 +50,7 @@ public class AngleMaskParser extends RichParser<Mask> {
|
||||
if (flag.equals("-o")) {
|
||||
overlay = true;
|
||||
} else {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-flag",
|
||||
throw new InputParseException(Caption.of("fawe.error.invalid-flag",
|
||||
TextComponent.of(flag)));
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
@ -74,7 +75,7 @@ public class BiomeMaskParser extends InputParser<Mask> {
|
||||
for (String biomeName : Splitter.on(",").split(input.substring(1))) {
|
||||
BiomeType biome = BiomeType.REGISTRY.get(biomeName);
|
||||
if (biome == null) {
|
||||
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-biome", TextComponent.of(biomeName)));
|
||||
throw new NoMatchException(Caption.of("worldedit.error.unknown-biome", TextComponent.of(biomeName)));
|
||||
}
|
||||
biomes.add(biome);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -53,7 +54,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(TranslatableComponent.of("fawe.error.unrecognised-tag", TextComponent.of(input.substring(2)), TextComponent.of("\\")));
|
||||
throw new InputParseException(Caption.of("fawe.error.unrecognised-tag", TextComponent.of(input.substring(2)), TextComponent.of("\\")));
|
||||
} else {
|
||||
return new BlockCategoryMask(context.requireExtent(), category);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -58,7 +59,7 @@ public class BlockStateMaskParser extends InputParser<Mask> {
|
||||
Splitter.on(',').omitEmptyStrings().trimResults().withKeyValueSeparator('=').split(states),
|
||||
strict);
|
||||
} catch (Exception e) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-states", TextComponent.of(String.valueOf(e))));
|
||||
throw new InputParseException(Caption.of("fawe.error.invalid-states", TextComponent.of(String.valueOf(e))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
@ -68,7 +69,7 @@ public class ExpressionMaskParser extends InputParser<Mask> {
|
||||
}
|
||||
return new ExpressionMask(exp);
|
||||
} catch (ExpressionException e) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.invalid-expression", TextComponent.of(e.getMessage())));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.invalid-expression", TextComponent.of(e.getMessage())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.object.mask.ExtremaMask;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
@ -40,7 +41,7 @@ public class ExtremaMaskParser extends RichParser<Mask> {
|
||||
String maxArg = arguments[1];
|
||||
boolean degree = minArg.endsWith("d");
|
||||
if (degree ^ maxArg.endsWith("d")) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.mask.angle"));
|
||||
throw new InputParseException(Caption.of("fawe.error.mask.angle"));
|
||||
}
|
||||
double min;
|
||||
double max;
|
||||
@ -51,7 +52,7 @@ public class ExtremaMaskParser extends RichParser<Mask> {
|
||||
if (flag.equals("-o")) {
|
||||
overlay = true;
|
||||
} else {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-flag",
|
||||
throw new InputParseException(Caption.of("fawe.error.invalid-flag",
|
||||
TextComponent.of(flag)));
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
@ -55,7 +56,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(TranslatableComponent.of("worldedit.error.parser.negate-nothing"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.negate-nothing"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.object.mask.ROCAngleMask;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
@ -40,7 +41,7 @@ public class ROCAngleMaskParser extends RichParser<Mask> {
|
||||
String maxArg = arguments[1];
|
||||
boolean degree = minArg.endsWith("d");
|
||||
if (degree ^ maxArg.endsWith("d")) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.mask.angle"));
|
||||
throw new InputParseException(Caption.of("fawe.error.mask.angle"));
|
||||
}
|
||||
double min;
|
||||
double max;
|
||||
@ -51,7 +52,7 @@ public class ROCAngleMaskParser extends RichParser<Mask> {
|
||||
if (flag.equals("-o")) {
|
||||
overlay = true;
|
||||
} else {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-flag",
|
||||
throw new InputParseException(Caption.of("fawe.error.invalid-flag",
|
||||
TextComponent.of(flag)));
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.mask;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -49,7 +50,7 @@ public class RegionMaskParser extends SimpleInputParser<Mask> {
|
||||
try {
|
||||
return new RegionMask(context.requireSession().getSelection(context.requireWorld()).clone());
|
||||
} catch (IncompleteRegionException e) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.incomplete-region"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.incomplete-region"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser.pattern;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.object.pattern.BiomeApplyingPattern;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.factory.parser.RichParser;
|
||||
@ -34,7 +35,7 @@ public class BiomePatternParser extends RichParser<Pattern> {
|
||||
String biomeId = input.substring(1);
|
||||
BiomeType biomeType = BiomeTypes.get(biomeId);
|
||||
if (biomeType == null) {
|
||||
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-biome", TextComponent.of(biomeId)));
|
||||
throw new NoMatchException(Caption.of("worldedit.error.unknown-biome", TextComponent.of(biomeId)));
|
||||
}
|
||||
return new BiomeApplyingPattern(context.requireExtent(), biomeType);
|
||||
} else {
|
||||
@ -63,11 +64,11 @@ public class BiomePatternParser extends RichParser<Pattern> {
|
||||
@Override
|
||||
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
|
||||
if (arguments.length != 1) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.invalid-arguments", TextComponent.of("#biome[<biome>]")));
|
||||
throw new InputParseException(Caption.of("fawe.error.invalid-arguments", TextComponent.of("#biome[<biome>]")));
|
||||
}
|
||||
BiomeType biomeType = BiomeTypes.get(arguments[0]);
|
||||
if (biomeType == null) {
|
||||
throw new NoMatchException(TranslatableComponent.of("worldedit.error.unknown-biome", TextComponent.of(arguments[0])));
|
||||
throw new NoMatchException(Caption.of("worldedit.error.unknown-biome", TextComponent.of(arguments[0])));
|
||||
}
|
||||
return new BiomeApplyingPattern(context.requireExtent(), biomeType);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.pattern;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -60,13 +61,13 @@ public class BlockCategoryPatternParser extends InputParser<Pattern> {
|
||||
|
||||
BlockCategory category = BlockCategory.REGISTRY.get(tag);
|
||||
if (category == null) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.unknown-block-tag", TextComponent.of(tag)));
|
||||
throw new InputParseException(Caption.of("fawe.error.unknown-block-tag", TextComponent.of(tag)));
|
||||
}
|
||||
RandomPattern randomPattern = new RandomPattern();
|
||||
|
||||
Set<BlockType> blocks = category.getAll();
|
||||
if (blocks.isEmpty()) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.block-tag-no-blocks", TextComponent.of(category.getId())));
|
||||
throw new InputParseException(Caption.of("fawe.error.block-tag-no-blocks", TextComponent.of(category.getId())));
|
||||
}
|
||||
|
||||
if (anyState) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser.pattern;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.object.pattern.BufferedPattern;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.factory.parser.RichParser;
|
||||
@ -34,7 +35,7 @@ public class BufferedPatternParser extends RichParser<Pattern> {
|
||||
@Override
|
||||
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
|
||||
if (arguments.length != 1) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.command.syntax",
|
||||
throw new InputParseException(Caption.of("fawe.error.command.syntax",
|
||||
TextComponent.of(getPrefix() + "[pattern] (e.g. " + getPrefix() + "[stone,dirt])")));
|
||||
}
|
||||
Pattern inner = this.worldEdit.getPatternFactory().parseFromInput(arguments[0], context);
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.pattern;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.EmptyClipboardException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -80,11 +81,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(TranslatableComponent.of("worldedit.error.parser.clipboard.missing-offset"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.clipboard.missing-offset"));
|
||||
}
|
||||
String[] offsetSplit = coords.substring(1, coords.length() - 1).split(",");
|
||||
if (offsetSplit.length != 3) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.clipboard.missing-coordinates"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.clipboard.missing-coordinates"));
|
||||
}
|
||||
offset = BlockVector3.at(
|
||||
Integer.valueOf(offsetSplit[0]),
|
||||
@ -99,10 +100,10 @@ public class ClipboardPatternParser extends InputParser<Pattern> {
|
||||
Clipboard clipboard = holder.getClipboard();
|
||||
return new ClipboardPattern(clipboard, offset);
|
||||
} catch (EmptyClipboardException e) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.empty-clipboard", TextComponent.of("#clipboard")));
|
||||
throw new InputParseException(Caption.of("fawe.error.empty-clipboard", TextComponent.of("#clipboard")));
|
||||
}
|
||||
} else {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.no-session"));
|
||||
throw new InputParseException(Caption.of("fawe.error.no-session"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser.pattern;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.object.pattern.Linear2DBlockPattern;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -44,7 +45,7 @@ public class Linear2DPatternParser extends RichParser<Pattern> {
|
||||
@Override
|
||||
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
|
||||
if (arguments.length == 0 || arguments.length > 3) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.command.syntax",
|
||||
throw new InputParseException(Caption.of("fawe.error.command.syntax",
|
||||
TextComponent.of(getPrefix() + "[pattern] (e.g. " + getPrefix() + "[stone,dirt])")));
|
||||
}
|
||||
Pattern inner = this.worldEdit.getPatternFactory().parseFromInput(arguments[0], context);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser.pattern;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.object.pattern.Linear3DBlockPattern;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
@ -45,7 +46,7 @@ public class Linear3DPatternParser extends RichParser<Pattern> {
|
||||
@Override
|
||||
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) throws InputParseException {
|
||||
if (arguments.length == 0 || arguments.length > 4) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.command.syntax",
|
||||
throw new InputParseException(Caption.of("fawe.error.command.syntax",
|
||||
TextComponent.of(getPrefix() + "[pattern] (e.g. " + getPrefix() + "[stone,dirt])")));
|
||||
}
|
||||
Pattern inner = this.worldEdit.getPatternFactory().parseFromInput(arguments[0], context);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.sk89q.worldedit.extension.factory.parser.pattern;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.boydti.fawe.object.random.NoiseRandom;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
@ -49,7 +50,7 @@ public abstract class NoisePatternParser extends RichParser<Pattern> {
|
||||
@Override
|
||||
protected Pattern parseFromInput(@NotNull String[] arguments, ParserContext context) {
|
||||
if (arguments.length != 2) {
|
||||
throw new InputParseException(TranslatableComponent.of("fawe.error.command.syntax",
|
||||
throw new InputParseException(Caption.of("fawe.error.command.syntax",
|
||||
TextComponent.of(getPrefix() + "[scale][pattern] (e.g. " + getPrefix() + "[5][dirt,stone])")));
|
||||
}
|
||||
double scale = parseScale(arguments[0]);
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.pattern;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.util.StringUtil;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -81,7 +82,7 @@ public class RandomPatternParser extends InputParser<Pattern> {
|
||||
String[] p = token.split("%", 2);
|
||||
|
||||
if (p.length < 2) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-random-type", TextComponent.of(input)));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.missing-random-type", TextComponent.of(input)));
|
||||
} else {
|
||||
chance = Double.parseDouble(p[0]);
|
||||
innerPattern = worldEdit.getPatternFactory().parseFromInput(p[1], context);
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.extension.factory.parser.pattern;
|
||||
|
||||
import com.boydti.fawe.config.Caption;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.SuggestionHelper;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
@ -85,28 +86,28 @@ public class TypeOrStateApplyingPatternParser extends InputParser<Pattern> {
|
||||
} else {
|
||||
// states given
|
||||
if (!parts[1].endsWith("]")) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-rbracket"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.missing-rbracket"));
|
||||
}
|
||||
final String[] states = parts[1].substring(0, parts[1].length() - 1).split(",");
|
||||
Map<String, String> statesToSet = new HashMap<>();
|
||||
for (String state : states) {
|
||||
if (state.isEmpty()) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.empty-state"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.empty-state"));
|
||||
}
|
||||
String[] propVal = state.split("=", 2);
|
||||
if (propVal.length != 2) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-equals-separator"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.missing-equals-separator"));
|
||||
}
|
||||
final String prop = propVal[0];
|
||||
if (prop.isEmpty()) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.empty-property"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.empty-property"));
|
||||
}
|
||||
final String value = propVal[1];
|
||||
if (value.isEmpty()) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.empty-value"));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.empty-value"));
|
||||
}
|
||||
if (statesToSet.put(prop, value) != null) {
|
||||
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.duplicate-property", TextComponent.of(prop)));
|
||||
throw new InputParseException(Caption.of("worldedit.error.parser.duplicate-property", TextComponent.of(prop)));
|
||||
}
|
||||
}
|
||||
if (type.isEmpty()) {
|
||||
|
Reference in New Issue
Block a user