mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 04:38:35 +00:00
@ -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