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

@ -25,6 +25,7 @@ import com.sk89q.worldedit.math.Vector3;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.OptionalInt;
import javax.annotation.Nullable;
@ -73,7 +74,7 @@ public enum Direction {
static {
for (Direction dir : Direction.values()) {
map.put(dir.name(), dir);
map.put(dir.name().toLowerCase(), dir);
map.put(dir.name().toLowerCase(Locale.ROOT), dir);
}
}
@ -273,9 +274,9 @@ public enum Direction {
return Optional.of(SOUTHEAST);
case 15:
return Optional.of(SOUTH_SOUTHEAST);
default:
return Optional.empty();
}
return Optional.empty();
}
public OptionalInt toRotationIndex() {
@ -312,8 +313,9 @@ public enum Direction {
return OptionalInt.of(14);
case SOUTH_SOUTHEAST:
return OptionalInt.of(15);
default:
return OptionalInt.empty();
}
return OptionalInt.empty();
}
/**

View File

@ -307,17 +307,33 @@ public class Location extends Vector3Impl {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Location location = (Location) o;
if (Double.doubleToLongBits(pitch) != Double.doubleToLongBits(location.pitch)) return false;
if (Double.doubleToLongBits(yaw) != Double.doubleToLongBits(location.yaw)) return false;
if (this.getX() != location.getX()) return false;
if (this.getZ() != location.getZ()) return false;
if (this.getY() != location.getY()) return false;
if (!extent.equals(location.extent)) return false;
if (Double.doubleToLongBits(pitch) != Double.doubleToLongBits(location.pitch)) {
return false;
}
if (Double.doubleToLongBits(yaw) != Double.doubleToLongBits(location.yaw)) {
return false;
}
if (this.getX() != location.getX()) {
return false;
}
if (this.getZ() != location.getZ()) {
return false;
}
if (this.getY() != location.getY()) {
return false;
}
if (!extent.equals(location.extent)) {
return false;
}
return true;
}

View File

@ -240,7 +240,7 @@ public class BlockMap<V> extends AbstractMap<BlockVector3, V> {
entrySet = es = new AbstractSet<Entry<BlockVector3, V>>() {
@Override
public Iterator<Entry<BlockVector3, V>> iterator() {
return new Iterator<Entry<BlockVector3,V>>() {
return new Iterator<Entry<BlockVector3, V>>() {
private final ObjectIterator<Long2ObjectMap.Entry<Int2ObjectMap<V>>> primaryIterator
= Long2ObjectMaps.fastIterator(maps);
@ -346,8 +346,9 @@ public class BlockMap<V> extends AbstractMap<BlockVector3, V> {
}
public boolean equals(Object o) {
if (!(o instanceof Map.Entry))
if (!(o instanceof Map.Entry)) {
return false;
}
Entry<?, ?> e = (Entry<?, ?>) o;
if (o instanceof BlockMap.LazyEntry) {
@SuppressWarnings("unchecked")

View File

@ -65,7 +65,8 @@ public class LocatedBlockList implements Iterable<LocatedBlock> {
return blocks.containsKey(location);
}
public @Nullable BaseBlock get(BlockVector3 location) {
@Nullable
public BaseBlock get(BlockVector3 location) {
return blocks.get(location);
}

View File

@ -97,9 +97,7 @@ public abstract class EventHandler implements Comparable<EventHandler> {
@Override
public String toString() {
return "EventHandler{" +
"priority=" + priority +
'}';
return "EventHandler{" + "priority=" + priority + '}';
}
}

View File

@ -60,14 +60,21 @@ public class MethodEventHandler extends EventHandler {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MethodEventHandler that = (MethodEventHandler) o;
if (!method.equals(that.method)) return false;
if (object != null ? !object.equals(that.object) : that.object != null)
if (!method.equals(that.method)) {
return false;
}
if (object != null ? !object.equals(that.object) : that.object != null) {
return false;
}
return true;
}

View File

@ -37,7 +37,7 @@ public class CodeFormat extends TextComponentProducer {
* @param texts The text
* @return The Component
*/
public static TextComponent wrap(String ... texts) {
public static TextComponent wrap(String... texts) {
CodeFormat code = new CodeFormat();
for (String text: texts) {
code.append(text);

View File

@ -40,7 +40,7 @@ public class ErrorFormat extends TextComponentProducer {
* @param texts The text
* @return The Component
*/
public static TextComponent wrap(String ... texts) {
public static TextComponent wrap(String... texts) {
ErrorFormat error = new ErrorFormat();
for (String component : texts) {
error.append(component);

View File

@ -79,7 +79,7 @@ public abstract class PaginationBox extends MessageBox {
if (pageCommand != null && !pageCommand.contains("%page%")) {
if (pageCommand.contains("-p ")) {
pageCommand = pageCommand.replaceAll("-p [0-9]+", "-p %page%");
} else{
} else {
pageCommand = pageCommand + " -p %page%";
}
}

View File

@ -40,7 +40,7 @@ public class SubtleFormat extends TextComponentProducer {
* @param texts The text
* @return The Component
*/
public static TextComponent wrap(String ... texts) {
public static TextComponent wrap(String... texts) {
SubtleFormat subtle = new SubtleFormat();
for (String component : texts) {
subtle.append(component);

View File

@ -33,7 +33,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
*/
public class LevenshteinDistance implements Function<String, Integer> {
public final static Pattern STANDARD_CHARS = Pattern.compile("[ _\\-]");
public static final Pattern STANDARD_CHARS = Pattern.compile("[ _\\-]");
private final String baseString;
private final boolean caseSensitive;

View File

@ -37,7 +37,7 @@ public class ArchiveNioSupports {
ImmutableList.Builder<ArchiveNioSupport> builder = ImmutableList.builder();
try {
builder.add(TrueVfsArchiveNioSupport.getInstance());
} catch (NoClassDefFoundError ignore) {
} catch (NoClassDefFoundError ignored) {
// No TrueVFS available. That's OK.
}
SUPPORTS = builder.add(ZipArchiveNioSupport.getInstance())

View File

@ -36,10 +36,14 @@ import javax.annotation.Nullable;
*/
public class DynamicStreamHandler extends StreamHandler {
private @Nullable StreamHandler handler;
private @Nullable Formatter formatter;
private @Nullable Filter filter;
private @Nullable String encoding;
@Nullable
private StreamHandler handler;
@Nullable
private Formatter formatter;
@Nullable
private Filter filter;
@Nullable
private String encoding;
private Level level = Level.ALL;
/**
@ -47,7 +51,8 @@ public class DynamicStreamHandler extends StreamHandler {
*
* @return the delegate handler (Which may be null)
*/
public @Nullable synchronized StreamHandler getHandler() {
@Nullable
public synchronized StreamHandler getHandler() {
return handler;
}