Switch to JSpecify nullness annotations
This commit is contained in:
12 files changed
+51
-51
No files matched your search
+1
-1
@@ -54,7 +54,7 @@ dependencies {
|
||||
exclude("com.google.code.gson", "gson")
|
||||
}
|
||||
|
||||
compileOnly("org.checkerframework", "checker-qual", "3.49.5")
|
||||
compileOnly("org.jspecify:jspecify:1.0.0")
|
||||
compileOnly("dev.folia", "folia-api", "1.19.4-R0.1-SNAPSHOT")
|
||||
compileOnly("me.clip", "placeholderapi", "2.11.6")
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package xyz.jpenilla.pluginbase.legacy;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@@ -15,12 +9,18 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import xyz.jpenilla.pluginbase.legacy.compatability.PlaceholderAPIHook;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@NullMarked
|
||||
@SuppressWarnings("unused")
|
||||
public class Chat {
|
||||
private final PluginBase plugin;
|
||||
|
||||
@@ -2,7 +2,7 @@ package xyz.jpenilla.pluginbase.legacy;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
|
||||
public final class ChatCentering {
|
||||
private ChatCentering() {
|
||||
|
||||
@@ -3,10 +3,9 @@ package xyz.jpenilla.pluginbase.legacy;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
@NullMarked
|
||||
public final class ComponentUtil {
|
||||
private static final LegacyComponentSerializer SERIALIZER = LegacyComponentSerializer.builder()
|
||||
.hexColors()
|
||||
|
||||
@@ -23,15 +23,16 @@
|
||||
*/
|
||||
package xyz.jpenilla.pluginbase.legacy;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.checkerframework.common.reflection.qual.ForName;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Arrays;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.common.reflection.qual.ForName;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package xyz.jpenilla.pluginbase.legacy;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@NullMarked
|
||||
public class Environment {
|
||||
private static final boolean paper;
|
||||
private static final int majorMinecraftVersion;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package xyz.jpenilla.pluginbase.legacy;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Function;
|
||||
import org.bukkit.conversations.BooleanPrompt;
|
||||
import org.bukkit.conversations.ConversationAbandonedListener;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
@@ -13,11 +9,15 @@ import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Function;
|
||||
|
||||
@NullMarked
|
||||
public class InputConversation {
|
||||
private final Plugin plugin;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package xyz.jpenilla.pluginbase.legacy;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
@NullMarked
|
||||
public final class MiniMessageUtil {
|
||||
private MiniMessageUtil() {
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package xyz.jpenilla.pluginbase.legacy;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import java.lang.reflect.Method;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@NullMarked
|
||||
public final class PaperComponentUtil {
|
||||
private static final String KYORI_PREFIX = String.join(".", "net", "kyori");
|
||||
private static final @Nullable Object NATIVE_GSON;
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
package xyz.jpenilla.pluginbase.legacy;
|
||||
|
||||
import io.papermc.paper.threadedregions.RegionizedServerInitEvent;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import xyz.jpenilla.pluginbase.legacy.compatability.PlaceholderAPIHook;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public abstract class PluginBase extends JavaPlugin {
|
||||
private static PluginBase instance;
|
||||
private Chat chat;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package xyz.jpenilla.pluginbase.legacy;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -2,10 +2,9 @@ package xyz.jpenilla.pluginbase.legacy.compatability;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
@NullMarked
|
||||
public final class PlaceholderAPIHook {
|
||||
public String replacePlaceholders(final Player player, final String msg) {
|
||||
return PlaceholderAPI.setPlaceholders(player, msg);
|
||||
|
||||
Reference in new issue
Block a user