Typo Fixes and Added Annotations

Dieser Commit ist enthalten in:
MattBDev 2019-05-28 23:23:51 -04:00
Ursprung 6b0fcc8712
Commit a0eb7ce59e
13 geänderte Dateien mit 71 neuen und 75 gelöschten Zeilen

Datei anzeigen

@ -108,6 +108,10 @@ subprojects {
build.dependsOn(sourcesJar)
}
dependencies {
compileOnly 'org.jetbrains:annotations:17.0.0'
}
shadowJar {
classifier 'dist'
dependencies {
@ -116,6 +120,7 @@ subprojects {
include(dependency('com.sk89q.lib:jlibnoise:1.0.0'))
include(dependency('com.github.luben:zstd-jni:1.1.1'))
include(dependency('co.aikar:fastutil-lite:1.0'))
include(dependency('org.jetbrains:annotations:17.0.0'))
}
exclude 'GradleStart**'
exclude '.cache'

Datei anzeigen

@ -4,6 +4,7 @@ import com.boydti.fawe.util.TaskManager;
import org.apache.commons.lang.mutable.MutableInt;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
public class BukkitTaskMan extends TaskManager {
@ -14,44 +15,35 @@ public class BukkitTaskMan extends TaskManager {
}
@Override
public int repeat(final Runnable r, final int interval) {
return this.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(this.plugin, r, interval, interval);
public int repeat(@NotNull final Runnable runnable, final int interval) {
return this.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(this.plugin, runnable, interval, interval);
}
@Override
public int repeatAsync(final Runnable r, final int interval) {
return this.plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(this.plugin, r, interval, interval);
public int repeatAsync(@NotNull final Runnable runnable, final int interval) {
return this.plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(this.plugin, runnable, interval, interval);
}
public MutableInt index = new MutableInt(0);
@Override
public void async(final Runnable r) {
if (r == null) {
return;
}
this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, r).getTaskId();
public void async(@NotNull final Runnable runnable) {
this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, runnable).getTaskId();
}
@Override
public void task(final Runnable r) {
if (r == null) {
return;
}
this.plugin.getServer().getScheduler().runTask(this.plugin, r).getTaskId();
public void task(@NotNull final Runnable runnable) {
this.plugin.getServer().getScheduler().runTask(this.plugin, runnable).getTaskId();
}
@Override
public void later(final Runnable r, final int delay) {
if (r == null) {
return;
}
this.plugin.getServer().getScheduler().runTaskLater(this.plugin, r, delay).getTaskId();
public void later(@NotNull final Runnable runnable, final int delay) {
this.plugin.getServer().getScheduler().runTaskLater(this.plugin, runnable, delay).getTaskId();
}
@Override
public void laterAsync(final Runnable r, final int delay) {
this.plugin.getServer().getScheduler().runTaskLaterAsynchronously(this.plugin, r, delay);
public void laterAsync(@NotNull final Runnable runnable, final int delay) {
this.plugin.getServer().getScheduler().runTaskLaterAsynchronously(this.plugin, runnable, delay);
}
@Override

Datei anzeigen

@ -441,7 +441,7 @@ public class Config {
}
/**
* Set some field to be accesible
* Set some field to be accessible
*
* @param field
* @throws NoSuchFieldException

Datei anzeigen

@ -45,7 +45,7 @@ public class DefaultFaweQueueMap implements IFaweQueueMap {
};
@Override
public Collection<FaweChunk> getFaweCunks() {
public Collection<FaweChunk> getFaweChunks() {
synchronized (blocks) {
return new HashSet<>(blocks.values());
}

Datei anzeigen

@ -6,7 +6,7 @@ import java.util.Collection;
public interface IFaweQueueMap {
Collection<FaweChunk> getFaweCunks();
Collection<FaweChunk> getFaweChunks();
void forEachChunk(RunnableVal<FaweChunk> onEach);

Datei anzeigen

@ -102,7 +102,7 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, CHUNKSECTIONS, SECTION> impl
@Override
public Collection<FaweChunk> getFaweChunks() {
return map.getFaweCunks();
return map.getFaweChunks();
}
@Override

Datei anzeigen

@ -48,7 +48,7 @@ public class WeakFaweQueueMap implements IFaweQueueMap {
};
@Override
public Collection<FaweChunk> getFaweCunks() {
public Collection<FaweChunk> getFaweChunks() {
HashSet<FaweChunk> set = new HashSet<>();
synchronized (blocks) {
Iterator<Map.Entry<Long, Reference<FaweChunk>>> iter = blocks.entrySet().iterator();

Datei anzeigen

@ -80,7 +80,7 @@ public class MCAQueueMap implements IFaweQueueMap {
}
@Override
public Collection<FaweChunk> getFaweCunks() {
public Collection<FaweChunk> getFaweChunks() {
final List<FaweChunk> chunks = new ArrayList<>();
for (Map.Entry<Long, MCAFile> entry : mcaFileMap.entrySet()) {
MCAFile file = entry.getValue();
@ -93,7 +93,7 @@ public class MCAQueueMap implements IFaweQueueMap {
@Override
public void forEachChunk(RunnableVal<FaweChunk> onEach) {
for (FaweChunk chunk : getFaweCunks()) {
for (FaweChunk chunk : getFaweChunks()) {
onEach.run(chunk);
}
}

Datei anzeigen

@ -2,7 +2,7 @@ package com.boydti.fawe.object.brush;
public enum TargetMode {
TARGET_BLOCK_RANGE,
FOWARD_POINT_PITCH,
FORWARD_POINT_PITCH,
TARGET_POINT_HEIGHT,
TARGET_FACE_RANGE,
}

Datei anzeigen

@ -94,7 +94,7 @@ public final class SparseBitSet implements Cloneable, Serializable {
bits (setting, flipping, clearing, etc.) do not attempt to normalize the
set, in the interests of speed. However, when a set is scanned as the
resultant set of some operation, then, in most cases, the set will be
normalized--the exception being level2 areas that are not completly scanned
normalized--the exception being level2 areas that are not completely scanned
in a particular pass.
The sizes of the blocks and areas has been the result of some investigation
@ -2797,4 +2797,4 @@ public final class SparseBitSet implements Cloneable, Serializable {
* Word and block <b>xor</b> strategy.
*/
protected transient XorStrategy xorStrategy;
}
}

Datei anzeigen

@ -63,8 +63,8 @@ public class ReflectionUtils {
T newValue = (T) makeEnum(enumType, // The target enum class
enumName, // THE NEW ENUM INSTANCE TO BE DYNAMICALLY ADDED
values.size(),
additionalTypes, // can be used to pass values to the enum constuctor
additionalValues); // can be used to pass values to the enum constuctor
additionalTypes, // can be used to pass values to the enum constructor
additionalValues); // can be used to pass values to the enum constructor
// 4. add new value
values.add(newValue);
@ -219,9 +219,9 @@ public class ReflectionUtils {
}
//Utils
public static Method makeMethod(final Class<?> clazz, final String methodName, final Class<?>... paramaters) {
public static Method makeMethod(final Class<?> clazz, final String methodName, final Class<?>... parameters) {
try {
return clazz.getDeclaredMethod(methodName, paramaters);
return clazz.getDeclaredMethod(methodName, parameters);
} catch (final NoSuchMethodException ex) {
return null;
} catch (final Exception ex) {
@ -230,13 +230,13 @@ public class ReflectionUtils {
}
@SuppressWarnings("unchecked")
public static <T> T callMethod(final Method method, final Object instance, final Object... paramaters) {
public static <T> T callMethod(final Method method, final Object instance, final Object... parameters) {
if (method == null) {
throw new RuntimeException("No such method");
}
method.setAccessible(true);
try {
return (T) method.invoke(instance, paramaters);
return (T) method.invoke(instance, parameters);
} catch (final InvocationTargetException ex) {
throw new RuntimeException(ex.getCause());
} catch (final Exception ex) {
@ -245,9 +245,9 @@ public class ReflectionUtils {
}
@SuppressWarnings("unchecked")
public static <T> Constructor<T> makeConstructor(final Class<?> clazz, final Class<?>... paramaterTypes) {
public static <T> Constructor<T> makeConstructor(final Class<?> clazz, final Class<?>... parameterTypes) {
try {
return (Constructor<T>) clazz.getConstructor(paramaterTypes);
return (Constructor<T>) clazz.getConstructor(parameterTypes);
} catch (final NoSuchMethodException ex) {
return null;
} catch (final Exception ex) {

Datei anzeigen

@ -4,6 +4,8 @@ import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.object.RunnableVal;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Iterator;
import java.util.concurrent.ForkJoinPool;
@ -21,34 +23,34 @@ public abstract class TaskManager {
/**
* Run a repeating task on the main thread
*
* @param r
* @param runnable
* @param interval in ticks
* @return
*/
public abstract int repeat(final Runnable r, final int interval);
public abstract int repeat(@NotNull final Runnable runnable, final int interval);
/**
* Run a repeating task asynchronously
*
* @param r
* @param runnable
* @param interval in ticks
* @return
*/
public abstract int repeatAsync(final Runnable r, final int interval);
public abstract int repeatAsync(@NotNull final Runnable runnable, final int interval);
/**
* Run a task asynchronously
*
* @param r
* @param runnable
*/
public abstract void async(final Runnable r);
public abstract void async(@NotNull final Runnable runnable);
/**
* Run a task on the main thread
*
* @param r
* @param runnable
*/
public abstract void task(final Runnable r);
public abstract void task(@NotNull final Runnable runnable);
/**
* Get the public ForkJoinPool<br>
@ -149,14 +151,14 @@ public abstract class TaskManager {
* Run a task on the current thread or asynchronously
* - If it's already the main thread, it will jst call run()
*
* @param r
* @param runnable
* @param async
*/
public void taskNow(final Runnable r, boolean async) {
public void taskNow(@NotNull final Runnable runnable, boolean async) {
if (async) {
async(r);
} else if (r != null) {
r.run();
async(runnable);
} else {
runnable.run();
}
}
@ -164,40 +166,37 @@ public abstract class TaskManager {
* Run a task as soon as possible on the main thread
* - Non blocking if not calling from the main thread
*
* @param r
* @param runnable
*/
public void taskNowMain(final Runnable r) {
if (r == null) {
return;
}
public void taskNowMain(@NotNull final Runnable runnable) {
if (Fawe.isMainThread()) {
r.run();
runnable.run();
} else {
task(r);
task(runnable);
}
}
/**
* Run a task as soon as possible not on the main thread
*
* @param r
* @param runnable
* @see com.boydti.fawe.Fawe#isMainThread()
*/
public void taskNowAsync(final Runnable r) {
taskNow(r, Fawe.isMainThread());
public void taskNowAsync(@NotNull final Runnable runnable) {
taskNow(runnable, Fawe.isMainThread());
}
/**
* Run a task on the main thread at the next tick or now async
*
* @param r
* @param runnable
* @param async
*/
public void taskSoonMain(final Runnable r, boolean async) {
public void taskSoonMain(@NotNull final Runnable runnable, boolean async) {
if (async) {
async(r);
async(runnable);
} else {
task(r);
task(runnable);
}
}
@ -205,18 +204,18 @@ public abstract class TaskManager {
/**
* Run a task later on the main thread
*
* @param r
* @param runnable
* @param delay in ticks
*/
public abstract void later(final Runnable r, final int delay);
public abstract void later(@NotNull final Runnable runnable, final int delay);
/**
* Run a task later asynchronously
*
* @param r
* @param runnable
* @param delay in ticks
*/
public abstract void laterAsync(final Runnable r, final int delay);
public abstract void laterAsync(@NotNull final Runnable runnable, final int delay);
/**
* Cancel a task
@ -295,11 +294,11 @@ public abstract class TaskManager {
}
}
public <T> T syncWhenFree(final RunnableVal<T> function) {
public <T> T syncWhenFree(@NotNull final RunnableVal<T> function) {
return syncWhenFree(function, Integer.MAX_VALUE);
}
public void taskWhenFree(Runnable run) {
public void taskWhenFree(@NotNull Runnable run) {
if (Fawe.isMainThread()) {
run.run();
} else {
@ -317,7 +316,7 @@ public abstract class TaskManager {
* @param <T>
* @return
*/
public <T> T syncWhenFree(final RunnableVal<T> function, int timeout) {
public <T> T syncWhenFree(@NotNull final RunnableVal<T> function, int timeout) {
if (Fawe.isMainThread()) {
function.run();
return function.value;
@ -366,7 +365,7 @@ public abstract class TaskManager {
* @param <T>
* @return
*/
public <T> T sync(final RunnableVal<T> function, int timeout) {
public <T> T sync(@NotNull final RunnableVal<T> function, int timeout) {
return sync((Supplier<T>) function, timeout);
}

Datei anzeigen

@ -382,7 +382,7 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
switch (targetMode) {
case TARGET_BLOCK_RANGE:
return offset(trace(editSession, player, getRange(), true), loc).toBlockPoint();
case FOWARD_POINT_PITCH: {
case FORWARD_POINT_PITCH: {
int d = 0;
float pitch = loc.getPitch();
pitch = 23 - (pitch / 4);