Some edits

This commit is contained in:
Paldiu 2021-01-29 21:03:36 -06:00
parent d8b8bedc98
commit 2f5e2acfeb
9 changed files with 37 additions and 11 deletions

View File

@ -17,7 +17,7 @@ import java.util.Arrays;
import java.util.Map;
import java.util.MissingResourceException;
public class CommandLoader {
public final class CommandLoader {
private Reflections reflections;
public synchronized CommandLoader classpath(Class<?> clazz) {

View File

@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
@CommandInfo(name = "defaultcommand", usage = "/<command>", description = "Default plugin command.")
public class DefaultCommand extends SimplexCommand {
public final class DefaultCommand extends SimplexCommand {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
sender.sendMessage("If you are seeing this when running your command, your command didn't register properly.");

View File

@ -5,7 +5,7 @@ import io.github.paldiu.simplexcore.utils.Constants;
import org.bukkit.event.EventHandler;
import org.bukkit.event.server.PluginEnableEvent;
public class ServerPluginListener extends SimplexListener {
public final class ServerPluginListener extends SimplexListener {
@EventHandler
public void pluginRegister(PluginEnableEvent event) {
if (SimplexAddon.class.isAssignableFrom(event.getPlugin().getClass())) {

View File

@ -7,7 +7,7 @@ import org.bukkit.scheduler.BukkitTask;
import java.util.function.Consumer;
public class Cuboid {
public final class Cuboid {
private final int x, y, z;
public Cuboid() {

View File

@ -2,7 +2,7 @@ package io.github.paldiu.simplexcore.plugin;
import io.github.paldiu.simplexcore.utils.Constants;
public class AddonManager {
public final class AddonManager {
public AddonManager() { }
public void disable(SimplexAddon<?> simplexAddon) {

View File

@ -3,7 +3,7 @@ package io.github.paldiu.simplexcore.plugin;
import java.util.HashSet;
import java.util.Set;
public class AddonRegistry {
public final class AddonRegistry {
private final Set<SimplexAddon<?>> components = new HashSet<>();
private static final AddonRegistry instance = new AddonRegistry();

View File

@ -1,17 +1,43 @@
package io.github.paldiu.simplexcore.utils;
public class Bean<T> {
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
public final class Bean<T> {
protected T bean;
public Bean(T bean) {
this.bean = bean;
}
public void setBean(T bean) {
public void set(T bean) {
this.bean = bean;
}
public T getBean() {
public T get() {
return bean;
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(get()).toHashCode();
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Bean<?>)) {
return false;
}
if (obj == this) {
return true;
}
return new EqualsBuilder().append(((Bean<?>) obj).get(), get()).isEquals();
}
@Override
public String toString() {
return get().toString();
}
}

View File

@ -3,7 +3,7 @@ package io.github.paldiu.simplexcore.utils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
public class Trio<A, B, C> {
public final class Trio<A, B, C> {
private final A primary;
private final B secondary;
private final C tertiary;

View File

@ -12,7 +12,7 @@ import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Utilities {
public final class Utilities {
private static <T> Stream<T> feStr(T[] array) {
return Arrays.stream(array);
}