Javadoc and Formatting fixes. (#619)

Javadoc and Formatting fixes.

Also, extremely minor code changes which have been tested.
This commit is only part one of two commits that aim to fix problems with formatting in our project. In part two I will modify the Google Java Style Guide (since it closely matches our code style) for our project so there is guidance on how to format and document. 

* Updated PlotSquared URL
* Removed plugin acronyms
* Fixed a typo
* Fixed grammar
* Use modern block id's
* Update YouTube video URL
This commit is contained in:
Matt
2020-10-05 13:41:41 -04:00
committed by GitHub
parent b06d943f7c
commit 96dcb95b7c
393 changed files with 6537 additions and 4700 deletions

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 java.util.List;
import java.util.stream.Stream;
@ -79,7 +81,7 @@ public class RandomPatternParser extends InputParser<Pattern> {
String[] p = token.split("%", 2);
if (p.length < 2) {
throw new InputParseException("Missing the type after the % symbol for '" + input + "'");
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-random-type", TextComponent.of(input)));
} else {
chance = Double.parseDouble(p[0]);
innerPattern = worldEdit.getPatternFactory().parseFromInput(p[1], context);

View File

@ -30,6 +30,8 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.function.pattern.StateApplyingPattern;
import com.sk89q.worldedit.function.pattern.TypeApplyingPattern;
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.HashMap;
import java.util.Map;
@ -82,19 +84,29 @@ public class TypeOrStateApplyingPatternParser extends InputParser<Pattern> {
worldEdit.getBlockFactory().parseFromInput(type, context).getBlockType().getDefaultState());
} else {
// states given
if (!parts[1].endsWith("]")) throw new InputParseException("State is missing trailing ']'");
if (!parts[1].endsWith("]")) {
throw new InputParseException(TranslatableComponent.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("Empty part in state");
if (state.isEmpty()) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.empty-state"));
}
String[] propVal = state.split("=", 2);
if (propVal.length != 2) throw new InputParseException("Missing '=' separator");
if (propVal.length != 2) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.missing-equals-separator"));
}
final String prop = propVal[0];
if (prop.isEmpty()) throw new InputParseException("Empty property in state");
if (prop.isEmpty()) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.empty-property"));
}
final String value = propVal[1];
if (value.isEmpty()) throw new InputParseException("Empty value in state");
if (value.isEmpty()) {
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.empty-value"));
}
if (statesToSet.put(prop, value) != null) {
throw new InputParseException("Duplicate properties in state");
throw new InputParseException(TranslatableComponent.of("worldedit.error.parser.duplicate-property", TextComponent.of(prop)));
}
}
if (type.isEmpty()) {