diff --git a/src/main/java/city/norain/slimefun4/EnvironmentChecker.java b/src/main/java/city/norain/slimefun4/EnvironmentChecker.java index f44cd80c7c..e60227bcb3 100644 --- a/src/main/java/city/norain/slimefun4/EnvironmentChecker.java +++ b/src/main/java/city/norain/slimefun4/EnvironmentChecker.java @@ -11,7 +11,7 @@ class EnvironmentChecker { private static final List UNSUPPORTED_PLUGINS = List.of( "BedrockTechnology", "SlimefunFix", "SlimefunBugFixer", "Slimefunbookfix", "PlaceItemsOnGroundRebuilt"); - static boolean checkIncompatiblePlugins(@Nonnull Logger logger) { + static boolean checkIncompatiblePlugins(Logger logger) { List plugins = UNSUPPORTED_PLUGINS.stream() .filter(name -> Bukkit.getServer().getPluginManager().isPluginEnabled(name)) .toList(); @@ -53,7 +53,7 @@ static boolean checkHybridServer() { } } - static void scheduleSlimeGlueCheck(@Nonnull Slimefun sf) { + static void scheduleSlimeGlueCheck(Slimefun sf) { Bukkit.getScheduler() .runTaskLater( sf, @@ -66,7 +66,7 @@ static void scheduleSlimeGlueCheck(@Nonnull Slimefun sf) { 300); // 15s } - private static void printBorder(@Nonnull Logger logger) { + private static void printBorder(Logger logger) { logger.log(Level.WARNING, "#######################################################"); } } diff --git a/src/main/java/city/norain/slimefun4/SlimefunExtended.java b/src/main/java/city/norain/slimefun4/SlimefunExtended.java index adacde99bb..84a0830229 100644 --- a/src/main/java/city/norain/slimefun4/SlimefunExtended.java +++ b/src/main/java/city/norain/slimefun4/SlimefunExtended.java @@ -18,7 +18,7 @@ private static void checkDebug() { } } - public static boolean checkEnvironment(@Nonnull Slimefun sf) { + public static boolean checkEnvironment(Slimefun sf) { if (EnvironmentChecker.checkHybridServer()) { sf.getLogger().log(Level.WARNING, "#######################################################"); sf.getLogger().log(Level.WARNING, ""); @@ -47,7 +47,7 @@ public static boolean checkEnvironment(@Nonnull Slimefun sf) { } } - public static void register(@Nonnull Slimefun sf) { + public static void register(Slimefun sf) { EnvironmentChecker.scheduleSlimeGlueCheck(sf); checkDebug(); diff --git a/src/main/java/city/norain/slimefun4/VaultIntegration.java b/src/main/java/city/norain/slimefun4/VaultIntegration.java index 1e1d28beb1..998656976c 100644 --- a/src/main/java/city/norain/slimefun4/VaultIntegration.java +++ b/src/main/java/city/norain/slimefun4/VaultIntegration.java @@ -13,7 +13,7 @@ public class VaultIntegration { private static Economy econ = null; - protected static void register(@Nonnull Slimefun plugin) { + protected static void register(Slimefun plugin) { if (plugin.getServer().getPluginManager().isPluginEnabled("Vault")) { var rsp = plugin.getServer().getServicesManager().getRegistration(Economy.class); if (rsp != null) { diff --git a/src/main/java/city/norain/slimefun4/listener/SlimefunMigrateListener.java b/src/main/java/city/norain/slimefun4/listener/SlimefunMigrateListener.java index 3756299cc5..3ba8f84a38 100644 --- a/src/main/java/city/norain/slimefun4/listener/SlimefunMigrateListener.java +++ b/src/main/java/city/norain/slimefun4/listener/SlimefunMigrateListener.java @@ -21,7 +21,7 @@ public void onPlayerJoin(PlayerJoinEvent e) { } } - public void register(@Nonnull Slimefun plugin) { + public void register(Slimefun plugin) { plugin.getServer().getPluginManager().registerEvents(this, plugin); } } diff --git a/src/main/java/city/norain/slimefun4/timings/SQLProfiler.java b/src/main/java/city/norain/slimefun4/timings/SQLProfiler.java index 1272575efa..43a883c810 100644 --- a/src/main/java/city/norain/slimefun4/timings/SQLProfiler.java +++ b/src/main/java/city/norain/slimefun4/timings/SQLProfiler.java @@ -50,7 +50,7 @@ public void start() { isProfiling = true; } - public void subscribe(@Nonnull CommandSender sender) { + public void subscribe(CommandSender sender) { subscribers.add(sender); } diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/autocrafter/CrafterSmartPort.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/autocrafter/CrafterSmartPort.java index 16131a76e7..81592c8307 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/autocrafter/CrafterSmartPort.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/autocrafter/CrafterSmartPort.java @@ -64,14 +64,14 @@ public boolean onClick( } @Override - public boolean canOpen(@Nonnull Block b, @Nonnull Player p) { + public boolean canOpen(Block b, Player p) { return p.hasPermission("slimefun.inventory.bypass") || Slimefun.getProtectionManager() .hasPermission(p, b.getLocation(), Interaction.INTERACT_BLOCK); } @Override - public void newInstance(@Nonnull BlockMenu menu, @Nonnull Block b) { + public void newInstance(BlockMenu menu, Block b) { // Resume the ingredient count String countStr = StorageCacheUtils.getData(b.getLocation(), "ingredientCount"); if (countStr != null) { @@ -114,7 +114,7 @@ public void preRegister() { addItemHandler(new BlockBreakHandler(false, true) { @Override public void onPlayerBreak( - @Nonnull BlockBreakEvent e, @Nonnull ItemStack item, @Nonnull List drops) { + BlockBreakEvent e, ItemStack item, List drops) { BlockMenu inv = StorageCacheUtils.getMenu(e.getBlock().getLocation()); if (inv != null) { for (int slot : INPUT_SLOTS) { diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/common/RecordKey.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/common/RecordKey.java index 90d409a68c..a5335e01d2 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/common/RecordKey.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/common/RecordKey.java @@ -39,7 +39,7 @@ public void addField(FieldKey field) { changed = true; } - @Nonnull + public Set getFields() { return Collections.unmodifiableSet(fields); } @@ -55,7 +55,7 @@ public void addCondition(FieldKey key, boolean val) { addCondition(key, val ? "1" : "0"); } - @Nonnull + public List> getConditions() { return Collections.unmodifiableList(conditions); } diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/common/ScopeKey.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/common/ScopeKey.java index 989748bd5e..7bb8a59965 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/common/ScopeKey.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/common/ScopeKey.java @@ -9,7 +9,7 @@ public ScopeKey(DataScope scope) { this.scope = scope; } - @Nonnull + public DataScope getScope() { return scope; } diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/ASlimefunDataContainer.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/ASlimefunDataContainer.java index e7a6f84a69..ee8d87221b 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/ASlimefunDataContainer.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/ASlimefunDataContainer.java @@ -56,13 +56,13 @@ protected void checkData() { } } - @Nonnull + public Map getAllData() { checkData(); return Collections.unmodifiableMap(data); } - @Nonnull + public Set getDataKeys() { checkData(); return Collections.unmodifiableSet(data.keySet()); @@ -73,7 +73,7 @@ public Set getDataKeys() { return getCacheInternal(key); } - @Nonnull + public String getKey() { return key; } diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataConfigWrapper.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataConfigWrapper.java index ba6fa0be8a..f4e1820162 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataConfigWrapper.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataConfigWrapper.java @@ -25,19 +25,19 @@ public void save() {} public void createFile() {} @Override - public String getString(@Nonnull String path) { + public String getString(String path) { return blockData.getData(path); } - @Nonnull + @Override public Set getKeys() { return new HashSet<>(blockData.getAllData().keySet()); } - @Nonnull + @Override - public Set getKeys(@Nonnull String path) { + public Set getKeys(String path) { return getKeys(); } @@ -47,12 +47,12 @@ public File getFile() { } @Override - public boolean contains(@Nonnull String path) { + public boolean contains(String path) { return getString(path) != null; } @Nullable @Override - public Object getValue(@Nonnull String path) { + public Object getValue(String path) { return getString(path); } @@ -62,7 +62,7 @@ public FileConfiguration getConfiguration() { } @Override - public void setDefaultValue(@Nonnull String path, @Nullable Object value) { + public void setDefaultValue(String path, @Nullable Object value) { if (!(value instanceof String str)) { throw new NotImplementedException(); } @@ -72,7 +72,7 @@ public void setDefaultValue(@Nonnull String path, @Nullable Object value) { } @Override - public void setValue(@Nonnull String path, Object value) { + public void setValue(String path, Object value) { if (!(value instanceof String str)) { throw new NotImplementedException(); } @@ -80,7 +80,7 @@ public void setValue(@Nonnull String path, Object value) { } @Override - public void save(@Nonnull File file) {} + public void save(File file) {} @Override public void reload() {} diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataController.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataController.java index 8a8be2c2ca..86001c3c23 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataController.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/BlockDataController.java @@ -144,7 +144,7 @@ public void setDelayedSavingEnable(boolean isEnable) { * @param sfId slimefun block id {@link SlimefunItem#getId()} * @return {@link SlimefunBlockData} */ - @Nonnull + public SlimefunBlockData createBlock(Location l, String sfId) { checkDestroy(); var re = getChunkDataCache(l.getChunk(), true).createBlockData(l, sfId); diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/ProfileDataController.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/ProfileDataController.java index fd5fd8f200..1c3faab83e 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/ProfileDataController.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/controller/ProfileDataController.java @@ -136,7 +136,7 @@ public void getProfileAsync(OfflinePlayer p, IAsyncReadCallback c return re; } - @Nonnull + private ItemStack[] getBackpackInv(String uuid, int size) { var key = new RecordKey(DataScope.BACKPACK_INVENTORY); key.addField(FieldKey.INVENTORY_SLOT); @@ -151,7 +151,7 @@ private ItemStack[] getBackpackInv(String uuid, int size) { return re; } - @Nonnull + private Set getUnlockedResearchKeys(String uuid) { var key = new RecordKey(DataScope.PLAYER_RESEARCH); key.addField(FieldKey.RESEARCH_ID); @@ -175,7 +175,7 @@ public void getBackpackAsync(String uuid, IAsyncReadCallback cal scheduleReadTask(() -> invokeCallback(callback, getBackpack(uuid))); } - @Nonnull + public Set getBackpacks(String pUuid) { checkDestroy(); var key = new RecordKey(DataScope.BACKPACK_PROFILE); @@ -199,7 +199,7 @@ public void getBackpacksAsync(String pUuid, IAsyncReadCallback(); } - @Nonnull + public Chunk getChunk() { return chunk; } - @Nonnull + @ParametersAreNonnullByDefault public SlimefunBlockData createBlockData(Location l, String sfId) { var lKey = LocationUtils.getLocKey(l); diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/event/SlimefunChunkDataLoadEvent.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/event/SlimefunChunkDataLoadEvent.java index 68d6a54218..3d8cfee537 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/event/SlimefunChunkDataLoadEvent.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/event/SlimefunChunkDataLoadEvent.java @@ -27,12 +27,12 @@ public Chunk getChunk() { return chunkData.getChunk(); } - public static @Nonnull HandlerList getHandlerList() { + public static HandlerList getHandlerList() { return handlers; } @Override - public @Nonnull HandlerList getHandlers() { + public HandlerList getHandlers() { return getHandlerList(); } } diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/migrator/PlayerProfileMigrator.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/migrator/PlayerProfileMigrator.java index aa7bcd2503..696d1fe7df 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/migrator/PlayerProfileMigrator.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/migrator/PlayerProfileMigrator.java @@ -101,7 +101,7 @@ public MigrateStatus migrateData() { return result; } - private void migratePlayerProfile(@Nonnull OfflinePlayer p) { + private void migratePlayerProfile(OfflinePlayer p) { var uuid = p.getUniqueId(); var configFile = new Config("data-storage/Slimefun/Players/" + uuid + ".yml"); diff --git a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/task/DatabaseThreadFactory.java b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/task/DatabaseThreadFactory.java index 5a7891ab79..b0a92f7c25 100644 --- a/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/task/DatabaseThreadFactory.java +++ b/src/main/java/com/xzavier0722/mc/plugin/slimefun4/storage/task/DatabaseThreadFactory.java @@ -8,7 +8,7 @@ public class DatabaseThreadFactory implements ThreadFactory { private final AtomicInteger threadCount = new AtomicInteger(0); @Override - public Thread newThread(@Nonnull Runnable r) { + public Thread newThread(Runnable r) { return new Thread(r, "SF-Database-Thread #" + threadCount.getAndIncrement()); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/ErrorReport.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/ErrorReport.java index f8038f069f..e7795f347a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/ErrorReport.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/ErrorReport.java @@ -144,7 +144,7 @@ public ErrorReport(T throwable, SlimefunItem item) { * * @return The {@link File} for this {@link ErrorReport} */ - public @Nonnull File getFile() { + public File getFile() { return file; } @@ -153,7 +153,7 @@ public ErrorReport(T throwable, SlimefunItem item) { * * @return The {@link Throwable} */ - public @Nonnull T getThrown() { + public T getThrown() { return throwable; } @@ -166,7 +166,7 @@ public static int count() { return count.get(); } - private void print(@Nonnull Consumer printer) { + private void print(Consumer printer) { this.file = getNewFile(); count.incrementAndGet(); @@ -236,7 +236,7 @@ private void print(@Nonnull Consumer printer) { } } - private static void scanPlugins(@Nonnull List plugins, @Nonnull List addons) { + private static void scanPlugins(List plugins, List addons) { String dependency = "Slimefun"; for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { @@ -262,7 +262,7 @@ private static void scanPlugins(@Nonnull List plugins, @Nonnull List plugins, @Nonnull List> function, @Nonnull Runnable runnable) { + Function> function, Runnable runnable) { try { runnable.run(); } catch (Exception x) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java index 2c079f920b..c5007d4fcc 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java @@ -67,7 +67,7 @@ public enum MinecraftVersion { * @param name * The display name of this {@link MinecraftVersion} */ - MinecraftVersion(int majorVersion, @Nonnull String name) { + MinecraftVersion(int majorVersion, String name) { this.name = name; this.majorVersion = majorVersion; this.virtual = false; @@ -83,7 +83,7 @@ public enum MinecraftVersion { * @param virtual * Whether this {@link MinecraftVersion} is virtual */ - MinecraftVersion(@Nonnull String name, boolean virtual) { + MinecraftVersion(String name, boolean virtual) { this.name = name; this.majorVersion = 0; this.virtual = virtual; @@ -94,7 +94,7 @@ public enum MinecraftVersion { * * @return The name of this {@link MinecraftVersion} */ - public @Nonnull String getName() { + public String getName() { return name; } @@ -140,7 +140,7 @@ public boolean isMinecraftVersion(int minecraftVersion) { * * @return Whether this {@link MinecraftVersion} is newer or equal to the given {@link MinecraftVersion} */ - public boolean isAtLeast(@Nonnull MinecraftVersion version) { + public boolean isAtLeast(MinecraftVersion version) { Validate.notNull(version, "A Minecraft version cannot be null!"); if (this == UNKNOWN) { @@ -160,7 +160,7 @@ public boolean isAtLeast(@Nonnull MinecraftVersion version) { * * @return Whether this {@link MinecraftVersion} is older than the given one */ - public boolean isBefore(@Nonnull MinecraftVersion version) { + public boolean isBefore(MinecraftVersion version) { Validate.notNull(version, "A Minecraft version cannot be null!"); if (this == UNKNOWN) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/SlimefunAddon.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/SlimefunAddon.java index 376eafaa77..a8fd859962 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/SlimefunAddon.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/SlimefunAddon.java @@ -31,7 +31,7 @@ public interface SlimefunAddon { * * @return The instance of your {@link JavaPlugin} */ - @Nonnull + JavaPlugin getJavaPlugin(); /** @@ -47,7 +47,7 @@ public interface SlimefunAddon { * * @return The Name of this {@link SlimefunAddon} */ - default @Nonnull String getName() { + default String getName() { return getJavaPlugin().getName(); } @@ -57,7 +57,7 @@ public interface SlimefunAddon { * * @return The version of this {@link SlimefunAddon} */ - default @Nonnull String getPluginVersion() { + default String getPluginVersion() { return getJavaPlugin().getDescription().getVersion(); } @@ -67,7 +67,7 @@ public interface SlimefunAddon { * * @return The {@link Logger} of this {@link SlimefunAddon} */ - default @Nonnull Logger getLogger() { + default Logger getLogger() { return getJavaPlugin().getLogger(); } @@ -82,7 +82,7 @@ public interface SlimefunAddon { * * @return Whether this {@link SlimefunAddon} depends on the given {@link Plugin} */ - default boolean hasDependency(@Nonnull String dependency) { + default boolean hasDependency(String dependency) { Validate.notNull(dependency, "The dependency cannot be null"); // Well... it cannot depend on itself but you get the idea. diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AncientAltarCraftEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AncientAltarCraftEvent.java index 1354bddf22..1253a3b8dd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AncientAltarCraftEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AncientAltarCraftEvent.java @@ -49,7 +49,7 @@ public AncientAltarCraftEvent(ItemStack output, Block block, Player player) { * * @return the main altar's block {@link Block} */ - @Nonnull + public Block getAltarBlock() { return block; } @@ -59,7 +59,7 @@ public Block getAltarBlock() { * * @return the {@link ItemStack} that would be dropped by the {@link AncientAltar} */ - @Nonnull + public ItemStack getItem() { return output; } @@ -88,12 +88,12 @@ public void setCancelled(boolean cancel) { cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AndroidFarmEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AndroidFarmEvent.java index 41d6fab59f..4811d39622 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AndroidFarmEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AndroidFarmEvent.java @@ -35,7 +35,7 @@ public class AndroidFarmEvent extends Event implements Cancellable { * @param drop The item to be dropped or null */ public AndroidFarmEvent( - @Nonnull Block block, @Nonnull AndroidInstance android, boolean isAdvanced, @Nullable ItemStack drop) { + Block block, AndroidInstance android, boolean isAdvanced, @Nullable ItemStack drop) { this.block = block; this.android = android; this.isAdvanced = isAdvanced; @@ -47,7 +47,7 @@ public AndroidFarmEvent( * * @return the mined {@link Block} */ - @Nonnull + public Block getBlock() { return block; } @@ -85,7 +85,7 @@ public void setDrop(@Nullable ItemStack drop) { * * @return the involved {@link AndroidInstance} */ - @Nonnull + public AndroidInstance getAndroid() { return android; } @@ -100,12 +100,12 @@ public void setCancelled(boolean cancel) { cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AndroidMineEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AndroidMineEvent.java index 9a74a2a474..bba40984d7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AndroidMineEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AndroidMineEvent.java @@ -40,7 +40,7 @@ public AndroidMineEvent(Block block, AndroidInstance android) { * * @return the mined {@link Block} */ - @Nonnull + public Block getBlock() { return block; } @@ -51,7 +51,7 @@ public Block getBlock() { * * @return the involved {@link AndroidInstance} */ - @Nonnull + public AndroidInstance getAndroid() { return android; } @@ -66,12 +66,12 @@ public void setCancelled(boolean cancel) { cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncAutoEnchanterProcessEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncAutoEnchanterProcessEvent.java index 1cc1eaf6e2..b0fb8d48d4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncAutoEnchanterProcessEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncAutoEnchanterProcessEvent.java @@ -26,7 +26,7 @@ public class AsyncAutoEnchanterProcessEvent extends Event implements Cancellable private boolean cancelled; public AsyncAutoEnchanterProcessEvent( - @Nonnull ItemStack item, @Nonnull ItemStack enchantedBook, @Nonnull BlockMenu menu) { + ItemStack item, ItemStack enchantedBook, BlockMenu menu) { super(true); Validate.notNull(item, "The item to enchant cannot be null!"); @@ -43,7 +43,7 @@ public AsyncAutoEnchanterProcessEvent( * * @return The {@link ItemStack} that is being enchanted */ - @Nonnull + public ItemStack getItem() { return item; } @@ -53,7 +53,7 @@ public ItemStack getItem() { * * @return The {@link ItemStack} that is being used enchanted book */ - @Nonnull + public ItemStack getEnchantedBook() { return enchantedBook; } @@ -63,17 +63,17 @@ public ItemStack getEnchantedBook() { * * @return The {@link BlockMenu} of {@link AutoEnchanter} that is enchanting item */ - @Nonnull + public BlockMenu getMenu() { return menu; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncMachineOperationFinishEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncMachineOperationFinishEvent.java index 9a3a628e47..1265b87198 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncMachineOperationFinishEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncMachineOperationFinishEvent.java @@ -38,7 +38,7 @@ public AsyncMachineOperationFinishEvent( * * @return The {@link BlockPosition} of the machine */ - @Nonnull + public BlockPosition getPosition() { return position; } @@ -61,12 +61,12 @@ public BlockPosition getPosition() { return machineOperation; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncProfileLoadEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncProfileLoadEvent.java index e51be3b205..ba18cbf6fe 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncProfileLoadEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AsyncProfileLoadEvent.java @@ -26,7 +26,7 @@ public class AsyncProfileLoadEvent extends Event { private final UUID uniqueId; private PlayerProfile profile; - public AsyncProfileLoadEvent(@Nonnull PlayerProfile profile) { + public AsyncProfileLoadEvent(PlayerProfile profile) { super(true); Validate.notNull(profile, "The Profile cannot be null"); @@ -35,12 +35,12 @@ public AsyncProfileLoadEvent(@Nonnull PlayerProfile profile) { this.profile = profile; } - @Nonnull + public UUID getPlayerUUID() { return uniqueId; } - @Nonnull + public PlayerProfile getProfile() { return profile; } @@ -52,19 +52,19 @@ public PlayerProfile getProfile() { * @param profile * The {@link PlayerProfile} */ - public void setProfile(@Nonnull PlayerProfile profile) { + public void setProfile(PlayerProfile profile) { Validate.notNull(profile, "The PlayerProfile cannot be null!"); Validate.isTrue(profile.getUUID().equals(uniqueId), "Cannot inject a PlayerProfile with a different UUID"); this.profile = profile; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AutoDisenchantEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AutoDisenchantEvent.java index d77d787cc1..407c82923f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AutoDisenchantEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AutoDisenchantEvent.java @@ -20,7 +20,7 @@ public class AutoDisenchantEvent extends Event implements Cancellable { private final ItemStack item; private boolean cancelled; - public AutoDisenchantEvent(@Nonnull ItemStack item) { + public AutoDisenchantEvent(ItemStack item) { super(true); this.item = item; @@ -31,7 +31,7 @@ public AutoDisenchantEvent(@Nonnull ItemStack item) { * * @return The {@link ItemStack} that is being disenchanted */ - @Nonnull + public ItemStack getItem() { return item; } @@ -46,12 +46,12 @@ public void setCancelled(boolean cancel) { this.cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AutoEnchantEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AutoEnchantEvent.java index 0ce7b14299..a27ab15e0d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AutoEnchantEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/AutoEnchantEvent.java @@ -22,7 +22,7 @@ public class AutoEnchantEvent extends Event implements Cancellable { private final ItemStack item; private boolean cancelled; - public AutoEnchantEvent(@Nonnull ItemStack item) { + public AutoEnchantEvent(ItemStack item) { super(true); this.item = item; @@ -33,7 +33,7 @@ public AutoEnchantEvent(@Nonnull ItemStack item) { * * @return The {@link ItemStack} that is being enchanted */ - @Nonnull + public ItemStack getItem() { return item; } @@ -48,12 +48,12 @@ public void setCancelled(boolean cancel) { this.cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/BlockPlacerPlaceEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/BlockPlacerPlaceEvent.java index 0e288b52fb..33e96e3bf6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/BlockPlacerPlaceEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/BlockPlacerPlaceEvent.java @@ -51,7 +51,7 @@ public BlockPlacerPlaceEvent(Block blockPlacer, ItemStack placedItem, Block bloc * * @return The {@link BlockPlacer} */ - @Nonnull + public Block getBlockPlacer() { return blockPlacer; } @@ -61,7 +61,7 @@ public Block getBlockPlacer() { * * @return The placed {@link ItemStack} */ - @Nonnull + public ItemStack getItemStack() { return placedItem; } @@ -72,7 +72,7 @@ public ItemStack getItemStack() { * @param item * The {@link ItemStack} to be placed */ - public void setItemStack(@Nonnull ItemStack item) { + public void setItemStack(ItemStack item) { Validate.notNull(item, "The ItemStack must not be null!"); if (!locked) { @@ -105,12 +105,12 @@ public void setImmutable() { locked = true; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ClimbingPickLaunchEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ClimbingPickLaunchEvent.java index 06a8cff8fd..a990ad65da 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ClimbingPickLaunchEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ClimbingPickLaunchEvent.java @@ -48,7 +48,7 @@ public ClimbingPickLaunchEvent( * * @return The {@link Vector} of the applied velocity */ - @Nonnull + public Vector getVelocity() { return velocity; } @@ -59,7 +59,7 @@ public Vector getVelocity() { * @param velocity * The {@link Vector} velocity to apply */ - public void setVelocity(@Nonnull Vector velocity) { + public void setVelocity(Vector velocity) { Validate.notNull(velocity); this.velocity = velocity; } @@ -69,7 +69,7 @@ public void setVelocity(@Nonnull Vector velocity) { * * @return The {@link ClimbingPick} that was used */ - @Nonnull + public ClimbingPick getPick() { return pick; } @@ -79,7 +79,7 @@ public ClimbingPick getPick() { * * @return The {@link ItemStack} that was used */ - @Nonnull + public ItemStack getItemStack() { return itemStack; } @@ -89,7 +89,7 @@ public ItemStack getItemStack() { * * @return The {@link Block} that was climbed */ - @Nonnull + public Block getBlock() { return block; } @@ -104,12 +104,12 @@ public void setCancelled(boolean cancel) { this.cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/CoolerFeedPlayerEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/CoolerFeedPlayerEvent.java index ffae0a3a01..c3c0293cd4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/CoolerFeedPlayerEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/CoolerFeedPlayerEvent.java @@ -44,7 +44,7 @@ public CoolerFeedPlayerEvent(Player player, Cooler cooler, ItemStack coolerItem, * * @return The {@link Cooler} that was used */ - @Nonnull + public Cooler getCooler() { return cooler; } @@ -54,7 +54,7 @@ public Cooler getCooler() { * * @return The {@link Cooler} that was used */ - @Nonnull + public ItemStack getCoolerItem() { return coolerItem; } @@ -65,7 +65,7 @@ public ItemStack getCoolerItem() { * * @return The {@link ItemStack} that was consumed */ - @Nonnull + public ItemStack getConsumedItem() { return consumedItem.clone(); } @@ -78,7 +78,7 @@ public ItemStack getConsumedItem() { * * @param item The new {@link ItemStack} */ - public void setConsumedItem(@Nonnull ItemStack item) { + public void setConsumedItem(ItemStack item) { Validate.notNull(item, "The consumed Item cannot be null!"); Validate.isTrue(item.getItemMeta() instanceof PotionMeta, "The item must be a potion!"); @@ -95,12 +95,12 @@ public void setCancelled(boolean cancel) { this.cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ExplosiveToolBreakBlocksEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ExplosiveToolBreakBlocksEvent.java index 0a3676197e..98be87178b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ExplosiveToolBreakBlocksEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ExplosiveToolBreakBlocksEvent.java @@ -54,7 +54,7 @@ public ExplosiveToolBreakBlocksEvent( * * @return The primary broken {@link Block} */ - @Nonnull + public Block getPrimaryBlock() { return this.mainBlock; } @@ -64,7 +64,7 @@ public Block getPrimaryBlock() { * * @return The broken blocks */ - @Nonnull + public List getAdditionalBlocks() { return this.additionalBlocks; } @@ -74,7 +74,7 @@ public List getAdditionalBlocks() { * * @return the {@link ExplosiveTool} that was involved */ - @Nonnull + public ExplosiveTool getExplosiveTool() { return this.explosiveTool; } @@ -84,7 +84,7 @@ public ExplosiveTool getExplosiveTool() { * * @return The {@link ItemStack} in the hand of the {@link Player} */ - @Nonnull + public ItemStack getItemInHand() { return this.itemInHand; } @@ -99,12 +99,12 @@ public void setCancelled(boolean cancel) { this.cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/GEOResourceGenerationEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/GEOResourceGenerationEvent.java index f0b2c60acb..a1f69cbc4e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/GEOResourceGenerationEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/GEOResourceGenerationEvent.java @@ -77,7 +77,7 @@ public void setValue(int value) { * * @return The affected {@link World} */ - @Nonnull + public World getWorld() { return world; } @@ -87,7 +87,7 @@ public World getWorld() { * * @return The generated {@link GEOResource} */ - @Nonnull + public GEOResource getResource() { return resource; } @@ -118,7 +118,7 @@ public int getChunkZ() { * * @return The {@link Environment} of this generation */ - @Nonnull + public Environment getEnvironment() { return world.getEnvironment(); } @@ -129,7 +129,7 @@ public Environment getEnvironment() { * * @return The {@link Biome} of this generation */ - @Nonnull + public Biome getBiome() { return biome; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockCraftEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockCraftEvent.java index 3063589a95..6e858d82a0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockCraftEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockCraftEvent.java @@ -61,7 +61,7 @@ public MultiBlockCraftEvent(Player p, MultiBlockMachine machine, ItemStack input * * @return The {@link MultiBlockMachine} used to craft. */ - public @Nonnull MultiBlockMachine getMachine() { + public MultiBlockMachine getMachine() { return machine; } @@ -70,7 +70,7 @@ public MultiBlockCraftEvent(Player p, MultiBlockMachine machine, ItemStack input * * @return The {@link ItemStack ItemStack[]} input that is used in the craft. */ - public @Nonnull ItemStack[] getInput() { + public ItemStack[] getInput() { return input; } @@ -79,7 +79,7 @@ public MultiBlockCraftEvent(Player p, MultiBlockMachine machine, ItemStack input * * @return The {@link ItemStack} output that results from the craft. */ - public @Nonnull ItemStack getOutput() { + public ItemStack getOutput() { return output; } @@ -107,12 +107,12 @@ public void setCancelled(boolean cancel) { this.cancelled = cancel; } - public static @Nonnull HandlerList getHandlerList() { + public static HandlerList getHandlerList() { return handlers; } @Override - public @Nonnull HandlerList getHandlers() { + public HandlerList getHandlers() { return getHandlerList(); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockInteractEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockInteractEvent.java index 1a8f85520e..4f1a04fdf2 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockInteractEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/MultiBlockInteractEvent.java @@ -38,7 +38,7 @@ public MultiBlockInteractEvent(Player p, MultiBlock mb, Block clicked, BlockFace * * @return The {@link MultiBlock} of this {@link MultiBlockInteractEvent} */ - @Nonnull + public MultiBlock getMultiBlock() { return multiBlock; } @@ -48,7 +48,7 @@ public MultiBlock getMultiBlock() { * * @return The {@link Block} that was clicked */ - @Nonnull + public Block getClickedBlock() { return clickedBlock; } @@ -58,7 +58,7 @@ public Block getClickedBlock() { * * @return The {@link BlockFace} that was clicked */ - @Nonnull + public BlockFace getClickedFace() { return clickedFace; } @@ -73,12 +73,12 @@ public void setCancelled(boolean cancel) { this.cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerLanguageChangeEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerLanguageChangeEvent.java index 373ce2f4b9..30836165fb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerLanguageChangeEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerLanguageChangeEvent.java @@ -22,7 +22,7 @@ public class PlayerLanguageChangeEvent extends Event { private final Language from; private final Language to; - public PlayerLanguageChangeEvent(@Nonnull Player p, @Nonnull Language from, @Nonnull Language to) { + public PlayerLanguageChangeEvent(Player p, Language from, Language to) { player = p; this.from = from; this.to = to; @@ -34,7 +34,7 @@ public PlayerLanguageChangeEvent(@Nonnull Player p, @Nonnull Language from, @Non * * @return The {@link Player} who switched his {@link Language} */ - @Nonnull + public Player getPlayer() { return player; } @@ -44,7 +44,7 @@ public Player getPlayer() { * * @return The previous {@link Language} of our {@link Player} */ - @Nonnull + public Language getPreviousLanguage() { return from; } @@ -54,7 +54,7 @@ public Language getPreviousLanguage() { * * @return The new {@link Language} */ - @Nonnull + public Language getNewLanguage() { return to; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerPreResearchEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerPreResearchEvent.java index c8e2859cc4..5323894282 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerPreResearchEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerPreResearchEvent.java @@ -42,27 +42,27 @@ public PlayerPreResearchEvent(Player p, Research research, SlimefunItem slimefun this.slimefunItem = slimefunItem; } - @Nonnull + public Player getPlayer() { return player; } - @Nonnull + public Research getResearch() { return research; } - @Nonnull + public SlimefunItem getSlimefunItem() { return slimefunItem; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerRightClickEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerRightClickEvent.java index 92f03399c1..51597a436f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerRightClickEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerRightClickEvent.java @@ -56,7 +56,7 @@ public class PlayerRightClickEvent extends PlayerEvent { * @param originalEvent * The original {@link PlayerInteractEvent} */ - public PlayerRightClickEvent(@Nonnull PlayerInteractEvent originalEvent) { + public PlayerRightClickEvent(PlayerInteractEvent originalEvent) { super(originalEvent.getPlayer()); event = originalEvent; @@ -82,7 +82,7 @@ public PlayerRightClickEvent(@Nonnull PlayerInteractEvent originalEvent) { * * @return The original {@link PlayerInteractEvent} */ - @Nonnull + public PlayerInteractEvent getInteractEvent() { return event; } @@ -94,7 +94,7 @@ public PlayerInteractEvent getInteractEvent() { * * @return The {@link ItemStack} that the {@link Player} right clicked with */ - @Nonnull + public ItemStack getItem() { return itemStack.orElse(new ItemStack(Material.AIR)); } @@ -105,22 +105,22 @@ public ItemStack getItem() { * * @return The hand used in this {@link Event} */ - @Nonnull + public EquipmentSlot getHand() { return hand; } - @Nonnull + public Optional getClickedBlock() { return clickedBlock; } - @Nonnull + public BlockFace getClickedFace() { return face; } - @Nonnull + public Optional getSlimefunItem() { if (!slimefunItem.isComputed()) { if (itemStack.isPresent()) { @@ -133,7 +133,7 @@ public Optional getSlimefunItem() { return slimefunItem.getAsOptional(); } - @Nonnull + public Optional getSlimefunBlock() { if (!slimefunBlock.isComputed()) { if (clickedBlock.isPresent()) { @@ -156,32 +156,32 @@ public void cancel() { blockResult = Result.DENY; } - @Nonnull + public Result useItem() { return itemResult; } - @Nonnull + public Result useBlock() { return blockResult; } - public void setUseItem(@Nonnull Result result) { + public void setUseItem(Result result) { Validate.notNull(result, "Result cannot be null"); itemResult = result; } - public void setUseBlock(@Nonnull Result result) { + public void setUseBlock(Result result) { Validate.notNull(result, "Result cannot be null"); blockResult = result; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ReactorExplodeEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ReactorExplodeEvent.java index 3948766f66..2f4e4495a7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ReactorExplodeEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ReactorExplodeEvent.java @@ -21,7 +21,7 @@ public class ReactorExplodeEvent extends Event { private final Location location; private final Reactor reactor; - public ReactorExplodeEvent(@Nonnull Location l, @Nonnull Reactor reactor) { + public ReactorExplodeEvent(Location l, Reactor reactor) { Validate.notNull(l, "A Location must be provided"); Validate.notNull(reactor, "A Reactor cannot be null"); @@ -34,7 +34,7 @@ public ReactorExplodeEvent(@Nonnull Location l, @Nonnull Reactor reactor) { * * @return The {@link Location} of this explosion */ - @Nonnull + public Location getLocation() { return location; } @@ -44,17 +44,17 @@ public Location getLocation() { * * @return The {@link SlimefunItem} instance */ - @Nonnull + public Reactor getReactor() { return reactor; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ResearchUnlockEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ResearchUnlockEvent.java index 4b73e2dad7..df51906014 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ResearchUnlockEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/ResearchUnlockEvent.java @@ -25,7 +25,7 @@ public class ResearchUnlockEvent extends Event implements Cancellable { private final Research research; private boolean cancelled; - public ResearchUnlockEvent(@Nonnull Player p, @Nonnull Research research) { + public ResearchUnlockEvent(Player p, Research research) { super(!Bukkit.isPrimaryThread()); Validate.notNull(p, "The Player cannot be null"); @@ -35,12 +35,12 @@ public ResearchUnlockEvent(@Nonnull Player p, @Nonnull Research research) { this.research = research; } - @Nonnull + public Player getPlayer() { return player; } - @Nonnull + public Research getResearch() { return research; } @@ -55,12 +55,12 @@ public void setCancelled(boolean cancel) { this.cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunBlockBreakEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunBlockBreakEvent.java index f354409671..1a345e9954 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunBlockBreakEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunBlockBreakEvent.java @@ -51,7 +51,7 @@ public SlimefunBlockBreakEvent(Player player, ItemStack heldItem, Block blockBro * * @return The broken {@link Block} */ - public @Nonnull Block getBlockBroken() { + public Block getBlockBroken() { return blockBroken; } @@ -60,7 +60,7 @@ public SlimefunBlockBreakEvent(Player player, ItemStack heldItem, Block blockBro * * @return The {@link SlimefunItem} being broken */ - public @Nonnull SlimefunItem getSlimefunItem() { + public SlimefunItem getSlimefunItem() { return slimefunItem; } @@ -69,7 +69,7 @@ public SlimefunBlockBreakEvent(Player player, ItemStack heldItem, Block blockBro * * @return The held {@link ItemStack} */ - public @Nonnull ItemStack getHeldItem() { + public ItemStack getHeldItem() { return heldItem; } @@ -78,7 +78,7 @@ public SlimefunBlockBreakEvent(Player player, ItemStack heldItem, Block blockBro * * @return The {@link Player} */ - public @Nonnull Player getPlayer() { + public Player getPlayer() { return player; } @@ -92,12 +92,12 @@ public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - public static @Nonnull HandlerList getHandlerList() { + public static HandlerList getHandlerList() { return handlers; } @Override - public @Nonnull HandlerList getHandlers() { + public HandlerList getHandlers() { return getHandlerList(); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunBlockPlaceEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunBlockPlaceEvent.java index 7627d20849..ec17c27666 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunBlockPlaceEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunBlockPlaceEvent.java @@ -51,7 +51,7 @@ public SlimefunBlockPlaceEvent(Player player, ItemStack placedItem, Block blockP * * @return The placed {@link Block} */ - public @Nonnull Block getBlockPlaced() { + public Block getBlockPlaced() { return blockPlaced; } @@ -60,7 +60,7 @@ public SlimefunBlockPlaceEvent(Player player, ItemStack placedItem, Block blockP * * @return The {@link SlimefunItem} being placed */ - public @Nonnull SlimefunItem getSlimefunItem() { + public SlimefunItem getSlimefunItem() { return slimefunItem; } @@ -69,7 +69,7 @@ public SlimefunBlockPlaceEvent(Player player, ItemStack placedItem, Block blockP * * @return The placed {@link ItemStack} */ - public @Nonnull ItemStack getItemStack() { + public ItemStack getItemStack() { return placedItem; } @@ -78,7 +78,7 @@ public SlimefunBlockPlaceEvent(Player player, ItemStack placedItem, Block blockP * * @return The {@link Player} */ - public @Nonnull Player getPlayer() { + public Player getPlayer() { return player; } @@ -92,12 +92,12 @@ public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - public static @Nonnull HandlerList getHandlerList() { + public static HandlerList getHandlerList() { return handlers; } @Override - public @Nonnull HandlerList getHandlers() { + public HandlerList getHandlers() { return getHandlerList(); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunGuideOpenEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunGuideOpenEvent.java index 0892beb063..f02b66bd3a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunGuideOpenEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunGuideOpenEvent.java @@ -25,7 +25,7 @@ public class SlimefunGuideOpenEvent extends Event implements Cancellable { private SlimefunGuideMode layout; private boolean cancelled; - public SlimefunGuideOpenEvent(@Nonnull Player p, @Nonnull ItemStack guide, @Nonnull SlimefunGuideMode layout) { + public SlimefunGuideOpenEvent(Player p, ItemStack guide, SlimefunGuideMode layout) { Validate.notNull(p, "The Player cannot be null"); Validate.notNull(guide, "Guide cannot be null"); Validate.notNull(layout, "Layout cannot be null"); @@ -40,7 +40,7 @@ public SlimefunGuideOpenEvent(@Nonnull Player p, @Nonnull ItemStack guide, @Nonn * * @return The {@link Player} */ - @Nonnull + public Player getPlayer() { return player; } @@ -51,7 +51,7 @@ public Player getPlayer() { * * @return The {@link ItemStack} */ - @Nonnull + public ItemStack getGuide() { return guide; } @@ -62,7 +62,7 @@ public ItemStack getGuide() { * * @return The {@link SlimefunGuideMode} */ - @Nonnull + public SlimefunGuideMode getGuideLayout() { return layout; } @@ -73,7 +73,7 @@ public SlimefunGuideMode getGuideLayout() { * @param layout * The new {@link SlimefunGuideMode} */ - public void setGuideLayout(@Nonnull SlimefunGuideMode layout) { + public void setGuideLayout(SlimefunGuideMode layout) { Validate.notNull(layout, "You must specify a layout that is not-null!"); this.layout = layout; } @@ -88,12 +88,12 @@ public void setCancelled(boolean cancel) { this.cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunItemRegistryFinalizedEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunItemRegistryFinalizedEvent.java index 6c8b4282c4..f1be6c911d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunItemRegistryFinalizedEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunItemRegistryFinalizedEvent.java @@ -19,12 +19,12 @@ public class SlimefunItemRegistryFinalizedEvent extends Event { public SlimefunItemRegistryFinalizedEvent() {} - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunItemSpawnEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunItemSpawnEvent.java index 3527f5003e..4b2983dc03 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunItemSpawnEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunItemSpawnEvent.java @@ -52,7 +52,7 @@ public SlimefunItemSpawnEvent(Location location, ItemStack itemStack, ItemSpawnR * * @return The player responsible if applicable. */ - public @Nonnull Optional getPlayer() { + public Optional getPlayer() { return Optional.ofNullable(player); } @@ -61,7 +61,7 @@ public SlimefunItemSpawnEvent(Location location, ItemStack itemStack, ItemSpawnR * * @return the {@link ItemSpawnReason}. */ - public @Nonnull ItemSpawnReason getItemSpawnReason() { + public ItemSpawnReason getItemSpawnReason() { return itemSpawnReason; } @@ -70,7 +70,7 @@ public SlimefunItemSpawnEvent(Location location, ItemStack itemStack, ItemSpawnR * * @return The {@link Location} where the item will be dropped */ - public @Nonnull Location getLocation() { + public Location getLocation() { return location; } @@ -80,7 +80,7 @@ public SlimefunItemSpawnEvent(Location location, ItemStack itemStack, ItemSpawnR * @param location * The {@link Location} where to drop the {@link ItemStack} */ - public void setLocation(@Nonnull Location location) { + public void setLocation(Location location) { Validate.notNull(location, "The Location cannot be null!"); this.location = location; @@ -91,7 +91,7 @@ public void setLocation(@Nonnull Location location) { * * @return The {@link ItemStack} that will be dropped */ - public @Nonnull ItemStack getItemStack() { + public ItemStack getItemStack() { return itemStack; } @@ -101,7 +101,7 @@ public void setLocation(@Nonnull Location location) { * @param itemStack * The {@link ItemStack} to drop */ - public void setItemStack(@Nonnull ItemStack itemStack) { + public void setItemStack(ItemStack itemStack) { Validate.notNull(itemStack, "Cannot drop null."); Validate.isTrue(!itemStack.getType().isAir(), "Cannot drop air."); @@ -118,12 +118,12 @@ public void setCancelled(boolean cancelled) { this.cancelled = cancelled; } - public static @Nonnull HandlerList getHandlerList() { + public static HandlerList getHandlerList() { return handlers; } @Override - public @Nonnull HandlerList getHandlers() { + public HandlerList getHandlers() { return getHandlerList(); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivateEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivateEvent.java index 5b4bd95caf..59436d2db1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivateEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/TalismanActivateEvent.java @@ -42,14 +42,14 @@ public TalismanActivateEvent(Player player, Talisman talisman, ItemStack talisma /** * @return The {@link Talisman} used. */ - public @Nonnull Talisman getTalisman() { + public Talisman getTalisman() { return this.talisman; } /** * @return The {@link ItemStack} of the used {@link Talisman}. */ - public @Nonnull ItemStack getTalismanItem() { + public ItemStack getTalismanItem() { return this.talismanItemStack; } @@ -84,11 +84,11 @@ public void setCancelled(boolean cancel) { } @Override - public @Nonnull HandlerList getHandlers() { + public HandlerList getHandlers() { return getHandlerList(); } - public static @Nonnull HandlerList getHandlerList() { + public static HandlerList getHandlerList() { return handlers; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/WaypointCreateEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/WaypointCreateEvent.java index 4af2701619..a53027a19b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/WaypointCreateEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/WaypointCreateEvent.java @@ -32,7 +32,7 @@ public class WaypointCreateEvent extends PlayerEvent implements Cancellable { private final boolean deathpoint; private boolean cancelled; - public WaypointCreateEvent(@Nonnull Player player, @Nonnull String name, @Nonnull Location location) { + public WaypointCreateEvent(Player player, String name, Location location) { super(player); Validate.notNull(location, "Location must not be null!"); @@ -48,7 +48,7 @@ public WaypointCreateEvent(@Nonnull Player player, @Nonnull String name, @Nonnul * * @return The {@link Location} of this waypoint */ - @Nonnull + public Location getLocation() { return location; } @@ -59,7 +59,7 @@ public Location getLocation() { * * @param loc The {@link Location} to set */ - public void setLocation(@Nonnull Location loc) { + public void setLocation(Location loc) { Validate.notNull(loc, "Cannot set the Location to null!"); this.location = loc; } @@ -69,7 +69,7 @@ public void setLocation(@Nonnull Location loc) { * * @return The name of this waypoint */ - @Nonnull + public String getName() { return name; } @@ -80,7 +80,7 @@ public String getName() { * @param name * The name for this waypoint */ - public void setName(@Nonnull String name) { + public void setName(String name) { Validate.notEmpty(name, "The name of a waypoint must not be empty!"); this.name = name; } @@ -105,12 +105,12 @@ public void setCancelled(boolean cancel) { this.cancelled = cancel; } - @Nonnull + public static HandlerList getHandlerList() { return handlers; } - @Nonnull + @Override public HandlerList getHandlers() { return getHandlerList(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/geo/GEOResource.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/geo/GEOResource.java index 533108ee6c..d0e543258e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/geo/GEOResource.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/geo/GEOResource.java @@ -43,7 +43,7 @@ public interface GEOResource extends Keyed { * * @return The default supply found in a {@link Chunk} with the given {@link Biome} */ - int getDefaultSupply(@Nonnull Environment environment, @Nonnull Biome biome); + int getDefaultSupply(Environment environment, Biome biome); /** * Returns how much the value may deviate from the default supply (positive only). @@ -57,7 +57,7 @@ public interface GEOResource extends Keyed { * * @return The name of this Resource */ - @Nonnull + String getName(); /** @@ -66,7 +66,7 @@ public interface GEOResource extends Keyed { * * @return The {@link ItemStack} version of this Resource. */ - @Nonnull + ItemStack getItem(); /** @@ -92,8 +92,8 @@ default void register() { * The {@link Player} to localize the name for. * @return The localized name for this {@link GEOResource} */ - @Nonnull - default String getName(@Nonnull Player p) { + + default String getName(Player p) { String name = Slimefun.getLocalization() .getResourceString(p, "resources." + getKey().getNamespace() + "." + getKey().getKey()); return name == null ? getName() : name; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/geo/ResourceManager.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/geo/ResourceManager.java index ce59906ad4..2892344b78 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/geo/ResourceManager.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/geo/ResourceManager.java @@ -58,7 +58,7 @@ public class ResourceManager { * @param plugin * Our {@link Slimefun} instance */ - public ResourceManager(@Nonnull Slimefun plugin) { + public ResourceManager(Slimefun plugin) { config = new Config(plugin, "resources.yml"); } @@ -69,7 +69,7 @@ public ResourceManager(@Nonnull Slimefun plugin) { * @param resource * The {@link GEOResource} to register */ - void register(@Nonnull GEOResource resource) { + void register(GEOResource resource) { Validate.notNull(resource, "Cannot register null as a GEO-Resource"); Validate.notNull(resource.getKey(), "GEO-Resources must have a NamespacedKey which is not null"); @@ -104,7 +104,7 @@ void register(@Nonnull GEOResource resource) { * * @return An {@link OptionalInt}, either empty or containing the amount of the given {@link GEOResource} */ - public @Nonnull OptionalInt getSupplies(@Nonnull GEOResource resource, @Nonnull World world, int x, int z) { + public OptionalInt getSupplies(GEOResource resource, World world, int x, int z) { Validate.notNull(resource, "Cannot get supplies for null"); Validate.notNull(world, "World must not be null"); @@ -160,7 +160,7 @@ public void onResultNotFound() { * @param value * The new supply value */ - public void setSupplies(@Nonnull GEOResource resource, @Nonnull World world, int x, int z, int value) { + public void setSupplies(GEOResource resource, World world, int x, int z, int value) { Validate.notNull(resource, "Cannot set supplies for null"); Validate.notNull(world, "World cannot be null"); @@ -193,7 +193,7 @@ public void onResult(SlimefunChunkData result) { * * @return The new supply value */ - private int generate(@Nonnull GEOResource resource, @Nonnull World world, int x, int y, int z) { + private int generate(GEOResource resource, World world, int x, int y, int z) { Validate.notNull(resource, "Cannot generate resources for null"); Validate.notNull(world, "World cannot be null"); @@ -247,7 +247,7 @@ private int generate(@Nonnull GEOResource resource, @Nonnull World world, int x, * @param page * The zero-based page to display */ - public void scan(@Nonnull Player p, @Nonnull Block block, int page) { + public void scan(Player p, Block block, int page) { if (Slimefun.getGPSNetwork().getNetworkComplexity(p.getUniqueId()) < 600) { Slimefun.getLocalization() .sendMessages(p, "gps.insufficient-complexity", true, msg -> msg.replace("%complexity%", "600")); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/GPSNetwork.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/GPSNetwork.java index 590ada6f9f..7839b735a2 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/GPSNetwork.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/GPSNetwork.java @@ -67,7 +67,7 @@ public class GPSNetwork { * @param plugin * Our {@link Slimefun} instance */ - public GPSNetwork(@Nonnull Slimefun plugin) { + public GPSNetwork(Slimefun plugin) { resourceManager = new ResourceManager(plugin); } @@ -81,7 +81,7 @@ public GPSNetwork(@Nonnull Slimefun plugin) { * @param online * Whether that {@link GPSTransmitter} is online */ - public void updateTransmitter(@Nonnull Location l, @Nonnull UUID uuid, boolean online) { + public void updateTransmitter(Location l, UUID uuid, boolean online) { Set set = transmitters.computeIfAbsent(uuid, id -> new HashSet<>()); if (online) { @@ -101,7 +101,7 @@ public void updateTransmitter(@Nonnull Location l, @Nonnull UUID uuid, boolean o * * @return The network complexity for that {@link UUID} */ - public int getNetworkComplexity(@Nonnull UUID uuid) { + public int getNetworkComplexity(UUID uuid) { Set locations = transmitters.get(uuid); if (locations == null) { @@ -129,7 +129,7 @@ public int getNetworkComplexity(@Nonnull UUID uuid) { * * @return The amount of transmitters */ - public int countTransmitters(@Nonnull UUID uuid) { + public int countTransmitters(UUID uuid) { Set locations = transmitters.get(uuid); return locations == null ? 0 : locations.size(); } @@ -141,7 +141,7 @@ public int countTransmitters(@Nonnull UUID uuid) { * @param p * The {@link Player} */ - public void openTransmitterControlPanel(@Nonnull Player p) { + public void openTransmitterControlPanel(Player p) { ChestMenu menu = new ChestMenu( ChatColor.BLUE + Slimefun.getLocalization().getMessage(p, "machines.GPS_CONTROL_PANEL.title")); @@ -230,7 +230,7 @@ public void openTransmitterControlPanel(@Nonnull Player p) { * @return An icon for this waypoint */ @ParametersAreNonnullByDefault - public @Nonnull ItemStack getIcon(String name, Environment environment) { + public ItemStack getIcon(String name, Environment environment) { if (name.startsWith("player:death ")) { return HeadTexture.DEATHPOINT.getAsItemStack(); } else if (environment == Environment.NETHER) { @@ -243,7 +243,7 @@ public void openTransmitterControlPanel(@Nonnull Player p) { } @ParametersAreNonnullByDefault - private @Nonnull String getStatusText(Player player, int complexity) { + private String getStatusText(Player player, int complexity) { if (complexity > 0) { return "&2&l" + Slimefun.getLocalization().getMessage(player, "gps.status-online"); } else { @@ -251,7 +251,7 @@ public void openTransmitterControlPanel(@Nonnull Player p) { } } - public void openWaypointControlPanel(@Nonnull Player p) { + public void openWaypointControlPanel(Player p) { PlayerProfile.get(p, profile -> { ChestMenu menu = new ChestMenu( ChatColor.BLUE + Slimefun.getLocalization().getMessage(p, "machines.GPS_CONTROL_PANEL.title")); @@ -336,7 +336,7 @@ public void openWaypointControlPanel(@Nonnull Player p) { * @param l * The {@link Location} of the new waypoint */ - public void createWaypoint(@Nonnull Player p, @Nonnull Location l) { + public void createWaypoint(Player p, Location l) { Validate.notNull(p, "Player cannot be null!"); Validate.notNull(l, "Waypoint Location cannot be null!"); @@ -363,7 +363,7 @@ public void createWaypoint(@Nonnull Player p, @Nonnull Location l) { * @param l * The {@link Location} of this waypoint */ - public void addWaypoint(@Nonnull Player p, @Nonnull String name, @Nonnull Location l) { + public void addWaypoint(Player p, String name, Location l) { Validate.notNull(p, "Player cannot be null!"); Validate.notNull(name, "Waypoint name cannot be null!"); Validate.notNull(l, "Waypoint Location cannot be null!"); @@ -413,8 +413,8 @@ public void addWaypoint(@Nonnull Player p, @Nonnull String name, @Nonnull Locati * * @return A {@link Set} with all {@link Location Locations} of transmitters for this {@link UUID} */ - @Nonnull - public Set getTransmitters(@Nonnull UUID uuid) { + + public Set getTransmitters(UUID uuid) { return transmitters.getOrDefault(uuid, new HashSet<>()); } @@ -424,7 +424,7 @@ public Set getTransmitters(@Nonnull UUID uuid) { * * @return The {@link TeleportationManager} for this {@link GPSNetwork} */ - @Nonnull + public TeleportationManager getTeleportationManager() { return teleportation; } @@ -435,7 +435,7 @@ public TeleportationManager getTeleportationManager() { * * @return The {@link ResourceManager} for this {@link GPSNetwork} */ - @Nonnull + public ResourceManager getResourceManager() { return resourceManager; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java index afb6dc8977..989edfc67d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/TeleportationManager.java @@ -169,7 +169,7 @@ public void teleport(UUID uuid, int complexity, Location source, Location destin * * @return The amount of time the teleportation will take */ - public int getTeleportationTime(int complexity, @Nonnull Location source, @Nonnull Location destination) { + public int getTeleportationTime(int complexity, Location source, Location destination) { Validate.notNull(source, "Source cannot be null"); Validate.notNull(source, "Destination cannot be null"); @@ -194,14 +194,14 @@ private int distanceSquared(Location source, Location destination) { } } - private boolean isValid(@Nullable Player p, @Nonnull Location source) { + private boolean isValid(@Nullable Player p, Location source) { return p != null && p.isValid() && p.getWorld().getUID().equals(source.getWorld().getUID()) && p.getLocation().distanceSquared(source) < 2.0; } - private void cancel(@Nonnull UUID uuid, @Nullable Player p) { + private void cancel(UUID uuid, @Nullable Player p) { teleporterUsers.remove(uuid); if (p != null) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/Waypoint.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/Waypoint.java index 6bbd4b246c..40bb0444b3 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/Waypoint.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/Waypoint.java @@ -84,7 +84,7 @@ public Waypoint(UUID ownerId, String id, Location loc, String name) { * * @return The corresponding owner's {@link UUID} */ - @Nonnull + public UUID getOwnerId() { return this.ownerId; } @@ -96,7 +96,7 @@ public UUID getOwnerId() { * * @deprecated Use {@link #getOwnerId()} instead */ - @Nonnull + @Deprecated public PlayerProfile getOwner() { // This is jank and should never actually return null @@ -108,7 +108,7 @@ public PlayerProfile getOwner() { * * @return The {@link Waypoint} id */ - @Nonnull + public String getId() { return id; } @@ -118,7 +118,7 @@ public String getId() { * * @return The name of this {@link Waypoint} */ - @Nonnull + public String getName() { return name; } @@ -128,7 +128,7 @@ public String getName() { * * @return The {@link Waypoint} {@link Location} */ - @Nonnull + public Location getLocation() { return location; } @@ -149,7 +149,7 @@ public boolean isDeathpoint() { * * @return The {@link ItemStack} icon for this {@link Waypoint} */ - @Nonnull + public ItemStack getIcon() { return Slimefun.getGPSNetwork().getIcon(name, location.getWorld().getEnvironment()); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/HashedArmorpiece.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/HashedArmorpiece.java index cfe03cdc2f..1cdaacfc73 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/HashedArmorpiece.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/HashedArmorpiece.java @@ -91,7 +91,7 @@ public boolean hasDiverged(@Nullable ItemStack stack) { * * @return An {@link Optional} describing the result */ - public @Nonnull Optional getItem() { + public Optional getItem() { return item; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemGroup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemGroup.java index e543a24ce1..cd4d16c28a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemGroup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemGroup.java @@ -88,7 +88,7 @@ public ItemGroup(NamespacedKey key, ItemStack item, int tier) { } @Override - public final @Nonnull NamespacedKey getKey() { + public final NamespacedKey getKey() { return key; } @@ -101,7 +101,7 @@ public ItemGroup(NamespacedKey key, ItemStack item, int tier) { * @param addon * The {@link SlimefunAddon} that wants to register this {@link ItemGroup} */ - public void register(@Nonnull SlimefunAddon addon) { + public void register(SlimefunAddon addon) { Validate.notNull(addon, "The Addon cannot be null"); if (isRegistered()) { @@ -174,7 +174,7 @@ private void sortCategoriesByTier() { * @param item * the {@link SlimefunItem} that should be added to this {@link ItemGroup} */ - public void add(@Nonnull SlimefunItem item) { + public void add(SlimefunItem item) { Validate.notNull(item, "Cannot add null Items to an ItemGroup!"); if (items.contains(item)) { @@ -200,7 +200,7 @@ public void add(@Nonnull SlimefunItem item) { * @param item * the {@link SlimefunItem} that should be removed from this {@link ItemGroup} */ - public void remove(@Nonnull SlimefunItem item) { + public void remove(SlimefunItem item) { Validate.notNull(item, "Cannot remove null from an ItemGroup!"); items.remove(item); } @@ -214,7 +214,7 @@ public void remove(@Nonnull SlimefunItem item) { * * @return A localized display item for this {@link ItemGroup} */ - public @Nonnull ItemStack getItem(@Nonnull Player p) { + public ItemStack getItem(Player p) { return new CustomItemStack(item, meta -> { String name = Slimefun.getLocalization().getItemGroupName(p, getKey()); @@ -243,7 +243,7 @@ public void remove(@Nonnull SlimefunItem item) { * * @return The unlocalized name of this {@link ItemGroup} */ - public @Nonnull String getUnlocalizedName() { + public String getUnlocalizedName() { return ChatColor.stripColor(item.getItemMeta().getDisplayName()); } @@ -256,7 +256,7 @@ public void remove(@Nonnull SlimefunItem item) { * * @return The localized name of this {@link ItemGroup} */ - public @Nonnull String getDisplayName(@Nonnull Player p) { + public String getDisplayName(Player p) { String localized = Slimefun.getLocalization().getItemGroupName(p, getKey()); if (localized != null) { @@ -271,7 +271,7 @@ public void remove(@Nonnull SlimefunItem item) { * * @return the list of SlimefunItems bound to this {@link ItemGroup} */ - public @Nonnull List getItems() { + public List getItems() { return items; } @@ -298,7 +298,7 @@ public boolean contains(@Nullable SlimefunItem item) { * * @return Whether this {@link ItemGroup} is accessible by the given {@link Player} */ - public boolean isAccessible(@Nonnull Player p) { + public boolean isAccessible(Player p) { return true; } @@ -314,7 +314,7 @@ public boolean isAccessible(@Nonnull Player p) { * * @return Whether this {@link ItemGroup} is visible to the given {@link Player} */ - public boolean isVisible(@Nonnull Player p) { + public boolean isVisible(Player p) { if (items.isEmpty() || !isAccessible(p)) { return false; } @@ -387,7 +387,7 @@ public String toString() { * @return Whether this {@link ItemGroup} will be hidden to the given {@link Player} */ @Deprecated - public boolean isHidden(@Nonnull Player p) { + public boolean isHidden(Player p) { return !isVisible(p); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemHandler.java index d306fe7271..eeb6d66320 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemHandler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemHandler.java @@ -37,8 +37,8 @@ public interface ItemHandler { * @return An {@link Optional} describing the result, it will contain an {@link IncompatibleItemHandlerException} * should there be an issue */ - @Nonnull - default Optional validate(@Nonnull SlimefunItem item) { + + default Optional validate(SlimefunItem item) { return Optional.empty(); } @@ -48,6 +48,6 @@ default Optional validate(@Nonnull SlimefunIte * * @return The {@link Class} identifier for this {@link ItemHandler} */ - @Nonnull + Class getIdentifier(); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java index 501b7b06b3..e0b182b87b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSetting.java @@ -68,7 +68,7 @@ public boolean validateInput(T input) { * @param newValue * The new value for this {@link ItemSetting} */ - public void update(@Nonnull T newValue) { + public void update(T newValue) { if (validateInput(newValue)) { this.value = newValue; } else { @@ -83,7 +83,7 @@ public void update(@Nonnull T newValue) { * * @return The key under which this setting is stored (relative to the {@link SlimefunItem}) */ - public @Nonnull String getKey() { + public String getKey() { return key; } @@ -92,7 +92,7 @@ public void update(@Nonnull T newValue) { * * @return The associated {@link SlimefunItem} */ - protected @Nonnull SlimefunItem getItem() { + protected SlimefunItem getItem() { return item; } @@ -101,7 +101,7 @@ public void update(@Nonnull T newValue) { * * @return The current value */ - public @Nonnull T getValue() { + public T getValue() { if (value != null) { /** * If the value has been initialized, return it immediately. @@ -122,7 +122,7 @@ public void update(@Nonnull T newValue) { * * @return The default value */ - public @Nonnull T getDefaultValue() { + public T getDefaultValue() { return defaultValue; } @@ -134,7 +134,7 @@ public void update(@Nonnull T newValue) { * * @return Whether this {@link ItemSetting} stores the given type */ - public boolean isType(@Nonnull Class c) { + public boolean isType(Class c) { return c.isInstance(defaultValue); } @@ -144,7 +144,7 @@ public boolean isType(@Nonnull Class c) { * * @return An error message which is displayed when this {@link ItemSetting} is misconfigured. */ - protected @Nonnull String getErrorMessage() { + protected String getErrorMessage() { return "请使用在 '" + defaultValue.getClass().getSimpleName() + "' 范围内的值!"; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java index d146b898cc..9b1a3e217c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItem.java @@ -218,7 +218,7 @@ protected SlimefunItem(ItemGroup itemGroup, ItemStack item, String id, RecipeTyp * * @return the identifier of this {@link SlimefunItem} */ - public final @Nonnull String getId() { + public final String getId() { return id; } @@ -231,7 +231,7 @@ protected SlimefunItem(ItemGroup itemGroup, ItemStack item, String id, RecipeTyp * * @return The {@link ItemState} of this {@link SlimefunItem} */ - public @Nonnull ItemState getState() { + public ItemState getState() { return state; } @@ -241,7 +241,7 @@ protected SlimefunItem(ItemGroup itemGroup, ItemStack item, String id, RecipeTyp * * @return The {@link ItemStack} that this {@link SlimefunItem} represents */ - public @Nonnull ItemStack getItem() { + public ItemStack getItem() { return itemStackTemplate; } @@ -251,7 +251,7 @@ protected SlimefunItem(ItemGroup itemGroup, ItemStack item, String id, RecipeTyp * * @return The {@link ItemGroup} that this {@link SlimefunItem} belongs to */ - public @Nonnull ItemGroup getItemGroup() { + public ItemGroup getItemGroup() { return itemGroup; } @@ -260,7 +260,7 @@ protected SlimefunItem(ItemGroup itemGroup, ItemStack item, String id, RecipeTyp * * @return An {@link ItemStack} array of 9 which represents the recipe for this {@link SlimefunItem} */ - public @Nonnull ItemStack[] getRecipe() { + public ItemStack[] getRecipe() { return recipe; } @@ -270,7 +270,7 @@ protected SlimefunItem(ItemGroup itemGroup, ItemStack item, String id, RecipeTyp * * @return The {@link RecipeType} of this {@link SlimefunItem} */ - public @Nonnull RecipeType getRecipeType() { + public RecipeType getRecipeType() { return recipeType; } @@ -279,7 +279,7 @@ protected SlimefunItem(ItemGroup itemGroup, ItemStack item, String id, RecipeTyp * * @return The recipe output of this {@link SlimefunItem} */ - public @Nonnull ItemStack getRecipeOutput() { + public ItemStack getRecipeOutput() { return recipeOutput != null ? recipeOutput.clone() : itemStackTemplate.clone(); } @@ -309,7 +309,7 @@ public final boolean hasResearch() { * * @return A {@link Set} of every {@link ItemSetting} for this {@link SlimefunItem} */ - public @Nonnull Set> getItemSettings() { + public Set> getItemSettings() { return itemSettings; } @@ -323,7 +323,7 @@ public final boolean hasResearch() { * @return An {@link Optional} describing the result */ @SuppressWarnings("unchecked") - public @Nonnull Optional> getItemSetting(@Nonnull String key, @Nonnull Class c) { + public Optional> getItemSetting(String key, Class c) { for (ItemSetting setting : itemSettings) { if (setting.getKey().equals(key) && setting.isType(c)) { return Optional.of((ItemSetting) setting); @@ -384,7 +384,7 @@ public boolean isDisabled() { * @param world The {@link World} to check * @return Whether this {@link SlimefunItem} is disabled in that world (or in general). */ - public boolean isDisabledIn(@Nonnull World world) { + public boolean isDisabledIn(World world) { if (state == ItemState.UNREGISTERED) { error( "isDisabled(World) cannot be called before registering the item", @@ -404,7 +404,7 @@ public boolean isDisabledIn(@Nonnull World world) { * * @return The {@link SlimefunAddon} that registered this {@link SlimefunItem} */ - public final @Nonnull SlimefunAddon getAddon() { + public final SlimefunAddon getAddon() { if (addon == null) { throw new UnregisteredItemException(this); } @@ -419,7 +419,7 @@ public boolean isDisabledIn(@Nonnull World world) { * * @param addon The {@link SlimefunAddon} that this {@link SlimefunItem} belongs to. */ - public void register(@Nonnull SlimefunAddon addon) { + public void register(SlimefunAddon addon) { Validate.notNull(addon, "A SlimefunAddon cannot be null!"); Validate.notNull(addon.getJavaPlugin(), "SlimefunAddon#getJavaPlugin() is not allowed to return null!"); @@ -625,7 +625,7 @@ protected boolean isItemStackImmutable() { * @param addon * The {@link SlimefunAddon} trying to register this {@link SlimefunItem} */ - private void checkDependencies(@Nonnull SlimefunAddon addon) { + private void checkDependencies(SlimefunAddon addon) { if (!addon.hasDependency("Slimefun")) { throw new MissingDependencyException(addon, "Slimefun"); } @@ -704,7 +704,7 @@ public void setResearch(@Nullable Research research) { * @param recipe * The recipe for this {@link ItemStack} */ - public void setRecipe(@Nonnull ItemStack[] recipe) { + public void setRecipe(ItemStack[] recipe) { if (recipe == null || recipe.length != 9) { throw new IllegalArgumentException("Recipes must be of length 9"); } @@ -718,7 +718,7 @@ public void setRecipe(@Nonnull ItemStack[] recipe) { * @param type * The {@link RecipeType} for this {@link SlimefunItem} */ - public void setRecipeType(@Nonnull RecipeType type) { + public void setRecipeType(RecipeType type) { Validate.notNull(type, "The RecipeType is not allowed to be null!"); this.recipeType = type; } @@ -729,7 +729,7 @@ public void setRecipeType(@Nonnull RecipeType type) { * @param itemGroup * The new {@link ItemGroup} */ - public void setItemGroup(@Nonnull ItemGroup itemGroup) { + public void setItemGroup(ItemGroup itemGroup) { Validate.notNull(itemGroup, "The ItemGroup is not allowed to be null!"); this.itemGroup.remove(this); @@ -758,7 +758,7 @@ public void setRecipeOutput(@Nullable ItemStack output) { * * @return This instance of {@link SlimefunItem} */ - public @Nonnull SlimefunItem setUseableInWorkbench(boolean useable) { + public SlimefunItem setUseableInWorkbench(boolean useable) { this.useableInWorkbench = useable; return this; @@ -901,7 +901,7 @@ public void postRegister() { * The associated wiki page */ @Deprecated - public final void addOfficialWikipage(@Nonnull String page) { + public final void addOfficialWikipage(String page) { Validate.notNull(page, "Wiki page cannot be null."); // 转换链接 page = page.replace("#", "?id="); @@ -913,7 +913,7 @@ public final void addOfficialWikipage(@Nonnull String page) { * * @param page 物品的 Wiki 页面 */ - public final void addWikiPage(@Nonnull String page) { + public final void addWikiPage(String page) { Validate.notNull(page, "Wiki page cannot be null."); if (addon == null) { @@ -933,7 +933,7 @@ public final void addWikiPage(@Nonnull String page) { * * @return This item's wiki page */ - public @Nonnull Optional getWikipage() { + public Optional getWikipage() { return wikiURL; } @@ -943,7 +943,7 @@ public final void addWikiPage(@Nonnull String page) { * * @return This item's name in {@link ItemStack} form */ - public final @Nonnull String getItemName() { + public final String getItemName() { if (itemStackTemplate instanceof SlimefunItemStack) { Optional name = ((SlimefunItemStack) itemStackTemplate) .getItemMetaSnapshot() @@ -962,7 +962,7 @@ public final void addWikiPage(@Nonnull String page) { * * @return The Set of item handlers */ - public @Nonnull Collection getHandlers() { + public Collection getHandlers() { return itemHandlers.values(); } @@ -1013,12 +1013,12 @@ public String toString() { } @Override - public @Nonnull Collection getDrops() { + public Collection getDrops() { return List.of(itemStackTemplate.clone()); } @Override - public @Nonnull Collection getDrops(@Nonnull Player p) { + public Collection getDrops(Player p) { return getDrops(); } @@ -1117,7 +1117,7 @@ public void sendDeprecationWarning(Player player) { * * @return Whether this {@link Player} is able to use this {@link SlimefunItem}. */ - public boolean canUse(@Nonnull Player p, boolean sendMessage) { + public boolean canUse(Player p, boolean sendMessage) { Validate.notNull(p, "The Player cannot be null!"); if (getState() == ItemState.VANILLA_FALLBACK) { @@ -1200,7 +1200,7 @@ public final int hashCode() { * The id of the {@link SlimefunItem} * @return The {@link SlimefunItem} associated with that id. Null if non-existent */ - public static @Nullable SlimefunItem getById(@Nonnull String id) { + public static @Nullable SlimefunItem getById(String id) { return Slimefun.getRegistry().getSlimefunItemIds().get(id); } @@ -1211,7 +1211,7 @@ public final int hashCode() { * The id of the {@link SlimefunItem} * @return The {@link Optional} {@link SlimefunItem} associated with that id. Empty if non-existent */ - public static @Nonnull Optional getOptionalById(@Nonnull String id) { + public static Optional getOptionalById(String id) { return Optional.ofNullable(getById(id)); } @@ -1244,7 +1244,7 @@ public final int hashCode() { * The {@link ItemStack} to check * @return The {@link Optional} {@link SlimefunItem} associated with this {@link ItemStack} if present, otherwise empty */ - public static @Nonnull Optional getOptionalByItem(@Nullable ItemStack item) { + public static Optional getOptionalByItem(@Nullable ItemStack item) { return Optional.ofNullable(getByItem(item)); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java index 3e2cac3b51..4537332544 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java @@ -48,7 +48,7 @@ public class SlimefunItemStack extends ItemStack { private boolean locked = false; private String texture = null; - public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item) { + public SlimefunItemStack(String id, ItemStack item) { super(item); Validate.notNull(id, "The Item id must never be null!"); @@ -70,7 +70,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item) { setItemMeta(meta); } - public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item, @Nonnull Consumer consumer) { + public SlimefunItemStack(String id, ItemStack item, Consumer consumer) { this(id, item); ItemMeta im = getItemMeta(); @@ -78,12 +78,12 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item, @Nonnull C setItemMeta(im); } - public SlimefunItemStack(@Nonnull String id, @Nonnull Material type, @Nonnull Consumer consumer) { + public SlimefunItemStack(String id, Material type, Consumer consumer) { this(id, new ItemStack(type), consumer); } public SlimefunItemStack( - @Nonnull String id, @Nonnull Material type, @Nullable String name, @Nonnull Consumer consumer) { + String id, Material type, @Nullable String name, Consumer consumer) { this(id, type, meta -> { if (name != null) { meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name)); @@ -93,7 +93,7 @@ public SlimefunItemStack( }); } - public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item, @Nullable String name, String... lore) { + public SlimefunItemStack(String id, ItemStack item, @Nullable String name, String... lore) { this(id, item, im -> { if (name != null) { im.setDisplayName(ChatColor.translateAlternateColorCodes('&', name)); @@ -110,12 +110,12 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item, @Nullable }); } - public SlimefunItemStack(@Nonnull String id, @Nonnull Material type, @Nullable String name, String... lore) { + public SlimefunItemStack(String id, Material type, @Nullable String name, String... lore) { this(id, new ItemStack(type), name, lore); } public SlimefunItemStack( - @Nonnull String id, @Nonnull Material type, @Nonnull Color color, @Nullable String name, String... lore) { + String id, Material type, Color color, @Nullable String name, String... lore) { this(id, type, im -> { if (name != null) { im.setDisplayName(ChatColor.translateAlternateColorCodes('&', name)); @@ -142,9 +142,9 @@ public SlimefunItemStack( } public SlimefunItemStack( - @Nonnull String id, - @Nonnull Color color, - @Nonnull PotionEffect effect, + String id, + Color color, + PotionEffect effect, @Nullable String name, String... lore) { this(id, Material.POTION, im -> { @@ -173,22 +173,22 @@ public SlimefunItemStack( }); } - public SlimefunItemStack(@Nonnull SlimefunItemStack item, int amount) { + public SlimefunItemStack(SlimefunItemStack item, int amount) { this(item.getItemId(), item); setAmount(amount); } - public SlimefunItemStack(@Nonnull String id, @Nonnull String texture, @Nullable String name, String... lore) { + public SlimefunItemStack(String id, String texture, @Nullable String name, String... lore) { this(id, getSkull(id, texture), name, lore); this.texture = getTexture(id, texture); } - public SlimefunItemStack(@Nonnull String id, @Nonnull HeadTexture head, @Nullable String name, String... lore) { + public SlimefunItemStack(String id, HeadTexture head, @Nullable String name, String... lore) { this(id, head.getTexture(), name, lore); } public SlimefunItemStack( - @Nonnull String id, @Nonnull String texture, @Nullable String name, @Nonnull Consumer consumer) { + String id, String texture, @Nullable String name, Consumer consumer) { this(id, getSkull(id, texture), meta -> { if (name != null) { meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name)); @@ -200,7 +200,7 @@ public SlimefunItemStack( this.texture = getTexture(id, texture); } - public SlimefunItemStack(@Nonnull String id, @Nonnull String texture, @Nonnull Consumer consumer) { + public SlimefunItemStack(String id, String texture, Consumer consumer) { this(id, getSkull(id, texture), consumer); this.texture = getTexture(id, texture); } @@ -210,7 +210,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull String texture, @Nonnull C * * @return The {@link SlimefunItem} id for this {@link SlimefunItemStack} */ - public final @Nonnull String getItemId() { + public final String getItemId() { return id; } @@ -238,12 +238,12 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull String texture, @Nonnull C * * @return The {@link SlimefunItem} this {@link SlimefunItem} represents, casted to the given type */ - public @Nullable T getItem(@Nonnull Class type) { + public @Nullable T getItem(Class type) { SlimefunItem item = getItem(); return type.isInstance(item) ? type.cast(item) : null; } - public @Nonnull ItemMetaSnapshot getItemMetaSnapshot() { + public ItemMetaSnapshot getItemMetaSnapshot() { return itemMetaSnapshot; } @@ -277,7 +277,7 @@ public void lock() { locked = true; } - public @Nonnull Optional getSkullTexture() { + public Optional getSkullTexture() { return Optional.ofNullable(texture); } @@ -290,12 +290,12 @@ public void lock() { return itemMetaSnapshot.getDisplayName().orElse(null); } - private static @Nonnull ItemStack getSkull(@Nonnull String id, @Nonnull String texture) { + private static ItemStack getSkull(String id, String texture) { PlayerSkin skin = PlayerSkin.fromBase64(getTexture(id, texture)); return PlayerHead.getItemStack(skin); } - private static @Nonnull String getTexture(@Nonnull String id, @Nonnull String texture) { + private static String getTexture(String id, String texture) { Validate.notNull(id, "The id cannot be null"); Validate.notNull(texture, "The texture cannot be null"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/FlexItemGroup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/FlexItemGroup.java index 98eb2214f9..44586b1f9b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/FlexItemGroup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/FlexItemGroup.java @@ -34,7 +34,7 @@ protected FlexItemGroup(NamespacedKey key, ItemStack item, int tier) { } @Override - public final boolean isVisible(@Nonnull Player p) { + public final boolean isVisible(Player p) { /* * We can stop this method right here. * We provide a custom method with more parameters for this. @@ -74,12 +74,12 @@ public final boolean isVisible(@Nonnull Player p) { public abstract void open(Player p, PlayerProfile profile, SlimefunGuideMode layout); @Override - public final void add(@Nonnull SlimefunItem item) { + public final void add(SlimefunItem item) { throw new UnsupportedOperationException("You cannot add items to a FlexItemGroup!"); } @Override - public final @Nonnull List getItems() { + public final List getItems() { throw new UnsupportedOperationException("A FlexItemGroup has no items!"); } @@ -89,7 +89,7 @@ public final boolean contains(SlimefunItem item) { } @Override - public final void remove(@Nonnull SlimefunItem item) { + public final void remove(SlimefunItem item) { throw new UnsupportedOperationException("A FlexItemGroup has no items, so there is nothing remove!"); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/LockedItemGroup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/LockedItemGroup.java index 5787dbd80b..e93fc9e74f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/LockedItemGroup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/LockedItemGroup.java @@ -73,7 +73,7 @@ public LockedItemGroup(NamespacedKey key, ItemStack item, int tier, NamespacedKe } @Override - public void register(@Nonnull SlimefunAddon addon) { + public void register(SlimefunAddon addon) { super.register(addon); List namespacedKeys = new ArrayList<>(); @@ -107,7 +107,7 @@ public void register(@Nonnull SlimefunAddon addon) { * @see #addParent(ItemGroup) * @see #removeParent(ItemGroup) */ - public @Nonnull Set getParents() { + public Set getParents() { return parents; } @@ -139,7 +139,7 @@ public void addParent(ItemGroup group) { * @see #getParents() * @see #addParent(ItemGroup) */ - public void removeParent(@Nonnull ItemGroup group) { + public void removeParent(ItemGroup group) { parents.remove(group); } @@ -153,7 +153,7 @@ public void removeParent(@Nonnull ItemGroup group) { * * @return Whether the {@link Player} has fully completed all parent categories, otherwise false */ - public boolean hasUnlocked(@Nonnull Player p, @Nonnull PlayerProfile profile) { + public boolean hasUnlocked(Player p, PlayerProfile profile) { Validate.notNull(p, "The player cannot be null!"); Validate.notNull(profile, "The Profile cannot be null!"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/NestedItemGroup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/NestedItemGroup.java index a49d5316b6..a5600612ac 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/NestedItemGroup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/NestedItemGroup.java @@ -41,7 +41,7 @@ public NestedItemGroup(NamespacedKey key, ItemStack item, int tier) { * @param group * The {@link SubItemGroup} to add. */ - public void addSubGroup(@Nonnull SubItemGroup group) { + public void addSubGroup(SubItemGroup group) { Validate.notNull(group, "The sub item group cannot be null!"); subGroups.add(group); @@ -53,7 +53,7 @@ public void addSubGroup(@Nonnull SubItemGroup group) { * @param group * The {@link SubItemGroup} to remove. */ - public void removeSubGroup(@Nonnull SubItemGroup group) { + public void removeSubGroup(SubItemGroup group) { Validate.notNull(group, "The sub item group cannot be null!"); subGroups.remove(group); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SeasonalItemGroup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SeasonalItemGroup.java index bbfed63d87..3d3b16b7d0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SeasonalItemGroup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SeasonalItemGroup.java @@ -48,12 +48,12 @@ public SeasonalItemGroup(NamespacedKey key, Month month, int tier, ItemStack ite * * @return the {@link Month} in which this {@link SeasonalItemGroup} appears */ - public @Nonnull Month getMonth() { + public Month getMonth() { return month; } @Override - public boolean isAccessible(@Nonnull Player p) { + public boolean isAccessible(Player p) { // Block this ItemGroup if the month differs if (month != LocalDate.now().getMonth()) { return false; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SubItemGroup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SubItemGroup.java index 069bd639e3..507b9e859c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SubItemGroup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SubItemGroup.java @@ -39,7 +39,7 @@ public SubItemGroup(NamespacedKey key, NestedItemGroup parent, ItemStack item, i } @Override - public final boolean isVisible(@Nonnull Player p) { + public final boolean isVisible(Player p) { /* * Sub Categories are always hidden, * they won't show up in the normal guide view. @@ -48,7 +48,7 @@ public final boolean isVisible(@Nonnull Player p) { } @Override - public final boolean isAccessible(@Nonnull Player p) { + public final boolean isAccessible(Player p) { /* * Sub Categories are accessible, they are invisible * but their items are available to the guide search. @@ -70,7 +70,7 @@ public final boolean isAccessible(@Nonnull Player p) { * @return Whether this {@link SubItemGroup} is visible to the given {@link Player} * in the {@link NestedItemGroup} */ - public final boolean isVisibleInNested(@Nonnull Player p) { + public final boolean isVisibleInNested(Player p) { return super.isVisible(p); } @@ -80,12 +80,12 @@ public final boolean isVisibleInNested(@Nonnull Player p) { * * @return The parent {@link NestedItemGroup} */ - public final @Nonnull NestedItemGroup getParent() { + public final NestedItemGroup getParent() { return parentItemGroup; } @Override - public final void register(@Nonnull SlimefunAddon addon) { + public final void register(SlimefunAddon addon) { super.register(addon); if (!parentItemGroup.isRegistered()) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/DoubleRangeSetting.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/DoubleRangeSetting.java index 7fac2e6eb5..ef92a54e2a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/DoubleRangeSetting.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/DoubleRangeSetting.java @@ -30,7 +30,7 @@ public DoubleRangeSetting(SlimefunItem item, String key, double min, double defa this.max = max; } - @Nonnull + @Override protected String getErrorMessage() { return "Only decimal numbers from " + min + '-' + max + "(inclusive) are allowed!"; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/EnumSetting.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/EnumSetting.java index 7327799184..20f28512ea 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/EnumSetting.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/EnumSetting.java @@ -30,7 +30,7 @@ public EnumSetting(SlimefunItem item, String key, Class enumClass, T defaultV this.enumClass = enumClass; } - @Nonnull + @Override protected String getErrorMessage() { String values = Arrays.stream(getAllowedValues()).map(Enum::name).collect(Collectors.joining(", ")); @@ -43,7 +43,7 @@ protected String getErrorMessage() { * * @return An array of allowed {@link Enum} constants */ - @Nonnull + public T[] getAllowedValues() { return enumClass.getEnumConstants(); } @@ -53,7 +53,7 @@ public T[] getAllowedValues() { * * @return The value as an {@link Enum} constant */ - @Nonnull + public T getAsEnumConstant() { return Enum.valueOf(enumClass, getValue()); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/IntRangeSetting.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/IntRangeSetting.java index ea119c1aaa..f6a83dfb48 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/IntRangeSetting.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/IntRangeSetting.java @@ -30,7 +30,7 @@ public IntRangeSetting(SlimefunItem item, String key, int min, int defaultValue, this.max = max; } - @Nonnull + @Override protected String getErrorMessage() { return "Only whole numbers from " + min + '-' + max + "(inclusive) are allowed!"; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/MaterialTagSetting.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/MaterialTagSetting.java index 60fceecba3..9b5ee57fcd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/MaterialTagSetting.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/MaterialTagSetting.java @@ -37,12 +37,12 @@ public MaterialTagSetting(SlimefunItem item, String key, Tag defaultTa * * @return The default {@link Tag} */ - public @Nonnull Tag getDefaultTag() { + public Tag getDefaultTag() { return defaultTag; } @Override - protected @Nonnull String getErrorMessage() { + protected String getErrorMessage() { return "This List can only contain Materials in the format of e.g. REDSTONE_BLOCK"; } @@ -72,7 +72,7 @@ public boolean validateInput(List input) { * * @return The {@link String} {@link List} */ - private static @Nonnull List getAsStringList(@Nonnull Tag tag) { + private static List getAsStringList(Tag tag) { return tag.getValues().stream().map(Material::name).collect(Collectors.toList()); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java index a787c2d628..ece7f85c37 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/Network.java @@ -51,7 +51,7 @@ public abstract class Network { * @param regulator * The {@link Location} marking the regulator of this {@link Network}. */ - protected Network(@Nonnull NetworkManager manager, @Nonnull Location regulator) { + protected Network(NetworkManager manager, Location regulator) { Validate.notNull(manager, "A NetworkManager must be provided"); Validate.notNull(regulator, "No regulator was specified"); @@ -82,7 +82,7 @@ protected Network(@Nonnull NetworkManager manager, @Nonnull Location regulator) * * @return The assigned type of {@link NetworkComponent} for this {@link Location} */ - @Nullable public abstract NetworkComponent classifyLocation(@Nonnull Location l); + @Nullable public abstract NetworkComponent classifyLocation(Location l); /** * This method is called whenever a {@link Location} in this {@link Network} changes @@ -113,7 +113,7 @@ public int getSize() { * @param l * The {@link Location} to add */ - protected void addLocationToNetwork(@Nonnull Location l) { + protected void addLocationToNetwork(Location l) { if (connectedLocations.add(l.clone())) { markDirty(l); } @@ -126,7 +126,7 @@ protected void addLocationToNetwork(@Nonnull Location l) { * @param l * The {@link Location} to update */ - public void markDirty(@Nonnull Location l) { + public void markDirty(Location l) { Debug.log(TestCase.ENERGYNET, "Mark location " + LocationUtils.locationToString(l) + " as dirty block"); if (regulator.equals(l)) { @@ -144,7 +144,7 @@ public void markDirty(@Nonnull Location l) { * * @return Whether the given {@link Location} is part of this {@link Network} */ - public boolean connectsTo(@Nonnull Location l) { + public boolean connectsTo(Location l) { if (regulator.equals(l)) { return true; } else { @@ -152,7 +152,7 @@ public boolean connectsTo(@Nonnull Location l) { } } - @Nullable private NetworkComponent getCurrentClassification(@Nonnull Location l) { + @Nullable private NetworkComponent getCurrentClassification(Location l) { if (regulatorNodes.contains(l)) { return NetworkComponent.REGULATOR; } else if (connectorNodes.contains(l)) { @@ -204,14 +204,14 @@ private void discoverStep() { } } - private void discoverNeighbors(@Nonnull Location l, double xDiff, double yDiff, double zDiff) { + private void discoverNeighbors(Location l, double xDiff, double yDiff, double zDiff) { for (int i = getRange() + 1; i > 0; i--) { Location newLocation = l.clone().add(i * xDiff, i * yDiff, i * zDiff); addLocationToNetwork(newLocation); } } - private void discoverNeighbors(@Nonnull Location l) { + private void discoverNeighbors(Location l) { discoverNeighbors(l, 1.0, 0.0, 0.0); discoverNeighbors(l, -1.0, 0.0, 0.0); discoverNeighbors(l, 0.0, 1.0, 0.0); @@ -235,7 +235,7 @@ public void display() { * * @return The {@link Location} of our regulator */ - @Nonnull + public Location getRegulator() { return regulator; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java index 71abce5594..513371c1c1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/network/NetworkVisualizer.java @@ -28,7 +28,7 @@ class NetworkVisualizer implements Runnable { * * @param network The {@link Network} to visualize */ - NetworkVisualizer(@Nonnull Network network) { + NetworkVisualizer(Network network) { this.network = network; } @@ -48,7 +48,7 @@ public void run() { * * @param l The {@link Location} of our node */ - private void spawnParticles(@Nonnull Location l) { + private void spawnParticles(Location l) { l.getWorld() .spawnParticle( Particle.REDSTONE, l.getX() + 0.5, l.getY() + 0.5, l.getZ() + 0.5, 1, 0, 0, 0, 1, options); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java index dba61470d2..c866fee49b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerBackpack.java @@ -232,7 +232,7 @@ public int getId() { * * @return The owning {@link PlayerProfile} */ - @Nonnull + public OfflinePlayer getOwner() { return owner; } @@ -251,7 +251,7 @@ public int getSize() { * * @return The {@link Inventory} of this {@link PlayerBackpack} */ - @Nonnull + public Inventory getInventory() { return inventory; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java index ab77a654bf..7d4370eac5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/PlayerProfile.java @@ -66,11 +66,11 @@ public class PlayerProfile { new HashedArmorpiece(), new HashedArmorpiece(), new HashedArmorpiece(), new HashedArmorpiece() }; - public PlayerProfile(@Nonnull OfflinePlayer p, int backpackNum) { + public PlayerProfile(OfflinePlayer p, int backpackNum) { this(p, backpackNum, new HashSet<>()); } - public PlayerProfile(@Nonnull OfflinePlayer p, int backpackNum, Set researches) { + public PlayerProfile(OfflinePlayer p, int backpackNum, Set researches) { owner = p; this.backpackNum = backpackNum; this.researches = researches; @@ -104,7 +104,7 @@ private void loadWaypoint() { * * @return The cached armor for this {@link Player} */ - public @Nonnull HashedArmorpiece[] getArmor() { + public HashedArmorpiece[] getArmor() { return armor; } @@ -113,7 +113,7 @@ private void loadWaypoint() { * * @return The {@link UUID} of our {@link PlayerProfile} */ - public @Nonnull UUID getUUID() { + public UUID getUUID() { return owner.getUniqueId(); } @@ -154,7 +154,7 @@ public void save() { * @param unlock * Whether the {@link Research} should be unlocked or locked */ - public void setResearched(@Nonnull Research research, boolean unlock) { + public void setResearched(Research research, boolean unlock) { Validate.notNull(research, "Research must not be null!"); dirty = true; @@ -207,7 +207,7 @@ public boolean hasUnlockedEverything() { * * @return A {@code Hashset} of all Researches this {@link Player} has unlocked */ - public @Nonnull Set getResearches() { + public Set getResearches() { return ImmutableSet.copyOf(researches); } @@ -217,7 +217,7 @@ public boolean hasUnlockedEverything() { * * @return A {@link List} containing every {@link Waypoint} */ - public @Nonnull List getWaypoints() { + public List getWaypoints() { return ImmutableList.copyOf(waypoints); } @@ -228,7 +228,7 @@ public boolean hasUnlockedEverything() { * @param waypoint * The {@link Waypoint} to add */ - public void addWaypoint(@Nonnull Waypoint waypoint) { + public void addWaypoint(Waypoint waypoint) { Validate.notNull(waypoint, "Cannot add a 'null' waypoint!"); for (Waypoint wp : waypoints) { @@ -253,7 +253,7 @@ public void addWaypoint(@Nonnull Waypoint waypoint) { * @param waypoint * The {@link Waypoint} to remove */ - public void removeWaypoint(@Nonnull Waypoint waypoint) { + public void removeWaypoint(Waypoint waypoint) { Validate.notNull(waypoint, "Cannot remove a 'null' waypoint!"); if (waypoints.remove(waypoint)) { @@ -292,7 +292,7 @@ public void setBackpackCount(int count) { Slimefun.getDatabaseManager().getProfileDataController().saveProfileBackpackCount(this); } - private int countNonEmptyResearches(@Nonnull Collection researches) { + private int countNonEmptyResearches(Collection researches) { int count = 0; for (Research research : researches) { if (research.hasEnabledItems()) { @@ -309,7 +309,7 @@ private int countNonEmptyResearches(@Nonnull Collection researches) { * * @return The research title of this {@link PlayerProfile} */ - public @Nonnull String getTitle() { + public String getTitle() { List titles = Slimefun.getRegistry().getResearchRanks(); int allResearches = countNonEmptyResearches(Slimefun.getRegistry().getResearches()); @@ -326,7 +326,7 @@ private int countNonEmptyResearches(@Nonnull Collection researches) { * * @param sender The {@link CommandSender} for which to get the statistics and send them to. */ - public void sendStats(@Nonnull CommandSender sender) { + public void sendStats(CommandSender sender) { int unlockedResearches = countNonEmptyResearches(getResearches()); int levels = getResearches().stream().mapToInt(Research::getLevelCost).sum(); int allResearches = countNonEmptyResearches(Slimefun.getRegistry().getResearches()); @@ -366,11 +366,11 @@ public void sendStats(@Nonnull CommandSender sender) { * * @return The {@link GuideHistory} of this {@link Player} */ - public @Nonnull GuideHistory getGuideHistory() { + public GuideHistory getGuideHistory() { return guideHistory; } - public static boolean fromUUID(@Nonnull UUID uuid, @Nonnull Consumer callback) { + public static boolean fromUUID(UUID uuid, Consumer callback) { return get(Bukkit.getOfflinePlayer(uuid), callback); } @@ -384,7 +384,7 @@ public static boolean fromUUID(@Nonnull UUID uuid, @Nonnull Consumer callback) { + public static boolean get(OfflinePlayer p, Consumer callback) { Validate.notNull(p, "Cannot get a PlayerProfile for: null!"); UUID uuid = p.getUniqueId(); @@ -408,7 +408,7 @@ public static boolean get(@Nonnull OfflinePlayer p, @Nonnull Consumer find(@Nonnull OfflinePlayer p) { + public static Optional find(OfflinePlayer p) { var re = Slimefun.getRegistry().getPlayerProfiles().get(p.getUniqueId()); if (re == null || re.isInvalid) { return Optional.empty(); @@ -439,11 +439,11 @@ public static boolean request(@Nonnull OfflinePlayer p) { return Optional.of(re); } - public static @Nonnull Iterator iterator() { + public static Iterator iterator() { return Slimefun.getRegistry().getPlayerProfiles().values().iterator(); } - public boolean hasFullProtectionAgainst(@Nonnull ProtectionType type) { + public boolean hasFullProtectionAgainst(ProtectionType type) { Validate.notNull(type, "ProtectionType must not be null."); int armorCount = 0; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/StatusEffect.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/StatusEffect.java index 23d2453a09..c8b40e55b4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/StatusEffect.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/player/StatusEffect.java @@ -26,12 +26,12 @@ public class StatusEffect implements Keyed { private final NamespacedKey key; - public StatusEffect(@Nonnull NamespacedKey key) { + public StatusEffect(NamespacedKey key) { this.key = key; } @Override - public @Nonnull NamespacedKey getKey() { + public NamespacedKey getKey() { return key; } @@ -47,7 +47,7 @@ public StatusEffect(@Nonnull NamespacedKey key) { * @param unit * The {@link TimeUnit} for the given duration */ - public void add(@Nonnull Player p, int duration, @Nonnull TimeUnit unit) { + public void add(Player p, int duration, TimeUnit unit) { add(p, 1, duration, unit); } @@ -63,7 +63,7 @@ public void add(@Nonnull Player p, int duration, @Nonnull TimeUnit unit) { * @param unit * The {@link TimeUnit} for the given duration */ - public void add(@Nonnull Player p, int level, int duration, @Nonnull TimeUnit unit) { + public void add(Player p, int level, int duration, TimeUnit unit) { PersistentDataAPI.setString(p, getKey(), level + ";" + System.currentTimeMillis() + unit.toMillis(duration)); } @@ -76,7 +76,7 @@ public void add(@Nonnull Player p, int level, int duration, @Nonnull TimeUnit un * @param level * The level of this effect */ - public void addPermanent(@Nonnull Player p, int level) { + public void addPermanent(Player p, int level) { PersistentDataAPI.setString(p, getKey(), level + ";0"); } @@ -90,7 +90,7 @@ public void addPermanent(@Nonnull Player p, int level) { * The {@link Player} to check for * @return Whether this {@link StatusEffect} is currently applied */ - public boolean isPresent(@Nonnull Player p) { + public boolean isPresent(Player p) { Optional optional = PersistentDataAPI.getOptionalString(p, getKey()); if (optional.isPresent()) { @@ -116,7 +116,7 @@ public boolean isPresent(@Nonnull Player p) { * The {@link Player} to check for * @return An {@link OptionalInt} that describes the result */ - public @Nonnull OptionalInt getLevel(@Nonnull Player p) { + public OptionalInt getLevel(Player p) { Optional optional = PersistentDataAPI.getOptionalString(p, getKey()); if (optional.isPresent()) { @@ -133,7 +133,7 @@ public boolean isPresent(@Nonnull Player p) { * @param p * The {@link Player} to clear it from */ - public void clear(@Nonnull Player p) { + public void clear(Player p) { PersistentDataAPI.remove(p, getKey()); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java index 18b43f5040..719d59eb54 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java @@ -234,7 +234,7 @@ public void unregister(ItemStack[] recipe, ItemStack result) { return this.item; } - public @Nonnull ItemStack getItem(Player p) { + public ItemStack getItem(Player p) { return Slimefun.getLocalization().getRecipeTypeItem(p, this); } @@ -243,7 +243,7 @@ public SlimefunItem getMachine() { } @Override - public final @Nonnull NamespacedKey getKey() { + public final NamespacedKey getKey() { return key; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/PlayerResearchTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/PlayerResearchTask.java index 7a77dd1d4e..c749d03c64 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/PlayerResearchTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/PlayerResearchTask.java @@ -42,7 +42,7 @@ public class PlayerResearchTask implements Consumer { * @param callback * The callback to run when the task has completed */ - PlayerResearchTask(@Nonnull Research research, boolean isInstant, @Nullable Consumer callback) { + PlayerResearchTask(Research research, boolean isInstant, @Nullable Consumer callback) { Validate.notNull(research, "The Research must not be null"); this.research = research; @@ -101,7 +101,7 @@ public void accept(PlayerProfile profile) { } } - private void sendUpdateMessage(@Nonnull Player p) { + private void sendUpdateMessage(Player p) { for (int i = 1; i < RESEARCH_PROGRESS.length + 1; i++) { int index = i; @@ -118,7 +118,7 @@ private void sendUpdateMessage(@Nonnull Player p) { } } - private void unlockResearch(@Nonnull Player p, @Nonnull PlayerProfile profile) { + private void unlockResearch(Player p, PlayerProfile profile) { profile.setResearched(research, true); Slimefun.getLocalization() .sendMessage(p, "messages.unlocked", true, msg -> msg.replace(PLACEHOLDER, research.getName(p))); @@ -136,7 +136,7 @@ private void unlockResearch(@Nonnull Player p, @Nonnull PlayerProfile profile) { * @param p * The {@link Player} who has unlocked this {@link Research} */ - private void onFinish(@Nonnull Player p) { + private void onFinish(Player p) { if (callback != null) { callback.accept(p); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/Research.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/Research.java index 777296d8e4..ebc326d19f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/Research.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/Research.java @@ -67,7 +67,7 @@ public class Research implements Keyed { * */ public Research( - @Nonnull NamespacedKey key, int id, @Nonnull String defaultName, int levelCost, double currencyCost) { + NamespacedKey key, int id, String defaultName, int levelCost, double currencyCost) { Validate.notNull(key, "A NamespacedKey must be provided"); Validate.notNull(defaultName, "A default name must be specified"); @@ -95,7 +95,7 @@ public Research( * The Cost in XP levels to unlock this {@link Research} * */ - public Research(@Nonnull NamespacedKey key, int id, @Nonnull String defaultName, int defaultCost) { + public Research(NamespacedKey key, int id, String defaultName, int defaultCost) { Validate.notNull(key, "A NamespacedKey must be provided"); Validate.notNull(defaultName, "A default name must be specified"); @@ -108,7 +108,7 @@ public Research(@Nonnull NamespacedKey key, int id, @Nonnull String defaultName, } @Override - public @Nonnull NamespacedKey getKey() { + public NamespacedKey getKey() { return key; } @@ -146,7 +146,7 @@ public int getID() { * * @return The localized Name of this {@link Research}. */ - public @Nonnull String getName(@Nonnull Player p) { + public String getName(Player p) { String localized = Slimefun.getLocalization().getResearchName(p, key); return localized != null ? localized : name; } @@ -156,7 +156,7 @@ public int getID() { * * @return The unlocalized, decolorized name for this {@link Research} */ - public @Nonnull String getUnlocalizedName() { + public String getUnlocalizedName() { return ChatColor.stripColor(name); } @@ -230,7 +230,7 @@ public void addItems(SlimefunItem... items) { * * @return The current instance of {@link Research} */ - @Nonnull + public Research addItems(ItemStack... items) { for (ItemStack item : items) { SlimefunItem sfItem = SlimefunItem.getByItem(item); @@ -248,7 +248,7 @@ public Research addItems(ItemStack... items) { * * @return The Slimefun items bound to this {@link Research}. */ - @Nonnull + public List getAffectedItems() { return items; } @@ -321,7 +321,7 @@ public void unlockFromGuide( * @param p The {@link Player} to check * @return Whether that {@link Player} can unlock this {@link Research} */ - public boolean canUnlock(@Nonnull Player p) { + public boolean canUnlock(Player p) { if (!isEnabled()) { return true; } @@ -348,7 +348,7 @@ public boolean canUnlock(@Nonnull Player p) { * @param instant * Whether to unlock it instantly */ - public void unlock(@Nonnull Player p, boolean instant) { + public void unlock(Player p, boolean instant) { unlock(p, instant, null); } @@ -362,7 +362,7 @@ public void unlock(@Nonnull Player p, boolean instant) { * @param callback * A callback which will be run when the {@link Research} animation completed */ - public void unlock(@Nonnull Player p, boolean isInstant, @Nullable Consumer callback) { + public void unlock(Player p, boolean isInstant, @Nullable Consumer callback) { PlayerProfile.get(p, new PlayerResearchTask(this, isInstant, callback)); } @@ -420,7 +420,7 @@ public void disable() { * @param key the {@link NamespacedKey} of the {@link Research} you are looking for * @return An {@link Optional} with or without the found {@link Research} */ - @Nonnull + public static Optional getResearch(@Nullable NamespacedKey key) { if (key == null) { return Optional.empty(); @@ -436,7 +436,7 @@ public static Optional getResearch(@Nullable NamespacedKey key) { } @Deprecated - public static Optional getResearchByID(@Nonnull Integer oldID) { + public static Optional getResearchByID(Integer oldID) { if (oldID == null) { return Optional.empty(); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java index b22cb3324a..aaa21b04f5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java @@ -75,7 +75,7 @@ public final class SlimefunRegistry { private final Map, Set> globalItemHandlers = new HashMap<>(); - public void load(@Nonnull Slimefun plugin) { + public void load(Slimefun plugin) { Validate.notNull(plugin, "The Plugin cannot be null!"); soulboundKey = new NamespacedKey(plugin, "soulbound"); @@ -94,7 +94,7 @@ public void load(@Nonnull Slimefun plugin) { * * @return {@link List} containing every enabled {@link ItemGroup} */ - @Nonnull + public List getAllItemGroups() { return categories; } @@ -104,7 +104,7 @@ public List getAllItemGroups() { * * @return A {@link List} containing every {@link SlimefunItem} */ - public @Nonnull List getAllSlimefunItems() { + public List getAllSlimefunItems() { return slimefunItems; } @@ -113,7 +113,7 @@ public List getAllItemGroups() { * * @return A {@link List} containing every disabled{@link SlimefunItem} */ - public @Nonnull List getDisabledSlimefunItems() { + public List getDisabledSlimefunItems() { List allItems = new ArrayList<>(getAllSlimefunItems()); List enabledItems = getEnabledSlimefunItems(); allItems.removeAll(enabledItems); @@ -125,7 +125,7 @@ public List getAllItemGroups() { * * @return A {@link List} containing every enabled {@link SlimefunItem} */ - @Nonnull + public List getEnabledSlimefunItems() { return enabledItems; } @@ -135,7 +135,7 @@ public List getEnabledSlimefunItems() { * * @return A {@link List} containing every enabled {@link Research} */ - @Nonnull + public List getResearches() { return researches; } @@ -147,12 +147,12 @@ public List getResearches() { * @return A {@link Set} holding the {@link UUID} from every {@link Player} * who is currently unlocking a {@link Research} */ - @Nonnull + public Set getCurrentlyResearchingPlayers() { return researchingPlayers; } - @Nonnull + public List getResearchRanks() { return researchRanks; } @@ -162,7 +162,7 @@ public List getResearchRanks() { * * @return A {@link List} containing every enabled {@link MultiBlock} */ - @Nonnull + public List getMultiBlocks() { return multiblocks; } @@ -180,8 +180,8 @@ public List getMultiBlocks() { * * @return The corresponding {@link SlimefunGuideImplementation} */ - @Nonnull - public SlimefunGuideImplementation getSlimefunGuide(@Nonnull SlimefunGuideMode mode) { + + public SlimefunGuideImplementation getSlimefunGuide(SlimefunGuideMode mode) { Validate.notNull(mode, "The Guide mode cannot be null"); SlimefunGuideImplementation guide = guides.get(mode); @@ -199,7 +199,7 @@ public SlimefunGuideImplementation getSlimefunGuide(@Nonnull SlimefunGuideMode m * * @return The {@link Map} of custom mob drops */ - @Nonnull + public Map> getMobDrops() { return mobDrops; } @@ -210,69 +210,69 @@ public Map> getMobDrops() { * * @return A {@link Set} of bartering drops */ - @Nonnull + public Set getBarteringDrops() { return barterDrops; } - @Nonnull + public Set getRadioactiveItems() { return radioactive; } - @Nonnull + public Set getTickerBlocks() { return tickers; } - @Nonnull + public Map getSlimefunItemIds() { return slimefunIds; } - @Nonnull + public Map getMenuPresets() { return blockMenuPresets; } - @Nonnull + public Map getPlayerProfiles() { return profiles; } - @Nonnull + public Map, Set> getGlobalItemHandlers() { return globalItemHandlers; } - @Nonnull - public Set getGlobalItemHandlers(@Nonnull Class identifier) { + + public Set getGlobalItemHandlers(Class identifier) { Validate.notNull(identifier, "The identifier for an ItemHandler cannot be null!"); return globalItemHandlers.computeIfAbsent(identifier, c -> new HashSet<>()); } - @Nonnull + public Map getChunks() { return chunks; } - @Nonnull + public KeyMap getGEOResources() { return geoResources; } - @Nonnull + public NamespacedKey getSoulboundDataKey() { return soulboundKey; } - @Nonnull + public NamespacedKey getItemChargeDataKey() { return itemChargeKey; } - @Nonnull + public NamespacedKey getGuideDataKey() { return guideKey; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DamageableItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DamageableItem.java index 6a4fae9115..978c0c1d6f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DamageableItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DamageableItem.java @@ -47,7 +47,7 @@ public interface DamageableItem extends ItemAttribute { * @param item * The {@link ItemStack} to damage */ - default void damageItem(@Nonnull Player p, @Nullable ItemStack item) { + default void damageItem(Player p, @Nullable ItemStack item) { if (isDamageable() && item != null && !item.getType().isAir() && item.getAmount() > 0) { int unbreakingLevel = item.getEnchantmentLevel(Enchantment.DURABILITY); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DistinctiveItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DistinctiveItem.java index c8297065f9..e210d2c52a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DistinctiveItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/DistinctiveItem.java @@ -27,5 +27,5 @@ public interface DistinctiveItem extends ItemAttribute { * * @return Whether the two {@link ItemMeta}s are stackable */ - boolean canStack(@Nonnull ItemMeta itemMetaOne, @Nonnull ItemMeta itemMetaTwo); + boolean canStack(ItemMeta itemMetaOne, ItemMeta itemMetaTwo); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/EnergyNetComponent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/EnergyNetComponent.java index 30aef09c33..b08d441145 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/EnergyNetComponent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/EnergyNetComponent.java @@ -38,7 +38,7 @@ public interface EnergyNetComponent extends ItemAttribute { * * @return The {@link EnergyNetComponentType} this {@link SlimefunItem} represents. */ - @Nonnull + EnergyNetComponentType getEnergyComponentType(); /** @@ -67,7 +67,7 @@ default boolean isChargeable() { * * @return The charge stored at that {@link Location} */ - default int getCharge(@Nonnull Location l) { + default int getCharge(Location l) { // Emergency fallback, this cannot hold a charge, so we'll just return zero if (!isChargeable()) { return 0; @@ -87,7 +87,7 @@ default int getCharge(@Nonnull Location l) { } @Deprecated - default int getCharge(@Nonnull Location l, @Nonnull Config config) { + default int getCharge(Location l, Config config) { Slimefun.logger().log(Level.FINE, "正在调用旧 BlockStorage 的方法, 建议使用对应附属的新方块存储适配版."); Validate.notNull(l, "Location was null!"); @@ -121,7 +121,7 @@ default int getCharge(@Nonnull Location l, @Nonnull Config config) { * * @return The charge stored at that {@link Location} */ - default int getCharge(@Nonnull Location l, @Nonnull SlimefunBlockData data) { + default int getCharge(Location l, SlimefunBlockData data) { Validate.notNull(l, "Location was null!"); Validate.notNull(data, "data was null!"); @@ -149,7 +149,7 @@ default int getCharge(@Nonnull Location l, @Nonnull SlimefunBlockData data) { * @param charge * The new charge */ - default void setCharge(@Nonnull Location l, int charge) { + default void setCharge(Location l, int charge) { Validate.notNull(l, "Location was null!"); Validate.isTrue(charge >= 0, "You can only set a charge of zero or more!"); @@ -193,7 +193,7 @@ default void setCharge(@Nonnull Location l, int charge) { } } - default void addCharge(@Nonnull Location l, int charge) { + default void addCharge(Location l, int charge) { Validate.notNull(l, "Location was null!"); Validate.isTrue(charge > 0, "You can only add a positive charge!"); @@ -227,7 +227,7 @@ default void addCharge(@Nonnull Location l, int charge) { } } - default void removeCharge(@Nonnull Location l, int charge) { + default void removeCharge(Location l, int charge) { Validate.notNull(l, "Location was null!"); Validate.isTrue(charge > 0, "The charge to remove must be greater than zero!"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/EnergyNetProvider.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/EnergyNetProvider.java index 57211bffd1..cdab67d2a4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/EnergyNetProvider.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/EnergyNetProvider.java @@ -26,7 +26,7 @@ public interface EnergyNetProvider extends EnergyNetComponent { @Override - @Nonnull + default EnergyNetComponentType getEnergyComponentType() { return EnergyNetComponentType.GENERATOR; } @@ -40,11 +40,11 @@ default EnergyNetComponentType getEnergyComponentType() { * @param data The stored block data * @return The generated output energy of this {@link EnergyNetProvider}. */ - default int getGeneratedOutput(@Nonnull Location l, @Nonnull SlimefunBlockData data) { + default int getGeneratedOutput(Location l, SlimefunBlockData data) { return getGeneratedOutput(l, new BlockDataConfigWrapper(data)); } - default int getGeneratedOutput(@Nonnull Location l, @Nonnull Config data) { + default int getGeneratedOutput(Location l, Config data) { return 0; } @@ -56,11 +56,11 @@ default int getGeneratedOutput(@Nonnull Location l, @Nonnull Config data) { * @param data The stored block data * @return Whether or not this {@link Location} will explode. */ - default boolean willExplode(@Nonnull Location l, @Nonnull SlimefunBlockData data) { + default boolean willExplode(Location l, SlimefunBlockData data) { return willExplode(l, new BlockDataConfigWrapper(data)); } - default boolean willExplode(@Nonnull Location l, @Nonnull Config data) { + default boolean willExplode(Location l, Config data) { return false; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ExternallyInteractable.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ExternallyInteractable.java index fe4b0f7181..4ccbf1863c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ExternallyInteractable.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ExternallyInteractable.java @@ -23,6 +23,6 @@ public interface ExternallyInteractable { * * @return The {@link InteractionResult} denoting the result of the interaction. */ - @Nonnull - InteractionResult onInteract(@Nonnull Location location); + + InteractionResult onInteract(Location location); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/HologramOwner.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/HologramOwner.java index 3b7ecaeae3..94c362480e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/HologramOwner.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/HologramOwner.java @@ -31,12 +31,12 @@ public interface HologramOwner extends ItemAttribute { * @param text * The nametag for the hologram */ - default void updateHologram(@Nonnull Block b, @Nonnull String text) { + default void updateHologram(Block b, String text) { Location loc = b.getLocation().add(getHologramOffset(b)); Slimefun.getHologramsService().setHologramLabel(loc, ChatColors.color(text)); } - default void updateHologram(@Nonnull Block b, @Nonnull String text, Supplier abort) { + default void updateHologram(Block b, String text, Supplier abort) { if (Bukkit.isPrimaryThread()) { if (abort.get()) { return; @@ -59,7 +59,7 @@ default void updateHologram(@Nonnull Block b, @Nonnull String text, Supplier extends ItemAt * * @return Our {@link MachineProcessor} */ - @Nonnull + MachineProcessor getMachineProcessor(); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineTier.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineTier.java index 834e848bd2..fa1d7c8338 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineTier.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineTier.java @@ -12,7 +12,7 @@ public enum MachineTier { private final String prefix; - MachineTier(@Nonnull String prefix) { + MachineTier(String prefix) { this.prefix = prefix; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineType.java index 99e729e4d7..3731e72fbe 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineType.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineType.java @@ -9,7 +9,7 @@ public enum MachineType { private final String suffix; - MachineType(@Nonnull String suffix) { + MachineType(String suffix) { this.suffix = suffix; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Placeable.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Placeable.java index 7edaa74270..6fb02d2ec9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Placeable.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Placeable.java @@ -17,11 +17,11 @@ */ public interface Placeable { - @Nonnull + Collection getDrops(); - @Nonnull - Collection getDrops(@Nonnull Player p); + + Collection getDrops(Player p); /** * This method determines how to treat this {@link Block} when it is broken. diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ProtectiveArmor.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ProtectiveArmor.java index 2e867ad3eb..e1d0ed06ae 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ProtectiveArmor.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ProtectiveArmor.java @@ -28,7 +28,7 @@ public interface ProtectiveArmor extends ItemAttribute { * * @return The {@link ProtectionType}s. */ - @Nonnull + ProtectionType[] getProtectionTypes(); /** diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RadiationSymptom.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RadiationSymptom.java index b8e1c0d6fd..5de90882c3 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RadiationSymptom.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RadiationSymptom.java @@ -30,7 +30,7 @@ public enum RadiationSymptom { private final int minExposure; private final PotionEffect potionEffect; - RadiationSymptom(int minExposure, @Nonnull PotionEffectType type, int level) { + RadiationSymptom(int minExposure, PotionEffectType type, int level) { Preconditions.checkNotNull(type, "The effect type cannot be null"); Preconditions.checkArgument(minExposure > 0, "The minimum exposure must be greater than 0."); Preconditions.checkArgument(level >= 0, "The status effect level must be non-negative."); @@ -46,7 +46,7 @@ public enum RadiationSymptom { * @param p * The player */ - public void apply(@Nonnull Player p) { + public void apply(Player p) { Preconditions.checkNotNull(p, "The player cannot be null"); p.addPotionEffect(potionEffect); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Radioactive.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Radioactive.java index 7f01d727ef..40a41e0f92 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Radioactive.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Radioactive.java @@ -21,6 +21,6 @@ public interface Radioactive extends ItemAttribute { * * @return The level of {@link Radioactivity} of this item. */ - @Nonnull + Radioactivity getRadioactivity(); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Radioactivity.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Radioactivity.java index 9ce090bb8c..f5fdb22552 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Radioactivity.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Radioactivity.java @@ -70,7 +70,7 @@ public int getExposureModifier() { return exposureModifier; } - public @Nonnull String getLore() { + public String getLore() { return ChatColor.GREEN + "\u2622" + ChatColor.GRAY + " 辐射等级: " + color + displayName; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RecipeDisplayItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RecipeDisplayItem.java index f18b0c3fa3..a3b2ce667a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RecipeDisplayItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RecipeDisplayItem.java @@ -36,16 +36,16 @@ public interface RecipeDisplayItem extends ItemAttribute { * * @return The recipes to display in the {@link SlimefunGuide} */ - @Nonnull + List getDisplayRecipes(); - @Nonnull + default String getLabelLocalPath() { return "guide.tooltips.recipes.machine"; } - @Nonnull - default String getRecipeSectionLabel(@Nonnull Player p) { + + default String getRecipeSectionLabel(Player p) { return "&7\u21E9 " + Slimefun.getLocalization().getMessage(p, getLabelLocalPath()) + " \u21E9"; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/WitherProof.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/WitherProof.java index 47f90f1754..fea7efcc92 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/WitherProof.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/WitherProof.java @@ -27,5 +27,5 @@ public interface WitherProof extends ItemAttribute { * @param wither * The {@link Wither} who attacked. */ - void onAttack(@Nonnull Block block, @Nonnull Wither wither); + void onAttack(Block block, Wither wither); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/interactions/ItemInteractionResult.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/interactions/ItemInteractionResult.java index f2832ee6c1..bbcccbc76a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/interactions/ItemInteractionResult.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/interactions/ItemInteractionResult.java @@ -12,7 +12,7 @@ */ public class ItemInteractionResult extends InteractionResult { - private final @Nonnull Set resultItems = new HashSet<>(); + private final Set resultItems = new HashSet<>(); /** * Creates a new InteractionResult. @@ -57,7 +57,7 @@ public boolean resultedInItems() { * * @return An unmodifiable {@link Set} of {@link ItemStack}(s) created due to the interaction. */ - public @Nonnull Set getResultItems() { + public Set getResultItems() { return Collections.unmodifiableSet(resultItems); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java index eb03665794..51625f354b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java @@ -36,7 +36,7 @@ public class SlimefunCommand implements CommandExecutor, Listener { * @param plugin * The instance of our {@link Slimefun} */ - public SlimefunCommand(@Nonnull Slimefun plugin) { + public SlimefunCommand(Slimefun plugin) { this.plugin = plugin; } @@ -51,7 +51,7 @@ public void register() { commands.addAll(SlimefunSubCommands.getAllCommands(this)); } - public @Nonnull Slimefun getPlugin() { + public Slimefun getPlugin() { return plugin; } @@ -60,7 +60,7 @@ public void register() { * * @return A {@link Map} holding the amount of times each command was run */ - public @Nonnull Map getCommandUsage() { + public Map getCommandUsage() { return commandUsage; } @@ -87,7 +87,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String return !commands.isEmpty(); } - public void sendHelp(@Nonnull CommandSender sender) { + public void sendHelp(CommandSender sender) { sender.sendMessage(""); sender.sendMessage(ChatColors.color("&aSlimefun &2v" + Slimefun.getVersion())); sender.sendMessage(""); @@ -112,7 +112,7 @@ public void onCommand(PlayerCommandPreprocessEvent e) { * * @return A {@link List} containing every {@link SubCommand} */ - public @Nonnull List getSubCommandNames() { + public List getSubCommandNames() { // @formatter:off return commands.stream().map(SubCommand::getName).collect(Collectors.toList()); // @formatter:on diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java index b3ee3a0ee5..035cef4961 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunTabCompleter.java @@ -24,7 +24,7 @@ class SlimefunTabCompleter implements TabCompleter { private final SlimefunCommand command; - public SlimefunTabCompleter(@Nonnull SlimefunCommand command) { + public SlimefunTabCompleter(SlimefunCommand command) { this.command = command; } @@ -85,8 +85,8 @@ public List onTabComplete(CommandSender sender, Command cmd, String labe * The typed string * @return Sublist if string is not empty */ - @Nonnull - private List createReturnList(@Nonnull List list, @Nonnull String string) { + + private List createReturnList(List list, String string) { if (string.length() == 0) { return list; } @@ -109,7 +109,7 @@ private List createReturnList(@Nonnull List list, @Nonnull Strin return returnList; } - @Nonnull + private List getSlimefunItems() { List items = Slimefun.getRegistry().getEnabledSlimefunItems(); List list = new ArrayList<>(items.size()); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SubCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SubCommand.java index 207d7c8772..1cc36bb4e0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SubCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SubCommand.java @@ -42,7 +42,7 @@ protected SubCommand(Slimefun plugin, SlimefunCommand cmd, String name, boolean * * @return The name of this {@link SubCommand} */ - @Nonnull + public final String getName() { return name; } @@ -56,13 +56,13 @@ public final boolean isHidden() { return hidden; } - protected void recordUsage(@Nonnull Map commandUsage) { + protected void recordUsage(Map commandUsage) { commandUsage.merge(this, 1, Integer::sum); } - public abstract void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args); + public abstract void onExecute(CommandSender sender, String[] args); - @Nonnull + protected String getDescription() { return "commands." + getName(); } @@ -77,7 +77,7 @@ protected String getDescription() { * * @return A possibly localized description of this {@link SubCommand} */ - public @Nonnull String getDescription(@Nonnull CommandSender sender) { + public String getDescription(CommandSender sender) { if (sender instanceof Player player) { return Slimefun.getLocalization().getMessage(player, getDescription()); } else { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BackpackCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BackpackCommand.java index d265a1d093..abb65f066c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BackpackCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BackpackCommand.java @@ -43,7 +43,7 @@ protected String getDescription() { } @Override - public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { + public void onExecute(CommandSender sender, String[] args) { if (sender instanceof Player player) { if (sender.hasPermission("slimefun.command.backpack")) { if (args.length < 1) { @@ -100,7 +100,7 @@ public void onResultNotFound() { } } - private void openBackpackMenu(@Nonnull OfflinePlayer owner, @Nonnull Player p) { + private void openBackpackMenu(OfflinePlayer owner, Player p) { Validate.notNull(p, "The player cannot be null!"); Slimefun.getDatabaseManager() diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BanItemCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BanItemCommand.java index bc8170c483..2be3fa5569 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BanItemCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/BanItemCommand.java @@ -26,7 +26,7 @@ public BanItemCommand(Slimefun plugin, SlimefunCommand cmd) { } @Override - public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { + public void onExecute(CommandSender sender, String[] args) { if (sender.hasPermission("slimefun.command.banitem") || sender instanceof ConsoleCommandSender) { if (args.length >= 2) { SlimefunItem item = SlimefunItem.getById(args[1]); @@ -62,7 +62,7 @@ public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { } } - @Nonnull + @Override public String getDescription() { return "commands.banitem.description"; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ClearDataCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ClearDataCommand.java index 6201a7e79b..0d9cfd4cf6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ClearDataCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ClearDataCommand.java @@ -22,7 +22,7 @@ public ClearDataCommand(Slimefun plugin, SlimefunCommand cmd) { } @Override - public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { + public void onExecute(CommandSender sender, String[] args) { if (sender.hasPermission("slimefun.command.cleardata") || sender instanceof ConsoleCommandSender) { if (args.length == 4 && args[3].equalsIgnoreCase("confirm")) { List worlds = new ArrayList<>(); @@ -91,7 +91,7 @@ public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { } } - @Nonnull + @Override public String getDescription() { return "commands.cleardata.description"; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/DebugCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/DebugCommand.java index 513b58301f..0c02dac240 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/DebugCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/DebugCommand.java @@ -16,17 +16,17 @@ */ public class DebugCommand extends SubCommand { - protected DebugCommand(@Nonnull Slimefun plugin, @Nonnull SlimefunCommand cmd) { + protected DebugCommand(Slimefun plugin, SlimefunCommand cmd) { super(plugin, cmd, "debug", true); } @Override - protected @Nonnull String getDescription() { + protected String getDescription() { return "commands.debug.description"; } @Override - public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { + public void onExecute(CommandSender sender, String[] args) { if (!sender.hasPermission("slimefun.command.debug")) { Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true); return; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ItemIdCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ItemIdCommand.java index caf1696611..d0c6852b4c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ItemIdCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ItemIdCommand.java @@ -21,7 +21,7 @@ protected ItemIdCommand(Slimefun plugin, SlimefunCommand cmd) { } @Override - public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { + public void onExecute(CommandSender sender, String[] args) { if (sender instanceof Player p) { if (sender.hasPermission("slimefun.command.id")) { var item = p.getInventory().getItemInMainHand(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/MigrateCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/MigrateCommand.java index e32b0b521a..5f25d5940e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/MigrateCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/MigrateCommand.java @@ -17,14 +17,14 @@ public class MigrateCommand extends SubCommand { super(plugin, cmd, "migrate", true); } - @Nonnull + @Override protected String getDescription() { return "commands.migrate.description"; } @Override - public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { + public void onExecute(CommandSender sender, String[] args) { if (sender.hasPermission("slimefun.command.migrate") || sender instanceof ConsoleCommandSender) { if (args.length > 1 && args[1].equalsIgnoreCase("confirm")) { Slimefun.getLocalization().sendMessage(sender, "commands.migrate.started", true); @@ -56,7 +56,7 @@ public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { } } - private void sendMigrateStatus(@Nonnull String migrateType, @Nonnull CommandSender sender, MigrateStatus status) { + private void sendMigrateStatus(String migrateType, CommandSender sender, MigrateStatus status) { switch (status) { case SUCCESS -> Slimefun.getLocalization() .sendMessage( diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ReloadCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ReloadCommand.java index 2dbbe72572..1aa3b83936 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ReloadCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ReloadCommand.java @@ -19,14 +19,14 @@ public class ReloadCommand extends SubCommand { super(plugin, cmd, "reload", false); } - @Nonnull + @Override protected String getDescription() { return "commands.reload.description"; } @Override - public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { + public void onExecute(CommandSender sender, String[] args) { if (sender.hasPermission("slimefun.command.reload") || sender instanceof ConsoleCommandSender) { if (Slimefun.getConfigManager().load(true)) { Slimefun.getLocalization().sendMessage(sender, "commands.reload.reload-success", true); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java index 01e837c6b6..33008e46af 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ResearchCommand.java @@ -114,8 +114,8 @@ private void reset(PlayerProfile profile, Player p) { .sendMessage(p, "commands.research.reset", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName())); } - @Nonnull - private Optional getResearchFromString(@Nonnull String input) { + + private Optional getResearchFromString(String input) { if (!input.contains(":")) { return Optional.empty(); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/SlimefunSubCommands.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/SlimefunSubCommands.java index 4a211cef09..aa7e9f8061 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/SlimefunSubCommands.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/SlimefunSubCommands.java @@ -20,8 +20,8 @@ public final class SlimefunSubCommands { private SlimefunSubCommands() {} - @Nonnull - public static Collection getAllCommands(@Nonnull SlimefunCommand cmd) { + + public static Collection getAllCommands(SlimefunCommand cmd) { Slimefun plugin = cmd.getPlugin(); List commands = new LinkedList<>(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TimingsCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TimingsCommand.java index 4e4666024f..9ee1c093d7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TimingsCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TimingsCommand.java @@ -28,12 +28,12 @@ class TimingsCommand extends SubCommand { } @Override - protected @Nonnull String getDescription() { + protected String getDescription() { return "commands.timings.description"; } @Override - public void onExecute(CommandSender sender, @Nonnull String[] args) { + public void onExecute(CommandSender sender, String[] args) { if (!sender.hasPermission("slimefun.command.timings") && !(sender instanceof ConsoleCommandSender)) { Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true); return; @@ -95,7 +95,7 @@ private boolean hasFlag(String[] args, String flag) { return false; } - @Nonnull + @ParametersAreNonnullByDefault private PerformanceInspector inspectorOf(CommandSender sender, boolean verbose, SummaryOrderType orderType) { if (sender instanceof Player player) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/UnbanItemCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/UnbanItemCommand.java index 4a52f3042d..ffc92cd7ab 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/UnbanItemCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/UnbanItemCommand.java @@ -24,7 +24,7 @@ public UnbanItemCommand(Slimefun plugin, SlimefunCommand cmd) { } @Override - public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { + public void onExecute(CommandSender sender, String[] args) { if (sender.hasPermission("slimefun.command.unbanitem") || sender instanceof ConsoleCommandSender) { if (args.length >= 2) { SlimefunItem item = SlimefunItem.getById(args[1]); @@ -50,7 +50,7 @@ public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { } } - @Nonnull + @Override public String getDescription() { return "commands.unbanitem.description"; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java index cd09d642e6..1e57fa419e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/VersionsCommand.java @@ -46,7 +46,7 @@ class VersionsCommand extends SubCommand { } @Override - public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { + public void onExecute(CommandSender sender, String[] args) { if (sender.hasPermission("slimefun.command.versions") || sender instanceof ConsoleCommandSender) { /* * After all these years... Spigot still displays as "CraftBukkit". @@ -90,7 +90,7 @@ public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) { } } - private void addJavaVersion(@Nonnull ComponentBuilder builder) { + private void addJavaVersion(ComponentBuilder builder) { int version = NumberUtils.getJavaVersion(); if (version < RECOMMENDED_JAVA_VERSION) { @@ -115,7 +115,7 @@ private void addJavaVersion(@Nonnull ComponentBuilder builder) { } } - private void addPluginVersions(@Nonnull ComponentBuilder builder) { + private void addPluginVersions(ComponentBuilder builder) { Collection addons = Slimefun.getInstalledAddons(); if (addons.isEmpty()) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/config/SlimefunConfigManager.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/config/SlimefunConfigManager.java index f7d045f755..2204a85abc 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/config/SlimefunConfigManager.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/config/SlimefunConfigManager.java @@ -68,7 +68,7 @@ public class SlimefunConfigManager { @Getter private boolean bypassEnvironmentCheck; - public SlimefunConfigManager(@Nonnull Slimefun plugin) { + public SlimefunConfigManager(Slimefun plugin) { Validate.notNull(plugin, "The Plugin instance cannot be null"); this.plugin = plugin; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/debug/Debug.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/debug/Debug.java index 8ad5d8558a..e5744fbda4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/debug/Debug.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/debug/Debug.java @@ -29,7 +29,7 @@ private Debug() {} * @param msg * The message to log */ - public static void log(@Nonnull TestCase testCase, @Nonnull String msg) { + public static void log(TestCase testCase, String msg) { log(testCase.toString(), msg, new Object[0]); } @@ -43,7 +43,7 @@ public static void log(@Nonnull TestCase testCase, @Nonnull String msg) { * @param vars * The variables to replace, use "{}" in the message and have it replaced with a specified thing */ - public static void log(@Nonnull TestCase testCase, @Nonnull String msg, @Nonnull Object... vars) { + public static void log(TestCase testCase, String msg, Object... vars) { log(testCase.toString(), msg, vars); } @@ -55,7 +55,7 @@ public static void log(@Nonnull TestCase testCase, @Nonnull String msg, @Nonnull * @param msg * The message to log */ - public static void log(@Nonnull String test, @Nonnull String msg) { + public static void log(String test, String msg) { log(test, msg, new Object[0]); } @@ -69,7 +69,7 @@ public static void log(@Nonnull String test, @Nonnull String msg) { * @param vars * The variables to replace, use "{}" in the message and have it replaced with a specified thing */ - public static void log(@Nonnull String test, @Nonnull String msg, @Nonnull Object... vars) { + public static void log(String test, String msg, Object... vars) { if (!testCase.contains(test)) { return; } @@ -98,7 +98,7 @@ public static void log(@Nonnull String test, @Nonnull String msg, @Nonnull Objec * * @return The resulting String */ - private static @Nonnull String formatMessage(@Nonnull String msg, @Nonnull Object... vars) { + private static String formatMessage(String msg, Object... vars) { int i = 0; int idx = 0; @@ -128,7 +128,7 @@ public static void addTestCase(@Nullable String test) { * * @return The current test case to enable or null if disabled */ - public static @Nonnull List getTestCase() { + public static List getTestCase() { return testCase; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/debug/TestCase.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/debug/TestCase.java index 7c413f7b9f..4054ab5530 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/debug/TestCase.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/debug/TestCase.java @@ -29,7 +29,7 @@ public enum TestCase { TestCase() {} @Override - public @Nonnull String toString() { + public String toString() { return "slimefun_" + name().toLowerCase(Locale.ROOT); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/GuideEntry.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/GuideEntry.java index adf84d2a9c..0a7c3ab6fa 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/GuideEntry.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/GuideEntry.java @@ -7,12 +7,12 @@ class GuideEntry { private final T object; private int page; - GuideEntry(@Nonnull T object, int page) { + GuideEntry(T object, int page) { this.object = object; this.page = page; } - @Nonnull + public T getIndexedObject() { return object; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/GuideHistory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/GuideHistory.java index e0b81251ec..78d95939f4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/GuideHistory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/GuideHistory.java @@ -33,7 +33,7 @@ public class GuideHistory { * @param profile * The {@link PlayerProfile} this {@link GuideHistory} was made for */ - public GuideHistory(@Nonnull PlayerProfile profile) { + public GuideHistory(PlayerProfile profile) { Validate.notNull(profile, "Cannot create a GuideHistory without a PlayerProfile!"); this.profile = profile; } @@ -76,7 +76,7 @@ public int getMainMenuPage() { * @param page * The current page of the {@link ItemGroup} that should be stored */ - public void add(@Nonnull ItemGroup itemGroup, int page) { + public void add(ItemGroup itemGroup, int page) { refresh(itemGroup, page); } @@ -90,7 +90,7 @@ public void add(@Nonnull ItemGroup itemGroup, int page) { * @param page * The current page of the recipes of this {@link ItemStack} */ - public void add(@Nonnull ItemStack item, int page) { + public void add(ItemStack item, int page) { refresh(item, page); } @@ -100,7 +100,7 @@ public void add(@Nonnull ItemStack item, int page) { * @param item * The {@link SlimefunItem} that should be added to this {@link GuideHistory} */ - public void add(@Nonnull SlimefunItem item) { + public void add(SlimefunItem item) { Validate.notNull(item, "Cannot add a non-existing SlimefunItem to the GuideHistory!"); queue.add(new GuideEntry<>(item, 0)); } @@ -111,12 +111,12 @@ public void add(@Nonnull SlimefunItem item) { * @param searchTerm * The term that the {@link Player} searched for */ - public void add(@Nonnull String searchTerm) { + public void add(String searchTerm) { Validate.notNull(searchTerm, "Cannot add an empty Search Term to the GuideHistory!"); queue.add(new GuideEntry<>(searchTerm, 0)); } - private void refresh(@Nonnull T object, int page) { + private void refresh(T object, int page) { Validate.notNull(object, "Cannot add a null Entry to the GuideHistory!"); Validate.isTrue(page >= 0, "page must not be negative!"); @@ -161,7 +161,7 @@ public int size() { * @param guide * The {@link SlimefunGuideImplementation} to use */ - public void openLastEntry(@Nonnull SlimefunGuideImplementation guide) { + public void openLastEntry(SlimefunGuideImplementation guide) { GuideEntry entry = getLastEntry(false); open(guide, entry); } @@ -176,12 +176,12 @@ public void openLastEntry(@Nonnull SlimefunGuideImplementation guide) { * @param guide * The {@link SlimefunGuideImplementation} to use */ - public void goBack(@Nonnull SlimefunGuideImplementation guide) { + public void goBack(SlimefunGuideImplementation guide) { GuideEntry entry = getLastEntry(true); open(guide, entry); } - private void open(@Nonnull SlimefunGuideImplementation guide, @Nullable GuideEntry entry) { + private void open(SlimefunGuideImplementation guide, @Nullable GuideEntry entry) { if (entry == null) { guide.openMainMenu(profile, mainMenuPage); } else if (entry.getIndexedObject() instanceof ItemGroup group) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuide.java index 20128043aa..3118053edb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuide.java @@ -29,16 +29,16 @@ public final class SlimefunGuide { private SlimefunGuide() {} - @Nonnull - public static ItemStack getItem(@Nonnull SlimefunGuideMode design) { + + public static ItemStack getItem(SlimefunGuideMode design) { return Slimefun.getRegistry().getSlimefunGuide(design).getItem(); } - public static void openCheatMenu(@Nonnull Player p) { + public static void openCheatMenu(Player p) { openMainMenuAsync(p, SlimefunGuideMode.CHEAT_MODE, 1); } - public static void openGuide(@Nonnull Player p, @Nullable ItemStack guide) { + public static void openGuide(Player p, @Nullable ItemStack guide) { if (getItem(SlimefunGuideMode.CHEAT_MODE).equals(guide)) { openGuide(p, SlimefunGuideMode.CHEAT_MODE); } else { @@ -50,7 +50,7 @@ public static void openGuide(@Nonnull Player p, @Nullable ItemStack guide) { } } - public static void openGuide(@Nonnull Player p, @Nonnull SlimefunGuideMode mode) { + public static void openGuide(Player p, SlimefunGuideMode mode) { if (!Slimefun.getWorldSettingsService().isWorldEnabled(p.getWorld())) { return; } @@ -129,7 +129,7 @@ public static boolean isGuideItem(@Nullable ItemStack item) { * * @return The default {@link SlimefunGuideMode}. */ - @Nonnull + public static SlimefunGuideMode getDefaultMode() { return SlimefunGuideMode.SURVIVAL_MODE; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuideImplementation.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuideImplementation.java index 532f886e2e..c0f3bfc8ed 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuideImplementation.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuideImplementation.java @@ -33,7 +33,7 @@ public interface SlimefunGuideImplementation { * * @return The mode this {@link SlimefunGuideImplementation} represents */ - @Nonnull + SlimefunGuideMode getMode(); /** @@ -43,7 +43,7 @@ public interface SlimefunGuideImplementation { * * @return The {@link ItemStack} representation for this {@link SlimefunGuideImplementation} */ - @Nonnull + ItemStack getItem(); @ParametersAreNonnullByDefault diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuideMode.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuideMode.java index e4ef843624..a0826efd9d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuideMode.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/SlimefunGuideMode.java @@ -28,7 +28,7 @@ public enum SlimefunGuideMode { private final String displayName; - SlimefunGuideMode(@Nonnull String displayName) { + SlimefunGuideMode(String displayName) { this.displayName = displayName; } @@ -37,7 +37,7 @@ public enum SlimefunGuideMode { * * @return 指南书样式的显示名称 */ - public @Nonnull String getDisplayName() { + public String getDisplayName() { return displayName; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java index 5ce62204d7..71297df4ff 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java @@ -19,19 +19,19 @@ class GuideModeOption implements SlimefunGuideOption { - @Nonnull + @Override public SlimefunAddon getAddon() { return Slimefun.instance(); } - @Nonnull + @Override public NamespacedKey getKey() { return new NamespacedKey(Slimefun.instance(), "guide_mode"); } - @Nonnull + @Override public Optional getDisplayItem(Player p, ItemStack guide) { if (!p.hasPermission("slimefun.cheat.items")) { @@ -70,7 +70,7 @@ public Optional getDisplayItem(Player p, ItemStack guide) { } @Override - public void onClick(@Nonnull Player p, @Nonnull ItemStack guide) { + public void onClick(Player p, ItemStack guide) { Optional current = getSelectedOption(p, guide); if (current.isPresent()) { @@ -81,8 +81,8 @@ public void onClick(@Nonnull Player p, @Nonnull ItemStack guide) { SlimefunGuideSettings.openSettings(p, guide); } - @Nonnull - private SlimefunGuideMode getNextMode(@Nonnull Player p, @Nonnull SlimefunGuideMode mode) { + + private SlimefunGuideMode getNextMode(Player p, SlimefunGuideMode mode) { if (p.hasPermission("slimefun.cheat.items")) { if (mode == SlimefunGuideMode.SURVIVAL_MODE) { return SlimefunGuideMode.CHEAT_MODE; @@ -94,9 +94,9 @@ private SlimefunGuideMode getNextMode(@Nonnull Player p, @Nonnull SlimefunGuideM } } - @Nonnull + @Override - public Optional getSelectedOption(@Nonnull Player p, @Nonnull ItemStack guide) { + public Optional getSelectedOption(Player p, ItemStack guide) { if (SlimefunUtils.isItemSimilar(guide, SlimefunGuide.getItem(SlimefunGuideMode.CHEAT_MODE), true, false)) { return Optional.of(SlimefunGuideMode.CHEAT_MODE); } else { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/LearningAnimationOption.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/LearningAnimationOption.java index 06ece07849..dd42820929 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/LearningAnimationOption.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/LearningAnimationOption.java @@ -22,21 +22,21 @@ */ class LearningAnimationOption implements SlimefunGuideOption { - @Nonnull + @Override public SlimefunAddon getAddon() { return Slimefun.instance(); } - @Nonnull + @Override public NamespacedKey getKey() { return new NamespacedKey(Slimefun.instance(), "research_learning_animation"); } - @Nonnull + @Override - public Optional getDisplayItem(@Nonnull Player p, @Nonnull ItemStack guide) { + public Optional getDisplayItem(Player p, ItemStack guide) { SlimefunConfigManager cfgManager = Slimefun.getConfigManager(); if (!cfgManager.isResearchingEnabled() || cfgManager.isLearningAnimationDisabled()) { @@ -57,20 +57,20 @@ public Optional getDisplayItem(@Nonnull Player p, @Nonnull ItemStack } @Override - public void onClick(@Nonnull Player p, @Nonnull ItemStack guide) { + public void onClick(Player p, ItemStack guide) { setSelectedOption(p, guide, !getSelectedOption(p, guide).orElse(true)); SlimefunGuideSettings.openSettings(p, guide); } @Override - public Optional getSelectedOption(@Nonnull Player p, @Nonnull ItemStack guide) { + public Optional getSelectedOption(Player p, ItemStack guide) { NamespacedKey key = getKey(); boolean value = !PersistentDataAPI.hasByte(p, key) || PersistentDataAPI.getByte(p, key) == (byte) 1; return Optional.of(value); } @Override - public void setSelectedOption(@Nonnull Player p, @Nonnull ItemStack guide, @Nonnull Boolean value) { + public void setSelectedOption(Player p, ItemStack guide, Boolean value) { PersistentDataAPI.setByte(p, getKey(), (byte) (value.booleanValue() ? 1 : 0)); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideOption.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideOption.java index 82100c96ff..b2158accf7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideOption.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideOption.java @@ -23,7 +23,7 @@ public interface SlimefunGuideOption extends Keyed { * * @return The registering {@link SlimefunAddon} */ - @Nonnull + SlimefunAddon getAddon(); Optional getDisplayItem(Player p, ItemStack guide); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java index 74b4172efa..0a66b28d3d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/SlimefunGuideSettings.java @@ -51,7 +51,7 @@ public final class SlimefunGuideSettings { private SlimefunGuideSettings() {} - public static void addOption(@Nonnull SlimefunGuideOption option) { + public static void addOption(SlimefunGuideOption option) { options.add(option); } @@ -229,7 +229,7 @@ private static void addConfigurableOptions(Player p, ChestMenu menu, ItemStack g * * @return Whether this {@link Player} wants to see fireworks when unlocking a {@link Research} */ - public static boolean hasFireworksEnabled(@Nonnull Player p) { + public static boolean hasFireworksEnabled(Player p) { return getOptionValue(p, FireworksOption.class, true); } @@ -243,7 +243,7 @@ public static boolean hasFireworksEnabled(@Nonnull Player p) { * * @return Whether this {@link Player} wants to info messages in chat when unlocking a {@link Research} */ - public static boolean hasLearningAnimationEnabled(@Nonnull Player p) { + public static boolean hasLearningAnimationEnabled(Player p) { return getOptionValue(p, LearningAnimationOption.class, true); } @@ -264,9 +264,9 @@ public static boolean hasLearningAnimationEnabled(@Nonnull Player p) { * * @return The value of given {@link SlimefunGuideOption} */ - @Nonnull + private static , V> V getOptionValue( - @Nonnull Player p, @Nonnull Class optionsClass, @Nonnull V defaultValue) { + Player p, Class optionsClass, V defaultValue) { for (SlimefunGuideOption option : options) { if (optionsClass.isInstance(option)) { T o = optionsClass.cast(option); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockBreakHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockBreakHandler.java index 60affc23b5..e210cabf51 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockBreakHandler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockBreakHandler.java @@ -69,7 +69,7 @@ public void onAndroidBreak(AndroidMineEvent e) { * The {@link Block} * @return Whether explosions can destroy this {@link Block} */ - public boolean isExplosionAllowed(@Nonnull Block b) { + public boolean isExplosionAllowed(Block b) { /* * By default our flag is returned, but you can override it * to be handled on a per-Block basis. @@ -86,7 +86,7 @@ public boolean isExplosionAllowed(@Nonnull Block b) { * * @return Whether androids can break the given {@link Block} */ - public boolean isAndroidAllowed(@Nonnull Block b) { + public boolean isAndroidAllowed(Block b) { /* * By default our flag is returned, but you can override it * to be handled on a per-Block basis. diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockPlaceHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockPlaceHandler.java index b660ea7e47..6dc3a466d5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockPlaceHandler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockPlaceHandler.java @@ -31,7 +31,7 @@ protected BlockPlaceHandler(boolean allowBlockPlacers) { * @param e * The corresponding {@link BlockPlaceEvent} */ - public abstract void onPlayerPlace(@Nonnull BlockPlaceEvent e); + public abstract void onPlayerPlace(BlockPlaceEvent e); /** * This method is called whenever a {@link BlockPlacer} places this {@link Block}. @@ -42,7 +42,7 @@ protected BlockPlaceHandler(boolean allowBlockPlacers) { * @param e * The corresponding {@link BlockPlacerPlaceEvent} */ - public void onBlockPlacerPlace(@Nonnull BlockPlacerPlaceEvent e) { + public void onBlockPlacerPlace(BlockPlacerPlaceEvent e) { // This can be overridden, if necessary } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/RainbowTickHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/RainbowTickHandler.java index 6eb8af7ec3..bc5852b609 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/RainbowTickHandler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/RainbowTickHandler.java @@ -33,7 +33,7 @@ public class RainbowTickHandler extends BlockTicker { private final boolean glassPanes; private Material material; - public RainbowTickHandler(@Nonnull List materials) { + public RainbowTickHandler(List materials) { Validate.noNullElements(materials, "A RainbowTicker cannot have a Material that is null!"); if (materials.isEmpty()) { @@ -45,11 +45,11 @@ public RainbowTickHandler(@Nonnull List materials) { material = iterator.next(); } - public RainbowTickHandler(@Nonnull Material... materials) { + public RainbowTickHandler(Material... materials) { this(Arrays.asList(materials)); } - public RainbowTickHandler(@Nonnull ColoredMaterial material) { + public RainbowTickHandler(ColoredMaterial material) { this(material.asList()); } @@ -64,7 +64,7 @@ public RainbowTickHandler(@Nonnull ColoredMaterial material) { * * @return Whether the array contained any {@link GlassPane} materials */ - private boolean containsGlassPanes(@Nonnull List materials) { + private boolean containsGlassPanes(List materials) { for (Material type : materials) { /* This BlockData is purely virtual and only created on startup, it should have diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/WeaponUseHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/WeaponUseHandler.java index 30ce24818a..b6f21a1ad6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/WeaponUseHandler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/WeaponUseHandler.java @@ -27,7 +27,7 @@ public interface WeaponUseHandler extends ItemHandler { * @param item * The {@link ItemStack} that was used to attack */ - void onHit(@Nonnull EntityDamageByEntityEvent e, @Nonnull Player player, @Nonnull ItemStack item); + void onHit(EntityDamageByEntityEvent e, Player player, ItemStack item); @Override default Class getIdentifier() { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java index aa45d4329a..7f31fd4113 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/machines/MachineProcessor.java @@ -41,7 +41,7 @@ public class MachineProcessor { * @param owner * The owner of this {@link MachineProcessor}. */ - public MachineProcessor(@Nonnull MachineProcessHolder owner) { + public MachineProcessor(MachineProcessHolder owner) { Validate.notNull(owner, "The MachineProcessHolder cannot be null."); this.owner = owner; @@ -52,7 +52,7 @@ public MachineProcessor(@Nonnull MachineProcessHolder owner) { * * @return The owner / holder */ - @Nonnull + public MachineProcessHolder getOwner() { return owner; } @@ -89,7 +89,7 @@ public void setProgressBar(@Nullable ItemStack progressBar) { * @return Whether the {@link MachineOperation} was successfully started. This will return false if another * {@link MachineOperation} has already been started at that {@link Location}. */ - public boolean startOperation(@Nonnull Location loc, @Nonnull T operation) { + public boolean startOperation(Location loc, T operation) { Validate.notNull(loc, "The location must not be null"); Validate.notNull(operation, "The operation cannot be null"); @@ -107,7 +107,7 @@ public boolean startOperation(@Nonnull Location loc, @Nonnull T operation) { * @return Whether the {@link MachineOperation} was successfully started. This will return false if another * {@link MachineOperation} has already been started at that {@link Block}. */ - public boolean startOperation(@Nonnull Block b, @Nonnull T operation) { + public boolean startOperation(Block b, T operation) { Validate.notNull(b, "The Block must not be null"); Validate.notNull(operation, "The machine operation cannot be null"); @@ -125,7 +125,7 @@ public boolean startOperation(@Nonnull Block b, @Nonnull T operation) { * @return Whether the {@link MachineOperation} was successfully started. This will return false if another * {@link MachineOperation} has already been started at that {@link BlockPosition}. */ - public boolean startOperation(@Nonnull BlockPosition pos, @Nonnull T operation) { + public boolean startOperation(BlockPosition pos, T operation) { Validate.notNull(pos, "The BlockPosition must not be null"); Validate.notNull(operation, "The machine operation cannot be null"); @@ -140,7 +140,7 @@ public boolean startOperation(@Nonnull BlockPosition pos, @Nonnull T operation) * * @return The current {@link MachineOperation} or null. */ - @Nullable public T getOperation(@Nonnull Location loc) { + @Nullable public T getOperation(Location loc) { Validate.notNull(loc, "The location cannot be null"); return getOperation(new BlockPosition(loc)); @@ -154,7 +154,7 @@ public boolean startOperation(@Nonnull BlockPosition pos, @Nonnull T operation) * * @return The current {@link MachineOperation} or null. */ - @Nullable public T getOperation(@Nonnull Block b) { + @Nullable public T getOperation(Block b) { Validate.notNull(b, "The Block cannot be null"); return getOperation(new BlockPosition(b)); @@ -168,7 +168,7 @@ public boolean startOperation(@Nonnull BlockPosition pos, @Nonnull T operation) * * @return The current {@link MachineOperation} or null. */ - @Nullable public T getOperation(@Nonnull BlockPosition pos) { + @Nullable public T getOperation(BlockPosition pos) { Validate.notNull(pos, "The BlockPosition must not be null"); return machines.get(pos); @@ -183,7 +183,7 @@ public boolean startOperation(@Nonnull BlockPosition pos, @Nonnull T operation) * @return Whether the {@link MachineOperation} was successfully ended. This will return false if there was no * {@link MachineOperation} to begin with. */ - public boolean endOperation(@Nonnull Location loc) { + public boolean endOperation(Location loc) { Validate.notNull(loc, "The location should not be null"); return endOperation(new BlockPosition(loc)); @@ -198,7 +198,7 @@ public boolean endOperation(@Nonnull Location loc) { * @return Whether the {@link MachineOperation} was successfully ended. This will return false if there was no * {@link MachineOperation} to begin with. */ - public boolean endOperation(@Nonnull Block b) { + public boolean endOperation(Block b) { Validate.notNull(b, "The Block should not be null"); return endOperation(new BlockPosition(b)); @@ -213,7 +213,7 @@ public boolean endOperation(@Nonnull Block b) { * @return Whether the {@link MachineOperation} was successfully ended. This will return false if there was no * {@link MachineOperation} to begin with. */ - public boolean endOperation(@Nonnull BlockPosition pos) { + public boolean endOperation(BlockPosition pos) { Validate.notNull(pos, "The BlockPosition cannot be null"); T operation = machines.remove(pos); @@ -236,7 +236,7 @@ public boolean endOperation(@Nonnull BlockPosition pos) { } } - public void updateProgressBar(@Nonnull BlockMenu inv, int slot, @Nonnull T operation) { + public void updateProgressBar(BlockMenu inv, int slot, T operation) { Validate.notNull(inv, "The inventory must not be null."); Validate.notNull(operation, "The MachineOperation must not be null."); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlock.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlock.java index f0f709629d..e6b24d23d7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlock.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlock.java @@ -41,7 +41,7 @@ public class MultiBlock { SUPPORTED_TAGS.add(Tag.FIRE); } - @Nonnull + public static Set> getSupportedTags() { return SUPPORTED_TAGS; } @@ -51,7 +51,7 @@ public static Set> getSupportedTags() { private final BlockFace trigger; private final boolean isSymmetric; - public MultiBlock(@Nonnull SlimefunItem item, Material[] build, @Nonnull BlockFace trigger) { + public MultiBlock(SlimefunItem item, Material[] build, BlockFace trigger) { Validate.notNull(item, "A MultiBlock requires a SlimefunItem!"); if (build == null || build.length != 9) { @@ -68,21 +68,21 @@ public MultiBlock(@Nonnull SlimefunItem item, Material[] build, @Nonnull BlockFa this.isSymmetric = isSymmetric(build); } - @Nonnull + public SlimefunItem getSlimefunItem() { return item; } - private static boolean isSymmetric(@Nonnull Material[] blocks) { + private static boolean isSymmetric(Material[] blocks) { return blocks[0] == blocks[2] && blocks[3] == blocks[5] && blocks[6] == blocks[8]; } - @Nonnull + public Material[] getStructure() { return blocks; } - @Nonnull + public BlockFace getTriggerBlock() { return trigger; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java index 348027af20..a44dc4f8c4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java @@ -69,20 +69,20 @@ protected MultiBlockMachine(ItemGroup itemGroup, SlimefunItemStack item, ItemSta this(itemGroup, item, recipe, new ItemStack[0], trigger); } - protected void registerDefaultRecipes(@Nonnull List recipes) { + protected void registerDefaultRecipes(List recipes) { // Override this method to register some default recipes } - public @Nonnull List getRecipes() { + public List getRecipes() { return recipes; } @Override - public @Nonnull List getDisplayRecipes() { + public List getDisplayRecipes() { return displayRecipes; } - public @Nonnull MultiBlock getMultiBlock() { + public MultiBlock getMultiBlock() { return multiblock; } @@ -98,7 +98,7 @@ public void clearRecipe() { } @Override - public void register(@Nonnull SlimefunAddon addon) { + public void register(SlimefunAddon addon) { addItemHandler(getInteractionHandler()); super.register(addon); } @@ -132,7 +132,7 @@ public void load() { } } - protected @Nonnull MultiBlockInteractionHandler getInteractionHandler() { + protected MultiBlockInteractionHandler getInteractionHandler() { return (p, mb, b) -> { if (mb.equals(getMultiBlock())) { if (canUse(p, true) @@ -214,7 +214,7 @@ protected void handleCraftedItem(ItemStack outputItem, Block block, Inventory bl } } - private static @Nonnull Material[] convertItemStacksToMaterial(@Nonnull ItemStack[] items) { + private static Material[] convertItemStacksToMaterial(ItemStack[] items) { List materials = new ArrayList<>(); for (ItemStack item : items) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/NetworkManager.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/NetworkManager.java index d44c7d4a80..8ea326cd43 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/NetworkManager.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/NetworkManager.java @@ -111,13 +111,13 @@ public boolean isItemDeletionEnabled() { * * @return A {@link List} containing every {@link Network} on the {@link Server} */ - @Nonnull + public List getNetworkList() { return Collections.unmodifiableList(networks); } - @Nonnull - public Optional getNetworkFromLocation(@Nullable Location l, @Nonnull Class type) { + + public Optional getNetworkFromLocation(@Nullable Location l, Class type) { if (l == null) { return Optional.empty(); } @@ -133,8 +133,8 @@ public Optional getNetworkFromLocation(@Nullable Location return Optional.empty(); } - @Nonnull - public List getNetworksFromLocation(@Nullable Location l, @Nonnull Class type) { + + public List getNetworksFromLocation(@Nullable Location l, Class type) { if (l == null) { // No networks here, if the location does not even exist return new ArrayList<>(); @@ -158,7 +158,7 @@ public List getNetworksFromLocation(@Nullable Location l, * @param network * The {@link Network} to register */ - public void registerNetwork(@Nonnull Network network) { + public void registerNetwork(Network network) { Validate.notNull(network, "Cannot register a null Network"); Debug.log( @@ -173,7 +173,7 @@ public void registerNetwork(@Nonnull Network network) { * @param network * The {@link Network} to remove */ - public void unregisterNetwork(@Nonnull Network network) { + public void unregisterNetwork(Network network) { Validate.notNull(network, "Cannot unregister a null Network"); Debug.log( @@ -190,7 +190,7 @@ public void unregisterNetwork(@Nonnull Network network) { * @param l * The {@link Location} to update */ - public void updateAllNetworks(@Nonnull Location l) { + public void updateAllNetworks(Location l) { Validate.notNull(l, "The Location cannot be null"); Debug.log(TestCase.ENERGYNET, "Updating all networks now."); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java index 6431327ae7..a845cbc828 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/AbstractItemNetwork.java @@ -40,11 +40,11 @@ abstract class AbstractItemNetwork extends Network { */ protected Map filterCache = new HashMap<>(); - protected AbstractItemNetwork(@Nonnull Location regulator) { + protected AbstractItemNetwork(Location regulator) { super(Slimefun.getNetworkManager(), regulator); } - protected Optional getAttachedBlock(@Nonnull Location l) { + protected Optional getAttachedBlock(Location l) { if (l.getWorld().isChunkLoaded(l.getBlockX() >> 4, l.getBlockZ() >> 4)) { Block block = l.getBlock(); @@ -66,7 +66,7 @@ protected Optional getAttachedBlock(@Nonnull Location l) { } @Override - public void markDirty(@Nonnull Location l) { + public void markDirty(Location l) { markCargoNodeConfigurationDirty(l); super.markDirty(l); } @@ -78,7 +78,7 @@ public void markDirty(@Nonnull Location l) { * @param node * The {@link Location} of the cargo node */ - public void markCargoNodeConfigurationDirty(@Nonnull Location node) { + public void markCargoNodeConfigurationDirty(Location node) { ItemFilter filter = filterCache.get(node); if (filter != null) { @@ -113,7 +113,7 @@ private void filter(@Nullable ItemStack stack, List items, } } - protected @Nonnull ItemFilter getItemFilter(@Nonnull Block node) { + protected ItemFilter getItemFilter(Block node) { Location loc = node.getLocation(); ItemFilter filter = filterCache.get(loc); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java index 0c7363a966..e8227627cc 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNet.java @@ -48,13 +48,13 @@ public class CargoNet extends AbstractItemNetwork implements HologramOwner { protected final Map roundRobin = new HashMap<>(); private int tickDelayThreshold = 0; - public static @Nullable CargoNet getNetworkFromLocation(@Nonnull Location l) { + public static @Nullable CargoNet getNetworkFromLocation(Location l) { return Slimefun.getNetworkManager() .getNetworkFromLocation(l, CargoNet.class) .orElse(null); } - public static @Nonnull CargoNet getNetworkFromLocationOrCreate(@Nonnull Location l) { + public static CargoNet getNetworkFromLocationOrCreate(Location l) { Optional cargoNetwork = Slimefun.getNetworkManager().getNetworkFromLocation(l, CargoNet.class); if (cargoNetwork.isPresent()) { @@ -72,7 +72,7 @@ public class CargoNet extends AbstractItemNetwork implements HologramOwner { * @param l * The {@link Location} marking the manager of this {@link Network}. */ - protected CargoNet(@Nonnull Location l) { + protected CargoNet(Location l) { super(l); } @@ -87,7 +87,7 @@ public int getRange() { } @Override - public NetworkComponent classifyLocation(@Nonnull Location l) { + public NetworkComponent classifyLocation(Location l) { var data = StorageCacheUtils.getBlock(l); if (data == null) { @@ -121,7 +121,7 @@ public void onClassificationChange(Location l, NetworkComponent from, NetworkCom } } - public void tick(@Nonnull Block b, SlimefunBlockData blockData) { + public void tick(Block b, SlimefunBlockData blockData) { if (!regulator.equals(b.getLocation())) { updateHologram(b, "&4发现附近有多个货运网络调节机", blockData::isPendingRemove); return; @@ -168,7 +168,7 @@ public void tick(@Nonnull Block b, SlimefunBlockData blockData) { } } - private @Nonnull Map mapInputNodes() { + private Map mapInputNodes() { Map inputs = new HashMap<>(); for (Location node : inputNodes) { @@ -182,7 +182,7 @@ public void tick(@Nonnull Block b, SlimefunBlockData blockData) { return inputs; } - private @Nonnull Map> mapOutputNodes() { + private Map> mapOutputNodes() { Map> output = new HashMap<>(); List list = new LinkedList<>(); @@ -227,7 +227,7 @@ public void tick(@Nonnull Block b, SlimefunBlockData blockData) { * * @return The frequency of the given node */ - private static int getFrequency(@Nonnull Location node) { + private static int getFrequency(Location node) { var data = StorageCacheUtils.getBlock(node); if (data == null) { return -1; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java index 53ab71a358..58840063c7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoUtils.java @@ -71,8 +71,8 @@ static boolean hasInventory(@Nullable Block block) { return SlimefunTag.CARGO_SUPPORTED_STORAGE_BLOCKS.isTagged(type); } - @Nonnull - static int[] getInputSlotRange(@Nonnull Inventory inv, @Nullable ItemStack item) { + + static int[] getInputSlotRange(Inventory inv, @Nullable ItemStack item) { if (inv instanceof FurnaceInventory) { if (item != null && item.getType().isFuel()) { if (isSmeltable(item, true)) { @@ -101,8 +101,8 @@ static int[] getInputSlotRange(@Nonnull Inventory inv, @Nullable ItemStack item) } } - @Nonnull - static int[] getOutputSlotRange(@Nonnull Inventory inv) { + + static int[] getOutputSlotRange(Inventory inv) { if (inv instanceof FurnaceInventory) { // Slot 2-3 return new int[] {2, 3}; @@ -345,7 +345,7 @@ && matchesFilter(network, node, wrapperInSlot)) { } @Nullable private static ItemStack insertIntoVanillaInventory( - @Nonnull ItemStack stack, @Nonnull ItemStackWrapper wrapper, boolean smartFill, @Nonnull Inventory inv) { + ItemStack stack, ItemStackWrapper wrapper, boolean smartFill, Inventory inv) { /* * If the Inventory does not accept this Item Type, bounce the item back. * Example: Shulker boxes within shulker boxes (fixes #2662) @@ -397,11 +397,11 @@ && matchesFilter(network, node, wrapperInSlot)) { return stack; } - @Nullable static DirtyChestMenu getChestMenu(@Nonnull Block block) { + @Nullable static DirtyChestMenu getChestMenu(Block block) { return StorageCacheUtils.getMenu(block.getLocation()); } - static boolean matchesFilter(@Nonnull AbstractItemNetwork network, @Nonnull Block node, @Nullable ItemStack item) { + static boolean matchesFilter(AbstractItemNetwork network, Block node, @Nullable ItemStack item) { if (item == null || item.getType() == Material.AIR) { return false; } @@ -445,7 +445,7 @@ private static boolean isPotion(@Nullable ItemStack item) { * * @return The slots where the {@link ItemFilter} section for a cargo node sits */ - @Nonnull + public static int[] getFilteringSlots() { return FILTER_SLOTS; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemFilter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemFilter.java index a04e87cbb1..dc630a0e49 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemFilter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemFilter.java @@ -67,7 +67,7 @@ class ItemFilter implements Predicate { * @param b * The {@link Block} */ - public ItemFilter(@Nonnull Block b) { + public ItemFilter(Block b) { update(b); } @@ -78,7 +78,7 @@ public ItemFilter(@Nonnull Block b) { * @param b * The {@link Block} */ - public void update(@Nonnull Block b) { + public void update(Block b) { if (!isDirty() || isLoading) { return; } @@ -186,7 +186,7 @@ public void markDirty() { } @Override - public boolean test(@Nonnull ItemStack item) { + public boolean test(ItemStack item) { if (isDirty()) { return false; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemStackAndInteger.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemStackAndInteger.java index 4842e25be9..fa1255059b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemStackAndInteger.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemStackAndInteger.java @@ -11,7 +11,7 @@ class ItemStackAndInteger { private ItemStackWrapper wrapper; private int number; - ItemStackAndInteger(@Nonnull ItemStack item, int amount) { + ItemStackAndInteger(ItemStack item, int amount) { Validate.notNull(item, "Item cannot be null!"); this.number = amount; this.item = item; @@ -21,12 +21,12 @@ public int getInt() { return number; } - public @Nonnull ItemStack getItem() { + public ItemStack getItem() { initializeItem(); return item; } - public @Nonnull ItemStackWrapper getItemStackWrapper() { + public ItemStackWrapper getItemStackWrapper() { if (wrapper == null) { wrapper = ItemStackWrapper.wrap(item); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java index c3b335b317..8afe6af9d5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java @@ -48,7 +48,7 @@ public class EnergyNet extends Network implements HologramOwner { private final Map capacitors = new HashMap<>(); private final Map consumers = new HashMap<>(); - protected EnergyNet(@Nonnull Location l) { + protected EnergyNet(Location l) { super(Slimefun.getNetworkManager(), l); } @@ -62,7 +62,7 @@ public int getRange() { * * @return An immutable {@link Map} of generators */ - public @Nonnull Map getGenerators() { + public Map getGenerators() { return Collections.unmodifiableMap(generators); } @@ -71,7 +71,7 @@ public int getRange() { * * @return An immutable {@link Map} of capacitors */ - public @Nonnull Map getCapacitors() { + public Map getCapacitors() { return Collections.unmodifiableMap(capacitors); } @@ -80,17 +80,17 @@ public int getRange() { * * @return An immutable {@link Map} of consumers */ - public @Nonnull Map getConsumers() { + public Map getConsumers() { return Collections.unmodifiableMap(consumers); } @Override - public @Nonnull String getId() { + public String getId() { return "ENERGY_NETWORK"; } @Override - public NetworkComponent classifyLocation(@Nonnull Location l) { + public NetworkComponent classifyLocation(Location l) { if (regulator.equals(l)) { return NetworkComponent.REGULATOR; } @@ -139,7 +139,7 @@ public void onClassificationChange(Location l, NetworkComponent from, NetworkCom } } - public void tick(@Nonnull Block b, SlimefunBlockData blockData) { + public void tick(Block b, SlimefunBlockData blockData) { AtomicLong timestamp = new AtomicLong(Slimefun.getProfiler().newEntry()); if (!regulator.equals(b.getLocation())) { @@ -260,7 +260,7 @@ private void storeRemainingEnergy(int remainingEnergy) { } } - private int tickAllGenerators(@Nonnull LongConsumer timings) { + private int tickAllGenerators(LongConsumer timings) { Set explodedBlocks = new HashSet<>(); int supply = 0; @@ -334,7 +334,7 @@ private int tickAllCapacitors() { return supply; } - private void updateHologram(@Nonnull SlimefunBlockData data, double supply, double demand) { + private void updateHologram(SlimefunBlockData data, double supply, double demand) { if (demand > supply) { String netLoss = NumberUtils.getCompactDouble(demand - supply); updateHologram( @@ -346,7 +346,7 @@ private void updateHologram(@Nonnull SlimefunBlockData data, double supply, doub } } - @Nullable private static EnergyNetComponent getComponent(@Nonnull Location l) { + @Nullable private static EnergyNetComponent getComponent(Location l) { SlimefunItem item = StorageCacheUtils.getSfItem(l); if (item instanceof EnergyNetComponent component) { @@ -365,7 +365,7 @@ private void updateHologram(@Nonnull SlimefunBlockData data, double supply, doub * * @return The {@link EnergyNet} at that {@link Location}, or {@code null} */ - @Nullable public static EnergyNet getNetworkFromLocation(@Nonnull Location l) { + @Nullable public static EnergyNet getNetworkFromLocation(Location l) { return Slimefun.getNetworkManager() .getNetworkFromLocation(l, EnergyNet.class) .orElse(null); @@ -380,8 +380,8 @@ private void updateHologram(@Nonnull SlimefunBlockData data, double supply, doub * * @return The {@link EnergyNet} at that {@link Location}, or a new one */ - @Nonnull - public static EnergyNet getNetworkFromLocationOrCreate(@Nonnull Location l) { + + public static EnergyNet getNetworkFromLocationOrCreate(Location l) { Optional energyNetwork = Slimefun.getNetworkManager().getNetworkFromLocation(l, EnergyNet.class); if (energyNetwork.isPresent()) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/AutoSavingService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/AutoSavingService.java index cd80124363..11a5d45f58 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/AutoSavingService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/AutoSavingService.java @@ -27,7 +27,7 @@ public class AutoSavingService { * @param interval * The interval in which to run this task */ - public void start(@Nonnull Slimefun plugin, int interval) { + public void start(Slimefun plugin, int interval) { this.interval = interval; plugin.getServer().getScheduler().runTaskTimer(plugin, this::saveAllPlayers, 2000L, interval * 60L * 20L); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java index 42b34889aa..08444d256a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BackupService.java @@ -85,7 +85,7 @@ public void run() { } } - private void createBackup(@Nonnull ZipOutputStream output) throws IOException { + private void createBackup(ZipOutputStream output) throws IOException { Validate.notNull(output, "The Output Stream cannot be null!"); if (Slimefun.getDatabaseManager().getProfileStorageType() == StorageType.SQLITE) { @@ -112,7 +112,7 @@ private void addFile(ZipOutputStream output, File file, String path) throws IOEx output.closeEntry(); } - private void addDirectory(@Nonnull ZipOutputStream output, @Nonnull File directory, @Nonnull String zipPath) + private void addDirectory(ZipOutputStream output, File directory, String zipPath) throws IOException { for (File file : directory.listFiles()) { addFile(output, file, zipPath); @@ -128,7 +128,7 @@ private void addDirectory(@Nonnull ZipOutputStream output, @Nonnull File directo * @throws IOException * An {@link IOException} is thrown if a {@link File} could not be deleted */ - private void purgeBackups(@Nonnull List backups) throws IOException { + private void purgeBackups(List backups) throws IOException { var matchedBackup = backups.stream() .filter(f -> f.getName().matches("^\\d{4}-\\d{2}-\\d{2}-\\d{2}-\\d{2}$")) .sorted((a, b) -> { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java index f2bde71bb3..dea8083411 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/BlockDataService.java @@ -43,7 +43,7 @@ public class BlockDataService implements Keyed { * @param key * The key under which to store data */ - public BlockDataService(@Nonnull Plugin plugin, @Nonnull String key) { + public BlockDataService(Plugin plugin, String key) { namespacedKey = new NamespacedKey(plugin, key); } @@ -60,7 +60,7 @@ public NamespacedKey getKey() { * @param value * The value to store */ - public void setBlockData(@Nonnull Block b, @Nonnull String value) { + public void setBlockData(Block b, String value) { Validate.notNull(b, "The block cannot be null!"); Validate.notNull(value, "The value cannot be null!"); @@ -101,7 +101,7 @@ public void setBlockData(@Nonnull Block b, @Nonnull String value) { * * @return The stored value */ - public Optional getBlockData(@Nonnull Block b) { + public Optional getBlockData(Block b) { Validate.notNull(b, "The block cannot be null!"); BlockState state = PaperLib.getBlockState(b, false).getState(); @@ -114,7 +114,7 @@ public Optional getBlockData(@Nonnull Block b) { } } - @Nullable private PersistentDataContainer getPersistentDataContainer(@Nonnull BlockState state) { + @Nullable private PersistentDataContainer getPersistentDataContainer(BlockState state) { if (state instanceof TileState tileState) { return tileState.getPersistentDataContainer(); } else { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomItemDataService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomItemDataService.java index ad16ded8f3..e1e9614671 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomItemDataService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomItemDataService.java @@ -41,7 +41,7 @@ public class CustomItemDataService implements Keyed { * @param key * The key under which to store data */ - public CustomItemDataService(@Nonnull Plugin plugin, @Nonnull String key) { + public CustomItemDataService(Plugin plugin, String key) { // Null-Validation is performed in the NamespacedKey constructor namespacedKey = new NamespacedKey(plugin, key); } @@ -60,7 +60,7 @@ public NamespacedKey getKey() { * @param id * The id to store on the {@link ItemStack} */ - public void setItemData(@Nonnull ItemStack item, @Nonnull String id) { + public void setItemData(ItemStack item, String id) { Validate.notNull(item, "The Item cannot be null!"); Validate.notNull(id, "Cannot store null on an Item!"); @@ -78,7 +78,7 @@ public void setItemData(@Nonnull ItemStack item, @Nonnull String id) { * @param id * The id to store on the {@link ItemMeta} */ - public void setItemData(@Nonnull ItemMeta meta, @Nonnull String id) { + public void setItemData(ItemMeta meta, String id) { Validate.notNull(meta, "The ItemMeta cannot be null!"); Validate.notNull(id, "Cannot store null on an ItemMeta!"); @@ -96,7 +96,7 @@ public void setItemData(@Nonnull ItemMeta meta, @Nonnull String id) { * * @return An {@link Optional} describing the result */ - public @Nonnull Optional getItemData(@Nullable ItemStack item) { + public Optional getItemData(@Nullable ItemStack item) { if (item == null || item.getType() == Material.AIR || !item.hasItemMeta()) { return Optional.empty(); } @@ -113,7 +113,7 @@ public void setItemData(@Nonnull ItemMeta meta, @Nonnull String id) { * * @return An {@link Optional} describing the result */ - public @Nonnull Optional getItemData(@Nonnull ItemMeta meta) { + public Optional getItemData(ItemMeta meta) { Validate.notNull(meta, "Cannot read data from null!"); PersistentDataContainer container = meta.getPersistentDataContainer(); @@ -132,7 +132,7 @@ public void setItemData(@Nonnull ItemMeta meta, @Nonnull String id) { * * @return Whether both metas have data on them and its the same. */ - public boolean hasEqualItemData(@Nonnull ItemMeta meta1, @Nonnull ItemMeta meta2) { + public boolean hasEqualItemData(ItemMeta meta1, ItemMeta meta2) { Validate.notNull(meta1, "Cannot read data from null (first arg)"); Validate.notNull(meta2, "Cannot read data from null (second arg)"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomTextureService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomTextureService.java index 0cbc47ae4b..a7b1f84397 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomTextureService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/CustomTextureService.java @@ -52,7 +52,7 @@ public class CustomTextureService { * @param config * The {@link Config} to read custom model data from */ - public CustomTextureService(@Nonnull Config config) { + public CustomTextureService(Config config) { this.config = config; config.getConfiguration() .options() @@ -74,7 +74,7 @@ public CustomTextureService(@Nonnull Config config) { * @param save * Whether to save this file */ - public void register(@Nonnull Collection items, boolean save) { + public void register(Collection items, boolean save) { Validate.notEmpty(items, "items must neither be null or empty."); loadDefaultValues(); @@ -132,7 +132,7 @@ public boolean isActive() { * * @return The configured custom model data */ - public int getModelData(@Nonnull String id) { + public int getModelData(String id) { Validate.notNull(id, "Cannot get the ModelData for 'null'"); return config.getInt(id); @@ -147,7 +147,7 @@ public int getModelData(@Nonnull String id) { * @param id * The id for which to get the configured model data */ - public void setTexture(@Nonnull ItemStack item, @Nonnull String id) { + public void setTexture(ItemStack item, String id) { Validate.notNull(item, "The Item cannot be null!"); Validate.notNull(id, "Cannot store null on an Item!"); @@ -165,7 +165,7 @@ public void setTexture(@Nonnull ItemStack item, @Nonnull String id) { * @param id * The id for which to get the configured model data */ - public void setTexture(@Nonnull ItemMeta im, @Nonnull String id) { + public void setTexture(ItemMeta im, String id) { Validate.notNull(im, "The ItemMeta cannot be null!"); Validate.notNull(id, "Cannot store null on an ItemMeta!"); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/LocalizationService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/LocalizationService.java index 14733c9f94..e8e16f785d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/LocalizationService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/LocalizationService.java @@ -52,7 +52,7 @@ public class LocalizationService extends SlimefunLocalization { private final Language defaultLanguage; public LocalizationService( - @Nonnull Slimefun plugin, @Nullable String prefix, @Nullable String serverDefaultLanguage) { + Slimefun plugin, @Nullable String prefix, @Nullable String serverDefaultLanguage) { super(plugin); this.plugin = plugin; @@ -105,25 +105,25 @@ public String getChatPrefix() { } @Override - @Nonnull + public NamespacedKey getKey() { return languageKey; } @Override - @Nullable public Language getLanguage(@Nonnull String id) { + @Nullable public Language getLanguage(String id) { Validate.notNull(id, "The language id cannot be null"); return languages.get(id); } @Override - @Nonnull + public Collection getLanguages() { return languages.values(); } @Override - public boolean hasLanguage(@Nonnull String id) { + public boolean hasLanguage(String id) { Validate.notNull(id, "The language id cannot be null"); // Checks if our jar files contains a messages.yml file for that language @@ -139,7 +139,7 @@ public boolean hasLanguage(@Nonnull String id) { * * @return Whether or not this {@link Language} is loaded */ - public boolean isLanguageLoaded(@Nonnull String id) { + public boolean isLanguageLoaded(String id) { Validate.notNull(id, "The language cannot be null!"); return languages.containsKey(id); } @@ -150,7 +150,7 @@ public Language getDefaultLanguage() { } @Override - public Language getLanguage(@Nonnull Player p) { + public Language getLanguage(Player p) { Validate.notNull(p, "Player cannot be null!"); PersistentDataContainer container = p.getPersistentDataContainer(); @@ -167,7 +167,7 @@ public Language getLanguage(@Nonnull Player p) { return getDefaultLanguage(); } - private void setLanguage(@Nonnull String language, boolean reset) { + private void setLanguage(String language, boolean reset) { // Clearing out the old Language (if necessary) if (reset) { getConfig().clear(); @@ -204,7 +204,7 @@ private void copyToDefaultLanguage(String language, LanguageFile file) { } @Override - protected void addLanguage(@Nonnull String id, @Nonnull String texture) { + protected void addLanguage(String id, String texture) { Validate.notNull(id, "The language id cannot be null!"); Validate.notNull(texture, "The language texture cannot be null"); @@ -232,7 +232,7 @@ protected void addLanguage(@Nonnull String id, @Nonnull String texture) { * * @return A percentage {@code (0.0 - 100.0)} for the progress of translation of that {@link Language} */ - public double calculateProgress(@Nonnull Language lang) { + public double calculateProgress(Language lang) { Validate.notNull(lang, "Cannot get the language progress of null"); Set defaultKeys = getTotalKeys(languages.get("en")); @@ -253,8 +253,8 @@ public double calculateProgress(@Nonnull Language lang) { return Math.min(NumberUtils.reparseDouble(100.0 * (matches / (double) defaultKeys.size())), 100.0); } - private @Nonnull FileConfiguration getConfigurationFromStream( - @Nonnull String file, @Nullable FileConfiguration defaults) { + private FileConfiguration getConfigurationFromStream( + String file, @Nullable FileConfiguration defaults) { InputStream inputStream = plugin.getClass().getResourceAsStream(file); if (inputStream == null) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MinecraftRecipeService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MinecraftRecipeService.java index e7fe8bef7e..4d1ec2b1cb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MinecraftRecipeService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MinecraftRecipeService.java @@ -59,7 +59,7 @@ public class MinecraftRecipeService { * @param plugin * The {@link Plugin} that requests this Service */ - public MinecraftRecipeService(@Nonnull Plugin plugin) { + public MinecraftRecipeService(Plugin plugin) { this.plugin = plugin; } @@ -82,7 +82,7 @@ public void refresh() { * @param subscription * A callback to run when the {@link RecipeSnapshot} has been created. */ - public void subscribe(@Nonnull Consumer subscription) { + public void subscribe(Consumer subscription) { Validate.notNull(subscription, "Callback must not be null!"); subscriptions.add(subscription); } @@ -96,7 +96,7 @@ public void subscribe(@Nonnull Consumer subscription) { * * @return An {@link Optional} describing the furnace output of the given {@link ItemStack} */ - public @Nonnull Optional getFurnaceOutput(@Nullable ItemStack input) { + public Optional getFurnaceOutput(@Nullable ItemStack input) { if (snapshot == null || input == null) { return Optional.empty(); } @@ -128,7 +128,7 @@ public boolean isSmeltable(@Nullable ItemStack input) { * * @return An Array of {@link RecipeChoice} representing the shape of this {@link Recipe} */ - public @Nonnull RecipeChoice[] getRecipeShape(@Nonnull Recipe recipe) { + public RecipeChoice[] getRecipeShape(Recipe recipe) { Validate.notNull(recipe, "Recipe must not be null!"); if (recipe instanceof ShapedRecipe shapedRecipe) { @@ -162,7 +162,7 @@ public boolean isSmeltable(@Nullable ItemStack input) { * * @return An array of {@link Recipe Recipes} to craft the given {@link ItemStack} */ - public @Nonnull Recipe[] getRecipesFor(@Nullable ItemStack item) { + public Recipe[] getRecipesFor(@Nullable ItemStack item) { if (snapshot == null || item == null) { return new Recipe[0]; } else { @@ -181,7 +181,7 @@ public boolean isSmeltable(@Nullable ItemStack input) { * * @return The corresponding {@link Recipe} or null */ - public @Nullable Recipe getRecipe(@Nonnull NamespacedKey key) { + public @Nullable Recipe getRecipe(NamespacedKey key) { Validate.notNull(key, "The NamespacedKey should not be null"); if (snapshot != null) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PerWorldSettingsService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PerWorldSettingsService.java index f8478f1fde..648b2a7ed0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PerWorldSettingsService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PerWorldSettingsService.java @@ -35,7 +35,7 @@ public class PerWorldSettingsService { private final Map> disabledAddons = new HashMap<>(); private final Set disabledWorlds = new HashSet<>(); - public PerWorldSettingsService(@Nonnull Slimefun plugin) { + public PerWorldSettingsService(Slimefun plugin) { this.plugin = plugin; } @@ -45,7 +45,7 @@ public PerWorldSettingsService(@Nonnull Slimefun plugin) { * @param worlds * An {@link Iterable} of {@link World Worlds} to load */ - public void load(@Nonnull Iterable worlds) { + public void load(Iterable worlds) { for (World world : worlds) { load(world); } @@ -57,7 +57,7 @@ public void load(@Nonnull Iterable worlds) { * @param world * The {@link World} to load */ - public void load(@Nonnull World world) { + public void load(World world) { Validate.notNull(world, "Cannot load a world that is null"); disabledItems.putIfAbsent(world.getUID(), loadWorldFromConfig(world)); } @@ -72,7 +72,7 @@ public void load(@Nonnull World world) { * * @return Whether the given {@link SlimefunItem} is enabled in that {@link World} */ - public boolean isEnabled(@Nonnull World world, @Nonnull SlimefunItem item) { + public boolean isEnabled(World world, SlimefunItem item) { Validate.notNull(world, "The world cannot be null"); Validate.notNull(item, "The SlimefunItem cannot be null"); @@ -95,7 +95,7 @@ public boolean isEnabled(@Nonnull World world, @Nonnull SlimefunItem item) { * @param enabled * Whether the given {@link SlimefunItem} should be enabled in that world */ - public void setEnabled(@Nonnull World world, @Nonnull SlimefunItem item, boolean enabled) { + public void setEnabled(World world, SlimefunItem item, boolean enabled) { Validate.notNull(world, "The world cannot be null"); Validate.notNull(item, "The SlimefunItem cannot be null"); @@ -116,7 +116,7 @@ public void setEnabled(@Nonnull World world, @Nonnull SlimefunItem item, boolean * @param enabled * Whether this {@link World} should be enabled or not */ - public void setEnabled(@Nonnull World world, boolean enabled) { + public void setEnabled(World world, boolean enabled) { Validate.notNull(world, "null is not a valid World"); load(world); @@ -135,7 +135,7 @@ public void setEnabled(@Nonnull World world, boolean enabled) { * * @return Whether this {@link World} is enabled */ - public boolean isWorldEnabled(@Nonnull World world) { + public boolean isWorldEnabled(World world) { Validate.notNull(world, "null is not a valid World"); load(world); @@ -152,7 +152,7 @@ public boolean isWorldEnabled(@Nonnull World world) { * * @return Whether this addon is enabled in that {@link World} */ - public boolean isAddonEnabled(@Nonnull World world, @Nonnull SlimefunAddon addon) { + public boolean isAddonEnabled(World world, SlimefunAddon addon) { Validate.notNull(world, "World cannot be null"); Validate.notNull(addon, "Addon cannot be null"); return isWorldEnabled(world) @@ -167,7 +167,7 @@ public boolean isAddonEnabled(@Nonnull World world, @Nonnull SlimefunAddon addon * @param world * The {@link World} to save */ - public void save(@Nonnull World world) { + public void save(World world) { Validate.notNull(world, "Cannot save a World that does not exist"); Set items = disabledItems.computeIfAbsent(world.getUID(), id -> loadWorldFromConfig(world)); @@ -183,8 +183,8 @@ public void save(@Nonnull World world) { config.save(); } - @Nonnull - private Set loadWorldFromConfig(@Nonnull World world) { + + private Set loadWorldFromConfig(World world) { Validate.notNull(world, "Cannot load a World that does not exist"); String name = world.getName(); @@ -223,7 +223,7 @@ private Set loadWorldFromConfig(@Nonnull World world) { } private void loadItemsFromWorldConfig( - @Nonnull String worldName, @Nonnull Config config, @Nonnull Set items) { + String worldName, Config config, Set items) { for (SlimefunItem item : Slimefun.getRegistry().getEnabledSlimefunItems()) { if (item != null) { String addon = item.getAddon().getName().toLowerCase(Locale.ROOT); @@ -253,8 +253,8 @@ private void loadItemsFromWorldConfig( * * @return The corresponding {@link Config} */ - @Nonnull - private Config getConfig(@Nonnull World world) { + + private Config getConfig(World world) { Validate.notNull(world, "World cannot be null"); return new Config(plugin, "world-settings/" + world.getName() + ".yml"); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PermissionsService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PermissionsService.java index 7d61e86c32..9140c1618e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PermissionsService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/PermissionsService.java @@ -29,7 +29,7 @@ public class PermissionsService { private final Map permissions = new HashMap<>(); private final Config config; - public PermissionsService(@Nonnull Slimefun plugin) { + public PermissionsService(Slimefun plugin) { config = new Config(plugin, "permissions.yml"); // @formatter:off @@ -54,7 +54,7 @@ public PermissionsService(@Nonnull Slimefun plugin) { * @param items An {@link Iterable} of {@link SlimefunItem}s to register * @param save Whether to save the default values to our permissions file */ - public void update(@Nonnull Iterable items, boolean save) { + public void update(Iterable items, boolean save) { for (SlimefunItem item : items) { update(item, false); } @@ -64,7 +64,7 @@ public void update(@Nonnull Iterable items, boolean save) { } } - public void update(@Nonnull SlimefunItem item, boolean save) { + public void update(SlimefunItem item, boolean save) { Validate.notNull(item, "The Item should not be null!"); String path = item.getId() + ".permission"; @@ -111,8 +111,8 @@ public boolean hasPermission(Permissible p, SlimefunItem item) { * * @return An {@link Optional} holding the {@link Permission} as a {@link String} or an empty {@link Optional} */ - @Nonnull - public Optional getPermission(@Nonnull SlimefunItem item) { + + public Optional getPermission(SlimefunItem item) { Validate.notNull(item, "Cannot get permissions for null"); String permission = permissions.get(item.getId()); @@ -131,7 +131,7 @@ public Optional getPermission(@Nonnull SlimefunItem item) { * @param permission * The {@link Permission} to set */ - public void setPermission(@Nonnull SlimefunItem item, @Nullable String permission) { + public void setPermission(SlimefunItem item, @Nullable String permission) { Validate.notNull(item, "You cannot set the permission for null"); permissions.put(item.getId(), permission != null ? permission : "none"); } @@ -156,7 +156,7 @@ public void save() { * * @return The configured lore to display */ - public @Nonnull List getLore(@Nonnull SlimefunItem item) { + public List getLore(SlimefunItem item) { return config.getStringList(item.getId() + ".lore"); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/holograms/Hologram.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/holograms/Hologram.java index c26c0d1c4c..85b62112f1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/holograms/Hologram.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/holograms/Hologram.java @@ -41,7 +41,7 @@ class Hologram { * * @param uniqueId The {@link UUID} of the corresponding {@link ArmorStand} */ - Hologram(@Nonnull UUID uniqueId) { + Hologram(UUID uniqueId) { this.uniqueId = uniqueId; this.lastAccess = System.currentTimeMillis(); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/holograms/HologramsService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/holograms/HologramsService.java index c9b4097dda..b35059100f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/holograms/HologramsService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/holograms/HologramsService.java @@ -71,7 +71,7 @@ public class HologramsService { * @param plugin * Our {@link Plugin} instance */ - public HologramsService(@Nonnull Plugin plugin) { + public HologramsService(Plugin plugin) { this.plugin = plugin; // Null-Validation is performed in the NamespacedKey constructor @@ -91,7 +91,7 @@ public void start() { * * @return The default offset */ - @Nonnull + public Vector getDefaultOffset() { return defaultOffset; } @@ -123,7 +123,7 @@ private void purge() { * * @return The existing (or newly created) hologram */ - @Nullable private Hologram getHologram(@Nonnull Location loc, boolean createIfNoneExists) { + @Nullable private Hologram getHologram(Location loc, boolean createIfNoneExists) { Validate.notNull(loc, "Location cannot be null"); BlockPosition position = new BlockPosition(loc); @@ -186,7 +186,7 @@ private boolean hasHologramData(PersistentDataContainer container, BlockPosition * * @return Whether this could be a hologram */ - private boolean isHologram(@Nonnull Entity n) { + private boolean isHologram(Entity n) { if (n instanceof ArmorStand armorStand) { // The absolute minimum requirements to count as a hologram return !armorStand.isVisible() && armorStand.isSilent() && !armorStand.hasGravity(); @@ -209,7 +209,7 @@ private boolean isHologram(@Nonnull Entity n) { * @return The {@link Hologram} */ @Nullable private Hologram getAsHologram( - @Nonnull BlockPosition position, @Nonnull Entity entity, @Nonnull PersistentDataContainer container) { + BlockPosition position, Entity entity, PersistentDataContainer container) { if (entity instanceof ArmorStand armorStand) { armorStand.setVisible(false); armorStand.setInvulnerable(true); @@ -244,7 +244,7 @@ private boolean isHologram(@Nonnull Entity n) { * @param consumer * The callback to run */ - private void updateHologram(@Nonnull Location loc, @Nonnull Consumer consumer) { + private void updateHologram(Location loc, Consumer consumer) { Validate.notNull(loc, "Location must not be null"); Validate.notNull(consumer, "Callbacks must not be null"); @@ -279,7 +279,7 @@ private void updateHologram(@Nonnull Location loc, @Nonnull Consumer c * @return Whether the {@link Hologram} could be removed, false if the {@link Hologram} does not * exist or was already removed */ - public boolean removeHologram(@Nonnull Location loc) { + public boolean removeHologram(Location loc) { Validate.notNull(loc, "Location cannot be null"); if (Bukkit.isPrimaryThread()) { @@ -311,7 +311,7 @@ public boolean removeHologram(@Nonnull Location loc) { * @param label * The label to set, can be null */ - public void setHologramLabel(@Nonnull Location loc, @Nullable String label) { + public void setHologramLabel(Location loc, @Nullable String label) { Validate.notNull(loc, "Location must not be null"); updateHologram(loc, hologram -> hologram.setLabel(label)); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Language.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Language.java index 75f3c458c1..58ce2414a7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Language.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/Language.java @@ -41,7 +41,7 @@ public final class Language { * @param hash * The hash of the skull texture to use */ - public Language(@Nonnull String id, @Nonnull String hash) { + public Language(String id, String hash) { Validate.notNull(id, "A Language must have an id that is not null!"); Validate.notNull(hash, "A Language must have a texture that is not null!"); @@ -56,7 +56,7 @@ public Language(@Nonnull String id, @Nonnull String hash) { * * @return The identifier of this {@link Language} */ - public @Nonnull String getId() { + public String getId() { return id; } @@ -79,11 +79,11 @@ public double getTranslationProgress() { } } - @Nullable FileConfiguration getFile(@Nonnull LanguageFile file) { + @Nullable FileConfiguration getFile(LanguageFile file) { return files.get(file); } - public void setFile(@Nonnull LanguageFile file, @Nonnull FileConfiguration config) { + public void setFile(LanguageFile file, FileConfiguration config) { Validate.notNull(file, "The provided file should not be null."); Validate.notNull(config, "The provided config should not be null."); @@ -96,7 +96,7 @@ public void setFile(@Nonnull LanguageFile file, @Nonnull FileConfiguration confi * * @return The {@link ItemStack} used to display this {@link Language} */ - public @Nonnull ItemStack getItem() { + public ItemStack getItem() { return item; } @@ -108,7 +108,7 @@ public void setFile(@Nonnull LanguageFile file, @Nonnull FileConfiguration confi * The {@link Player} to localize the name for * @return The localized name of this {@link Language} */ - public @Nonnull String getName(@Nonnull Player p) { + public String getName(Player p) { return Slimefun.getLocalization().getMessage(p, "languages." + id); } @@ -127,7 +127,7 @@ public String toString() { return "Language {id= " + id + ", default=" + isDefault() + " }"; } - @Nonnull + FileConfiguration[] getFiles() { // @formatter:off return Arrays.stream(LanguageFile.valuesCached).map(this::getFile).toArray(FileConfiguration[]::new); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/LanguageFile.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/LanguageFile.java index 52817d8b64..404b23a29c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/LanguageFile.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/LanguageFile.java @@ -23,17 +23,17 @@ public enum LanguageFile { private final String fileName; - LanguageFile(@Nonnull String fileName) { + LanguageFile(String fileName) { this.fileName = fileName; } - @Nonnull - public String getFilePath(@Nonnull Language language) { + + public String getFilePath(Language language) { return getFilePath(language.getId()); } - @Nonnull - public String getFilePath(@Nonnull String languageId) { + + public String getFilePath(String languageId) { Validate.notNull(languageId, "Language id must not be null!"); return "/languages/" + languageId + '/' + fileName; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/LanguagePreset.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/LanguagePreset.java index 297746f77b..c91a9b1a49 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/LanguagePreset.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/LanguagePreset.java @@ -95,7 +95,7 @@ public enum LanguagePreset { * * @return The language code */ - public @Nonnull String getLanguageCode() { + public String getLanguageCode() { return id; } @@ -117,7 +117,7 @@ boolean isReadyForRelease() { * * @return The texture hash of this language */ - public @Nonnull String getTexture() { + public String getTexture() { return textureHash; } @@ -127,7 +127,7 @@ boolean isReadyForRelease() { * * @return The direction of text for this language */ - public @Nonnull TextDirection getTextDirection() { + public TextDirection getTextDirection() { return textDirection; } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java index d3b90a67fa..f003f45e67 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java @@ -44,11 +44,11 @@ public abstract class SlimefunLocalization implements Keyed { private final Config defaultConfig; - protected SlimefunLocalization(@Nonnull Slimefun plugin) { + protected SlimefunLocalization(Slimefun plugin) { this.defaultConfig = new Config(plugin, "messages.yml"); } - protected @Nonnull Config getConfig() { + protected Config getConfig() { return defaultConfig; } @@ -66,7 +66,7 @@ protected void save() { * * @return The chat prefix */ - public @Nonnull String getChatPrefix() { + public String getChatPrefix() { return getMessage("prefix"); } @@ -79,7 +79,7 @@ protected void save() { * * @return A {@link Language} with the given id or null */ - public abstract @Nullable Language getLanguage(@Nonnull String id); + public abstract @Nullable Language getLanguage(String id); /** * This method returns the currently selected {@link Language} of a {@link Player}. @@ -89,7 +89,7 @@ protected void save() { * * @return The {@link Language} that was selected by the given {@link Player} */ - public abstract @Nullable Language getLanguage(@Nonnull Player p); + public abstract @Nullable Language getLanguage(Player p); /** * This method returns the default {@link Language} of this {@link Server} @@ -107,7 +107,7 @@ protected void save() { * * @return Whether the project contains a {@link Language} with that id */ - protected abstract boolean hasLanguage(@Nonnull String id); + protected abstract boolean hasLanguage(String id); /** * This method returns a full {@link Collection} of every {@link Language} that was @@ -115,7 +115,7 @@ protected void save() { * * @return A {@link Collection} that contains every installed {@link Language} */ - public abstract @Nonnull Collection getLanguages(); + public abstract Collection getLanguages(); /** * This method adds a new {@link Language} with the given id and texture. @@ -125,7 +125,7 @@ protected void save() { * @param texture * The texture of how this {@link Language} should be displayed */ - protected abstract void addLanguage(@Nonnull String id, @Nonnull String texture); + protected abstract void addLanguage(String id, String texture); /** * This will load every {@link LanguagePreset} into memory. @@ -140,7 +140,7 @@ protected void loadEmbeddedLanguages() { } } - private @Nonnull FileConfiguration getDefaultFile(@Nonnull LanguageFile file) { + private FileConfiguration getDefaultFile(LanguageFile file) { Language language = getLanguage(LanguagePreset.ENGLISH.getLanguageCode()); if (language == null) { @@ -186,7 +186,7 @@ protected void loadEmbeddedLanguages() { } @ParametersAreNonnullByDefault - private @Nonnull String getString(@Nullable Language language, LanguageFile file, String path) { + private String getString(@Nullable Language language, LanguageFile file, String path) { String string = getStringOrNull(language, file, path); return string != null ? string : "! Missing string \"" + path + '"'; } @@ -221,12 +221,12 @@ protected void loadEmbeddedLanguages() { } @ParametersAreNonnullByDefault - private @Nonnull List getStringList(@Nullable Language language, LanguageFile file, String path) { + private List getStringList(@Nullable Language language, LanguageFile file, String path) { List list = getStringListOrNull(language, file, path); return list != null ? list : Arrays.asList("! Missing string \"" + path + '"'); } - public @Nonnull String getMessage(@Nonnull String key) { + public String getMessage(String key) { Validate.notNull(key, "Message key must not be null!"); Language language = getDefaultLanguage(); @@ -242,7 +242,7 @@ protected void loadEmbeddedLanguages() { return message; } - public @Nonnull String getMessage(@Nonnull Player p, @Nonnull String key) { + public String getMessage(Player p, String key) { Validate.notNull(p, "Player must not be null!"); Validate.notNull(key, "Message key must not be null!"); @@ -256,11 +256,11 @@ protected void loadEmbeddedLanguages() { * The Key of those Messages * @return The List this key is referring to */ - public @Nonnull List getDefaultMessages(@Nonnull String key) { + public List getDefaultMessages(String key) { return defaultConfig.getStringList(key); } - public @Nonnull List getMessages(@Nonnull Player p, @Nonnull String key) { + public List getMessages(Player p, String key) { Validate.notNull(p, "Player should not be null."); Validate.notNull(key, "Message key cannot be null."); @@ -268,7 +268,7 @@ protected void loadEmbeddedLanguages() { } @ParametersAreNonnullByDefault - public @Nonnull List getMessages(Player p, String key, UnaryOperator function) { + public List getMessages(Player p, String key, UnaryOperator function) { Validate.notNull(p, "Player cannot be null."); Validate.notNull(key, "Message key cannot be null."); Validate.notNull(function, "Function cannot be null."); @@ -279,28 +279,28 @@ protected void loadEmbeddedLanguages() { return messages; } - public @Nullable String getResearchName(@Nonnull Player p, @Nonnull NamespacedKey key) { + public @Nullable String getResearchName(Player p, NamespacedKey key) { Validate.notNull(p, "Player must not be null."); Validate.notNull(key, "NamespacedKey cannot be null."); return getStringOrNull(getLanguage(p), LanguageFile.RESEARCHES, key.getNamespace() + '.' + key.getKey()); } - public @Nullable String getItemGroupName(@Nonnull Player p, @Nonnull NamespacedKey key) { + public @Nullable String getItemGroupName(Player p, NamespacedKey key) { Validate.notNull(p, "Player must not be null."); Validate.notNull(key, "NamespacedKey cannot be null!"); return getStringOrNull(getLanguage(p), LanguageFile.CATEGORIES, key.getNamespace() + '.' + key.getKey()); } - public @Nullable String getResourceString(@Nonnull Player p, @Nonnull String key) { + public @Nullable String getResourceString(Player p, String key) { Validate.notNull(p, "Player should not be null!"); Validate.notNull(key, "Message key should not be null!"); return getStringOrNull(getLanguage(p), LanguageFile.RESOURCES, key); } - public @Nonnull ItemStack getRecipeTypeItem(@Nonnull Player p, @Nonnull RecipeType recipeType) { + public ItemStack getRecipeTypeItem(Player p, RecipeType recipeType) { Validate.notNull(p, "Player cannot be null!"); Validate.notNull(recipeType, "Recipe type cannot be null!"); @@ -338,7 +338,7 @@ protected void loadEmbeddedLanguages() { }); } - public void sendMessage(@Nonnull CommandSender recipient, @Nonnull String key, boolean addPrefix) { + public void sendMessage(CommandSender recipient, String key, boolean addPrefix) { Validate.notNull(recipient, "Recipient cannot be null!"); Validate.notNull(key, "Message key cannot be null!"); @@ -351,7 +351,7 @@ public void sendMessage(@Nonnull CommandSender recipient, @Nonnull String key, b } } - public void sendActionbarMessage(@Nonnull Player player, @Nonnull String key, boolean addPrefix) { + public void sendActionbarMessage(Player player, String key, boolean addPrefix) { Validate.notNull(player, "Player cannot be null!"); Validate.notNull(key, "Message key cannot be null!"); @@ -362,7 +362,7 @@ public void sendActionbarMessage(@Nonnull Player player, @Nonnull String key, bo player.spigot().sendMessage(ChatMessageType.ACTION_BAR, components); } - public void sendMessage(@Nonnull CommandSender recipient, @Nonnull String key) { + public void sendMessage(CommandSender recipient, String key) { sendMessage(recipient, key, true); } @@ -382,7 +382,7 @@ public void sendMessage(CommandSender recipient, String key, boolean addPrefix, } } - public void sendMessages(@Nonnull CommandSender recipient, @Nonnull String key) { + public void sendMessages(CommandSender recipient, String key) { String prefix = getChatPrefix(); if (recipient instanceof Player player) { @@ -420,11 +420,11 @@ public void sendMessages(CommandSender recipient, String key, UnaryOperator getTotalKeys(@Nonnull Language lang) { + protected Set getTotalKeys(Language lang) { return getKeys(lang.getFiles()); } - protected @Nonnull Set getKeys(@Nonnull FileConfiguration... files) { + protected Set getKeys(FileConfiguration... files) { Set keys = new HashSet<>(); for (FileConfiguration cfg : files) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceInspector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceInspector.java index 15b279a323..e1856145aa 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceInspector.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceInspector.java @@ -27,7 +27,7 @@ public interface PerformanceInspector { * @param msg * The message to send */ - void sendMessage(@Nonnull String msg); + void sendMessage(String msg); /** * This determines whether the {@link PerformanceInspector} will get the full view @@ -42,6 +42,6 @@ public interface PerformanceInspector { * * @return The order type for the summary of timings. */ - @Nonnull + SummaryOrderType getOrderType(); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceRating.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceRating.java index 608d5e31b9..284f82d08d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceRating.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceRating.java @@ -32,7 +32,7 @@ public enum PerformanceRating implements Predicate { private final ChatColor color; private final float threshold; - PerformanceRating(@Nonnull ChatColor color, float threshold) { + PerformanceRating(ChatColor color, float threshold) { Validate.notNull(color, "Color cannot be null"); this.color = color; this.threshold = threshold; @@ -48,7 +48,7 @@ public boolean test(@Nullable Float value) { return value <= threshold; } - @Nonnull + public ChatColor getColor() { return color; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceSummary.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceSummary.java index 7efe016133..813c794fe7 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceSummary.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/PerformanceSummary.java @@ -35,7 +35,7 @@ class PerformanceSummary { private final Map plugins; private final Map items; - PerformanceSummary(@Nonnull SlimefunProfiler profiler, long totalElapsedTime, int totalTickedBlocks) { + PerformanceSummary(SlimefunProfiler profiler, long totalElapsedTime, int totalTickedBlocks) { this.profiler = profiler; this.rating = profiler.getPerformance(); this.percentage = profiler.getPercentageOfTick(); @@ -48,7 +48,7 @@ class PerformanceSummary { items = profiler.getByItem(); } - public void send(@Nonnull PerformanceInspector sender) { + public void send(PerformanceInspector sender) { sender.sendMessage(""); sender.sendMessage(ChatColor.GREEN + "===== Slimefun Lag Profiler ====="); sender.sendMessage( @@ -116,7 +116,7 @@ private void summarizeTimings( } } - @Nonnull + @ParametersAreNonnullByDefault private TextComponent summarizeAsTextComponent( int count, @@ -156,7 +156,7 @@ private TextComponent summarizeAsTextComponent( return component; } - @Nonnull + @ParametersAreNonnullByDefault private String summarizeAsString( PerformanceInspector inspector, @@ -193,7 +193,7 @@ private String summarizeAsString( return builder.toString(); } - @Nonnull + private String getPerformanceRating() { StringBuilder builder = new StringBuilder(); builder.append(NumberUtils.getColorFromPercentage(100 - Math.min(percentage, 100))); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/ProfiledBlock.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/ProfiledBlock.java index b0b549a920..734c247448 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/ProfiledBlock.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/ProfiledBlock.java @@ -43,7 +43,7 @@ final class ProfiledBlock { * @param item * The {@link SlimefunItem} found at that {@link Location} */ - ProfiledBlock(@Nonnull Location l, @Nonnull SlimefunItem item) { + ProfiledBlock(Location l, SlimefunItem item) { this.world = l.getWorld(); this.position = getLocationAsLong((int) l.getX(), (int) l.getY(), (int) l.getZ()); this.item = item; @@ -56,7 +56,7 @@ final class ProfiledBlock { * @param b * A {@link Block} */ - ProfiledBlock(@Nonnull Block b) { + ProfiledBlock(Block b) { this.world = b.getWorld(); this.position = getLocationAsLong(b.getX(), b.getY(), b.getZ()); this.item = null; @@ -78,7 +78,7 @@ private static long getLocationAsLong(int x, int y, int z) { return ((long) (x & 0x3FFFFFF) << 38) | ((long) (z & 0x3FFFFFF) << 12) | (long) (y & 0xFFF); } - @Nonnull + public World getWorld() { return world; } @@ -128,12 +128,12 @@ public int getChunkZ() { return this.getZ() >> 4; } - @Nonnull + public String getId() { return item.getId(); } - @Nonnull + public SlimefunAddon getAddon() { return item.getAddon(); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/SlimefunProfiler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/SlimefunProfiler.java index 837a8855b9..c0463b9fa4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/SlimefunProfiler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/SlimefunProfiler.java @@ -147,7 +147,7 @@ public void scheduleEntries(int amount) { * * @return The total timings of this entry */ - public long closeEntry(@Nonnull Location l, @Nonnull SlimefunItem item, long timestamp) { + public long closeEntry(Location l, SlimefunItem item, long timestamp) { Validate.notNull(l, "Location must not be null!"); Validate.notNull(item, "You need to specify a SlimefunItem!"); @@ -248,13 +248,13 @@ private void finishReport() { * @param inspector * The {@link PerformanceInspector} who shall receive this summary. */ - public void requestSummary(@Nonnull PerformanceInspector inspector) { + public void requestSummary(PerformanceInspector inspector) { Validate.notNull(inspector, "Cannot request a summary for null"); requests.add(inspector); } - @Nonnull + protected Map getByItem() { Map map = new HashMap<>(); @@ -265,7 +265,7 @@ protected Map getByItem() { return map; } - @Nonnull + protected Map getByPlugin() { Map map = new HashMap<>(); @@ -276,7 +276,7 @@ protected Map getByPlugin() { return map; } - @Nonnull + protected Map getByChunk() { Map map = new HashMap<>(); @@ -292,7 +292,7 @@ protected Map getByChunk() { return map; } - protected int getBlocksInChunk(@Nonnull String chunk) { + protected int getBlocksInChunk(String chunk) { Validate.notNull(chunk, "The chunk cannot be null!"); int blocks = 0; @@ -309,7 +309,7 @@ protected int getBlocksInChunk(@Nonnull String chunk) { return blocks; } - protected int getBlocksOfId(@Nonnull String id) { + protected int getBlocksOfId(String id) { Validate.notNull(id, "The id cannot be null!"); int blocks = 0; @@ -322,7 +322,7 @@ protected int getBlocksOfId(@Nonnull String id) { return blocks; } - protected int getBlocksFromPlugin(@Nonnull String pluginName) { + protected int getBlocksFromPlugin(String pluginName) { Validate.notNull(pluginName, "The Plugin name cannot be null!"); int blocks = 0; @@ -347,7 +347,7 @@ protected float getPercentageOfTick() { * * @return The current performance grade */ - @Nonnull + public PerformanceRating getPerformance() { float percentage = getPercentageOfTick(); @@ -360,7 +360,7 @@ public PerformanceRating getPerformance() { return PerformanceRating.UNKNOWN; } - @Nonnull + public String getTime() { return NumberUtils.getAsMillis(totalElapsedTime); } @@ -378,20 +378,20 @@ public int getTickRate() { * * @return Whether timings of this {@link Block} have been collected */ - public boolean hasTimings(@Nonnull Block b) { + public boolean hasTimings(Block b) { Validate.notNull(b, "Cannot get timings for a null Block"); return timings.containsKey(new ProfiledBlock(b)); } - public String getTime(@Nonnull Block b) { + public String getTime(Block b) { Validate.notNull(b, "Cannot get timings for a null Block"); long time = timings.getOrDefault(new ProfiledBlock(b), 0L); return NumberUtils.getAsMillis(time); } - public String getTime(@Nonnull Chunk chunk) { + public String getTime(Chunk chunk) { Validate.notNull(chunk, "Cannot get timings for a null Chunk"); long time = getByChunk() @@ -399,7 +399,7 @@ public String getTime(@Nonnull Chunk chunk) { return NumberUtils.getAsMillis(time); } - public String getTime(@Nonnull SlimefunItem item) { + public String getTime(SlimefunItem item) { Validate.notNull(item, "Cannot get timings for a null SlimefunItem"); long time = getByItem().getOrDefault(item.getId(), 0L); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/SlimefunThreadFactory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/SlimefunThreadFactory.java index 0cc8ffff80..99a88baf4f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/SlimefunThreadFactory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/SlimefunThreadFactory.java @@ -40,7 +40,7 @@ int getThreadCount() { * This creates a new {@link Thread} for the {@link SlimefunProfiler}. */ @Override - public Thread newThread(@Nonnull Runnable runnable) { + public Thread newThread(Runnable runnable) { return new Thread(runnable, "Slimefun Profiler"); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/inspectors/ConsolePerformanceInspector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/inspectors/ConsolePerformanceInspector.java index c8aceecbe4..6790d9eabf 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/inspectors/ConsolePerformanceInspector.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/inspectors/ConsolePerformanceInspector.java @@ -74,7 +74,7 @@ public boolean isVerbose() { * {@inheritDoc} */ @Override - public @Nonnull SummaryOrderType getOrderType() { + public SummaryOrderType getOrderType() { return orderType; } @@ -82,7 +82,7 @@ public boolean isVerbose() { * {@inheritDoc} */ @Override - public void sendMessage(@Nonnull String msg) { + public void sendMessage(String msg) { console.sendMessage(msg); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/inspectors/PlayerPerformanceInspector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/inspectors/PlayerPerformanceInspector.java index 8b544dcb89..33f6d6cb93 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/inspectors/PlayerPerformanceInspector.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/profiler/inspectors/PlayerPerformanceInspector.java @@ -37,7 +37,7 @@ public class PlayerPerformanceInspector implements PerformanceInspector { * @param orderType * The {@link SummaryOrderType} of the timings */ - public PlayerPerformanceInspector(@Nonnull Player player, @Nonnull SummaryOrderType orderType) { + public PlayerPerformanceInspector(Player player, SummaryOrderType orderType) { Validate.notNull(player, "Player cannot be null"); Validate.notNull(orderType, "SummaryOrderType cannot be null"); @@ -73,7 +73,7 @@ public boolean isVerbose() { * {@inheritDoc} */ @Override - public @Nonnull SummaryOrderType getOrderType() { + public SummaryOrderType getOrderType() { return orderType; } @@ -81,7 +81,7 @@ public boolean isVerbose() { * {@inheritDoc} */ @Override - public void sendMessage(@Nonnull String msg) { + public void sendMessage(String msg) { Player player = getPlayer(); if (player != null) { @@ -89,7 +89,7 @@ public void sendMessage(@Nonnull String msg) { } } - public void sendMessage(@Nonnull TextComponent component) { + public void sendMessage(TextComponent component) { Player player = getPlayer(); if (player != null) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundConfiguration.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundConfiguration.java index c11473c398..e5c415bfea 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundConfiguration.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundConfiguration.java @@ -17,13 +17,13 @@ public class SoundConfiguration { private final float volume; private final float pitch; - protected SoundConfiguration(@Nonnull String sound, float volume, float pitch) { + protected SoundConfiguration(String sound, float volume, float pitch) { this.sound = sound; this.volume = volume; this.pitch = pitch; } - public @Nonnull String getSoundId() { + public String getSoundId() { return sound; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundEffect.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundEffect.java index 2727df3ec8..2e07ae34bf 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundEffect.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundEffect.java @@ -108,7 +108,7 @@ public enum SoundEffect { private final float defaultVolume; private final float defaultPitch; - SoundEffect(@Nonnull String sound, float volume, float pitch) { + SoundEffect(String sound, float volume, float pitch) { Preconditions.checkNotNull(sound, "The Sound id cannot be null!"); Preconditions.checkArgument(volume >= 0, "The volume cannot be a negative number."); Preconditions.checkArgument(pitch >= 0.5, "A pitch below 0.5 has no effect on the sound."); @@ -118,7 +118,7 @@ public enum SoundEffect { this.defaultPitch = pitch; } - SoundEffect(@Nonnull Sound sound, float volume, float pitch) { + SoundEffect(Sound sound, float volume, float pitch) { Preconditions.checkNotNull(sound, "The Sound id cannot be null!"); Preconditions.checkArgument(volume >= 0, "The volume cannot be a negative number."); Preconditions.checkArgument(pitch >= 0.5, "A pitch below 0.5 has no effect on the sound."); @@ -145,7 +145,7 @@ public enum SoundEffect { * * @param player The {@link Player} which to play the {@link Sound} to. */ - public void playFor(@Nonnull Player player) { + public void playFor(Player player) { Preconditions.checkNotNull(player, "Cannot play sounds to a Player that is null!"); SoundConfiguration config = getConfiguration(); @@ -162,7 +162,7 @@ public void playFor(@Nonnull Player player) { * @param loc The {@link Location} at which to play the {@link SoundEffect}. * @param category The {@link SoundCategory} that should be used. */ - public void playAt(@Nonnull Location loc, @Nonnull SoundCategory category) { + public void playAt(Location loc, SoundCategory category) { Preconditions.checkNotNull(loc, "The location should not be null."); SoundConfiguration config = getConfiguration(); @@ -177,7 +177,7 @@ public void playAt(@Nonnull Location loc, @Nonnull SoundCategory category) { * * @param block The {@link Block} at which to play the {@link SoundEffect} */ - public void playAt(@Nonnull Block block) { + public void playAt(Block block) { Preconditions.checkNotNull(block, "The block cannot be null."); playAt(block.getLocation(), SoundCategory.BLOCKS); } @@ -187,7 +187,7 @@ public void playAt(@Nonnull Block block) { * * @return The default sound id. */ - public @Nonnull String getDefaultSoundId() { + public String getDefaultSoundId() { return defaultSound; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundService.java index d2f34e865e..10f1d82c28 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/sounds/SoundService.java @@ -27,7 +27,7 @@ public class SoundService { */ private final Map soundMap = new EnumMap<>(SoundEffect.class); - public SoundService(@Nonnull Slimefun plugin) { + public SoundService(Slimefun plugin) { config = new Config(plugin, "sounds.yml"); // @formatter:off @@ -69,7 +69,7 @@ public void reload(boolean save) { } } - private void reloadSound(@Nonnull SoundEffect sound) { + private void reloadSound(SoundEffect sound) { // Set up default values config.setDefaultValue(sound.name() + ".sound", sound.getDefaultSoundId()); config.setDefaultValue(sound.name() + ".volume", sound.getDefaultVolume()); @@ -113,7 +113,7 @@ private void reloadSound(@Nonnull SoundEffect sound) { * * @return The corresponding {@link SoundConfiguration}. This may be null if something went wrong */ - public @Nullable SoundConfiguration getConfiguration(@Nonnull SoundEffect sound) { + public @Nullable SoundConfiguration getConfiguration(SoundEffect sound) { Preconditions.checkNotNull(sound, "The sound must not be null!"); return soundMap.get(sound); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java index 19de1f9ed7..abda03f8d5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java @@ -474,7 +474,7 @@ private static void setInstance(@Nullable Slimefun pluginInstance) { * * @return A {@link Collection} of all compatible minecraft versions as strings */ - static @Nonnull Collection getSupportedVersions() { + static Collection getSupportedVersions() { List list = new ArrayList<>(); for (MinecraftVersion version : MinecraftVersion.values()) { @@ -493,7 +493,7 @@ private static void setInstance(@Nullable Slimefun pluginInstance) { * * @return Our {@link Logger} instance */ - public static @Nonnull Logger logger() { + public static Logger logger() { validateInstance(); return instance.getLogger(); } @@ -559,7 +559,7 @@ private boolean isVersionUnsupported() { * * @return Our {@link GPSNetwork} instance */ - public static @Nonnull GPSNetwork getGPSNetwork() { + public static GPSNetwork getGPSNetwork() { validateInstance(); return instance.gpsNetwork; } @@ -736,7 +736,7 @@ private static void validateInstance() { * * @return Slimefun's {@link MinecraftRecipeService} instance */ - public static @Nonnull MinecraftRecipeService getMinecraftRecipeService() { + public static MinecraftRecipeService getMinecraftRecipeService() { validateInstance(); return instance.recipeService; } @@ -746,22 +746,22 @@ private static void validateInstance() { * * @return The currently installed version of Slimefun */ - public static @Nonnull String getVersion() { + public static String getVersion() { validateInstance(); return instance.getDescription().getVersion(); } - public static @Nonnull Config getCfg() { + public static Config getCfg() { validateInstance(); return instance.cfgManager.getPluginConfig(); } - public static @Nonnull Config getResearchCfg() { + public static Config getResearchCfg() { validateInstance(); return instance.researches; } - public static @Nonnull Config getItemCfg() { + public static Config getItemCfg() { validateInstance(); return instance.items; } @@ -774,12 +774,12 @@ private static void validateInstance() { * * @return Our instance of {@link PerWorldSettingsService} */ - public static @Nonnull PerWorldSettingsService getWorldSettingsService() { + public static PerWorldSettingsService getWorldSettingsService() { validateInstance(); return instance.worldSettingsService; } - public static @Nonnull TickerTask getTickerTask() { + public static TickerTask getTickerTask() { validateInstance(); return instance.ticker; } @@ -789,7 +789,7 @@ private static void validateInstance() { * * @return The {@link LocalizationService} of Slimefun */ - public static @Nonnull LocalizationService getLocalization() { + public static LocalizationService getLocalization() { validateInstance(); return instance.local; } @@ -800,27 +800,27 @@ private static void validateInstance() { * * @return Our instance of {@link HologramsService} */ - public static @Nonnull HologramsService getHologramsService() { + public static HologramsService getHologramsService() { validateInstance(); return instance.hologramsService; } - public static @Nonnull CustomItemDataService getItemDataService() { + public static CustomItemDataService getItemDataService() { validateInstance(); return instance.itemDataService; } - public static @Nonnull CustomTextureService getItemTextureService() { + public static CustomTextureService getItemTextureService() { validateInstance(); return instance.textureService; } - public static @Nonnull PermissionsService getPermissionsService() { + public static PermissionsService getPermissionsService() { validateInstance(); return instance.permissionsService; } - public static @Nonnull BlockDataService getBlockDataService() { + public static BlockDataService getBlockDataService() { validateInstance(); return instance.blockDataService; } @@ -831,7 +831,7 @@ private static void validateInstance() { * * @return Our instance of {@link IntegrationsManager} */ - public static @Nonnull IntegrationsManager getIntegrations() { + public static IntegrationsManager getIntegrations() { validateInstance(); return instance.integrations; } @@ -842,7 +842,7 @@ private static void validateInstance() { * * @return Our instanceof of the {@link ProtectionManager} */ - public static @Nonnull ProtectionManager getProtectionManager() { + public static ProtectionManager getProtectionManager() { return getIntegrations().getProtectionManager(); } @@ -851,7 +851,7 @@ private static void validateInstance() { * * @return Our instance of {@link SoundService} */ - @Nonnull + public static SoundService getSoundService() { validateInstance(); return instance.soundService; @@ -863,7 +863,7 @@ public static SoundService getSoundService() { * * @return Our {@link NetworkManager} instance */ - public static @Nonnull NetworkManager getNetworkManager() { + public static NetworkManager getNetworkManager() { validateInstance(); return instance.networkManager; } @@ -874,7 +874,7 @@ public static SoundService getSoundService() { * @param timestamp The time at which we started to load Slimefun. * @return The total time it took to load Slimefun (in ms or s) */ - private @Nonnull String getStartupTime(long timestamp) { + private String getStartupTime(long timestamp) { long ms = (System.nanoTime() - timestamp) / 1000000; if (ms > 1000) { @@ -884,32 +884,32 @@ public static SoundService getSoundService() { } } - public static @Nonnull SlimefunConfigManager getConfigManager() { + public static SlimefunConfigManager getConfigManager() { validateInstance(); return instance.cfgManager; } - public static @Nonnull SlimefunDatabaseManager getDatabaseManager() { + public static SlimefunDatabaseManager getDatabaseManager() { validateInstance(); return instance.databaseManager; } - public static @Nonnull SlimefunRegistry getRegistry() { + public static SlimefunRegistry getRegistry() { validateInstance(); return instance.registry; } - public static @Nonnull GrapplingHookListener getGrapplingHookListener() { + public static GrapplingHookListener getGrapplingHookListener() { validateInstance(); return instance.grapplingHookListener; } - public static @Nonnull BackpackListener getBackpackListener() { + public static BackpackListener getBackpackListener() { validateInstance(); return instance.backpackListener; } - public static @Nonnull SlimefunBowListener getBowListener() { + public static SlimefunBowListener getBowListener() { validateInstance(); return instance.bowListener; } @@ -919,7 +919,7 @@ public static SoundService getSoundService() { * * @return Slimefun's command */ - public static @Nonnull SlimefunCommand getCommand() { + public static SlimefunCommand getCommand() { validateInstance(); return instance.command; } @@ -930,12 +930,12 @@ public static SoundService getSoundService() { * * @return The {@link SlimefunProfiler} */ - public static @Nonnull SlimefunProfiler getProfiler() { + public static SlimefunProfiler getProfiler() { validateInstance(); return instance.profiler; } - public static @Nonnull SQLProfiler getSQLProfiler() { + public static SQLProfiler getSQLProfiler() { validateInstance(); return instance.sqlProfiler; } @@ -945,7 +945,7 @@ public static SoundService getSoundService() { * * @return The current version of Minecraft */ - public static @Nonnull MinecraftVersion getMinecraftVersion() { + public static MinecraftVersion getMinecraftVersion() { validateInstance(); return instance.minecraftVersion; } @@ -969,7 +969,7 @@ public static boolean isNewlyInstalled() { * * @return A {@link Set} of every {@link Plugin} that is dependent on Slimefun */ - public static @Nonnull Set getInstalledAddons() { + public static Set getInstalledAddons() { validateInstance(); String pluginName = instance.getName(); @@ -998,7 +998,7 @@ public static boolean isNewlyInstalled() { * * @return The resulting {@link BukkitTask} or null if Slimefun was disabled */ - public static @Nullable BukkitTask runSync(@Nonnull Runnable runnable, long delay) { + public static @Nullable BukkitTask runSync(Runnable runnable, long delay) { Validate.notNull(runnable, "Cannot run null"); Validate.isTrue(delay >= 0, "The delay cannot be negative"); @@ -1021,7 +1021,7 @@ public static boolean isNewlyInstalled() { * * @return The resulting {@link BukkitTask} or null if Slimefun was disabled */ - public static @Nullable BukkitTask runSync(@Nonnull Runnable runnable) { + public static @Nullable BukkitTask runSync(Runnable runnable) { Validate.notNull(runnable, "Cannot run null"); if (instance == null || !instance.isEnabled()) { @@ -1031,12 +1031,12 @@ public static boolean isNewlyInstalled() { return instance.getServer().getScheduler().runTask(instance, runnable); } - @Nonnull + public File getFile() { return super.getFile(); } - public static @Nonnull PlayerChatCatcher getChatCatcher() { + public static PlayerChatCatcher getChatCatcher() { validateInstance(); return instance.chatCatcher; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/CheatSheetSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/CheatSheetSlimefunGuide.java index a3a0dbb359..08e826b067 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/CheatSheetSlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/CheatSheetSlimefunGuide.java @@ -43,9 +43,9 @@ public CheatSheetSlimefunGuide() { * * @return a {@link List} of visible {@link ItemGroup} instances */ - @Nonnull + @Override - protected List getVisibleItemGroups(@Nonnull Player p, @Nonnull PlayerProfile profile) { + protected List getVisibleItemGroups(Player p, PlayerProfile profile) { List groups = new LinkedList<>(); for (ItemGroup group : Slimefun.getRegistry().getAllItemGroups()) { @@ -58,12 +58,12 @@ protected List getVisibleItemGroups(@Nonnull Player p, @Nonnull Playe } @Override - public @Nonnull SlimefunGuideMode getMode() { + public SlimefunGuideMode getMode() { return SlimefunGuideMode.CHEAT_MODE; } @Override - public @Nonnull ItemStack getItem() { + public ItemStack getItem() { return item; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java index 2e1f7e8d07..2785fd0c89 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java @@ -79,12 +79,12 @@ public SurvivalSlimefunGuide(boolean v1, boolean v2) { } @Override - public @Nonnull SlimefunGuideMode getMode() { + public SlimefunGuideMode getMode() { return SlimefunGuideMode.SURVIVAL_MODE; } @Override - public @Nonnull ItemStack getItem() { + public ItemStack getItem() { return item; } @@ -102,7 +102,7 @@ protected final boolean isSurvivalMode() { * * @return a {@link List} of visible {@link ItemGroup} instances */ - protected @Nonnull List getVisibleItemGroups(@Nonnull Player p, @Nonnull PlayerProfile profile) { + protected List getVisibleItemGroups(Player p, PlayerProfile profile) { List groups = new LinkedList<>(); for (ItemGroup group : Slimefun.getRegistry().getAllItemGroups()) { @@ -720,7 +720,7 @@ private void addBackButton(ChestMenu menu, int slot, Player p, PlayerProfile pro } @ParametersAreNonnullByDefault - private static @Nonnull ItemStack getDisplayItem(Player p, boolean isSlimefunRecipe, ItemStack item) { + private static ItemStack getDisplayItem(Player p, boolean isSlimefunRecipe, ItemStack item) { if (isSlimefunRecipe) { SlimefunItem slimefunItem = SlimefunItem.getByItem(item); @@ -832,7 +832,7 @@ private static boolean hasPermission(Player p, SlimefunItem item) { return Slimefun.getPermissionsService().hasPermission(p, item); } - private @Nonnull ChestMenu create(@Nonnull Player p) { + private ChestMenu create(Player p) { ChestMenu menu = new ChestMenu(Slimefun.getLocalization().getMessage(p, "guide.title.main")); menu.setEmptySlotsClickable(false); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/handlers/SimpleBlockBreakHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/handlers/SimpleBlockBreakHandler.java index 48ac29125e..67bf6d3ec1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/handlers/SimpleBlockBreakHandler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/handlers/SimpleBlockBreakHandler.java @@ -36,10 +36,10 @@ protected SimpleBlockBreakHandler() { * @param b * The broken {@link Block} */ - public abstract void onBlockBreak(@Nonnull Block b); + public abstract void onBlockBreak(Block b); @Override - public void onPlayerBreak(BlockBreakEvent e, @Nonnull ItemStack item, @Nonnull List drops) { + public void onPlayerBreak(BlockBreakEvent e, ItemStack item, List drops) { onBlockBreak(e.getBlock()); } @@ -49,7 +49,7 @@ public void onAndroidBreak(AndroidMineEvent e) { } @Override - public void onExplode(@Nonnull Block b, @Nonnull List drops) { + public void onExplode(Block b, List drops) { onBlockBreak(b); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/handlers/VanillaInventoryDropHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/handlers/VanillaInventoryDropHandler.java index 4fb5bc8552..4fe81cbe17 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/handlers/VanillaInventoryDropHandler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/handlers/VanillaInventoryDropHandler.java @@ -44,7 +44,7 @@ public class VanillaInventoryDropHandler * @param blockStateClass * The class of the block's {@link BlockState} */ - public VanillaInventoryDropHandler(@Nonnull Class blockStateClass) { + public VanillaInventoryDropHandler(Class blockStateClass) { super(false, true); Validate.notNull(blockStateClass, "The provided class must not be null!"); @@ -74,8 +74,8 @@ public void onPlayerBreak(BlockBreakEvent e, ItemStack item, List dro } } - @Nonnull - protected Inventory getInventory(@Nonnull T inventoryHolder) { + + protected Inventory getInventory(T inventoryHolder) { if (inventoryHolder instanceof Chest chest) { return chest.getBlockInventory(); } else { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/LimitedUseItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/LimitedUseItem.java index d70862b117..b261c381bf 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/LimitedUseItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/LimitedUseItem.java @@ -66,7 +66,7 @@ public final int getMaxUseCount() { * * @return The {@link LimitedUseItem} for chaining of setters */ - public final @Nonnull LimitedUseItem setMaxUseCount(int count) { + public final LimitedUseItem setMaxUseCount(int count) { Validate.isTrue(count > 0, "The maximum use count must be greater than zero!"); maxUseCount = count; @@ -78,12 +78,12 @@ public final int getMaxUseCount() { * * @return The {@link NamespacedKey} to store/load the amount of uses */ - protected @Nonnull NamespacedKey getStorageKey() { + protected NamespacedKey getStorageKey() { return defaultUsageKey; } @Override - public void register(@Nonnull SlimefunAddon addon) { + public void register(SlimefunAddon addon) { if (getMaxUseCount() < 1) { warn("The use count has not been configured correctly. It needs to be at least 1. The Item was" + " disabled."); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/RadioactiveItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/RadioactiveItem.java index 588658b3fb..3c8e8f001b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/RadioactiveItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/RadioactiveItem.java @@ -88,13 +88,13 @@ public RadioactiveItem( addItemHandler(onRightClick()); } - @Nonnull + private ItemUseHandler onRightClick() { return PlayerRightClickEvent::cancel; } @Override - @Nonnull + public Radioactivity getRadioactivity() { return radioactivity; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/SimpleSlimefunItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/SimpleSlimefunItem.java index eea7c7c588..8f2da03273 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/SimpleSlimefunItem.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/SimpleSlimefunItem.java @@ -55,5 +55,5 @@ public void preRegister() { * * @return The {@link ItemHandler} that should be added to this {@link SlimefunItem} */ - public abstract @Nonnull T getItemHandler(); + public abstract T getItemHandler(); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/altar/AncientAltar.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/altar/AncientAltar.java index de9fbce093..c169cdd64a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/altar/AncientAltar.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/altar/AncientAltar.java @@ -60,7 +60,7 @@ public int getStepDelay() { return stepDelay.getValue(); } - @Nonnull + public List getRecipes() { return recipes; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/altar/AncientPedestal.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/altar/AncientPedestal.java index 750eaedf6e..65ad9602f8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/altar/AncientPedestal.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/altar/AncientPedestal.java @@ -63,11 +63,11 @@ public AncientPedestal( addItemHandler(onBreak()); } - private @Nonnull BlockBreakHandler onBreak() { + private BlockBreakHandler onBreak() { return new SimpleBlockBreakHandler() { @Override - public void onBlockBreak(@Nonnull Block b) { + public void onBlockBreak(Block b) { Optional entity = getPlacedItem(b); ArmorStand armorStand = getArmorStand(b, false); @@ -89,11 +89,11 @@ public void onBlockBreak(@Nonnull Block b) { } @Override - public @Nonnull BlockDispenseHandler getItemHandler() { + public BlockDispenseHandler getItemHandler() { return (e, d, block, machine) -> e.setCancelled(true); } - public @Nonnull Optional getPlacedItem(@Nonnull Block pedestal) { + public Optional getPlacedItem(Block pedestal) { Location l = pedestal.getLocation().add(0.5, 1.2, 0.5); for (Entity n : l.getWorld().getNearbyEntities(l, 0.5, 0.5, 0.5, AncientPedestal::testItem)) { @@ -105,7 +105,7 @@ public void onBlockBreak(@Nonnull Block b) { return Optional.empty(); } - public @Nullable ArmorStand getArmorStand(@Nonnull Block pedestal, boolean createIfNoneExists) { + public @Nullable ArmorStand getArmorStand(Block pedestal, boolean createIfNoneExists) { Optional entity = getPlacedItem(pedestal); if (entity.isPresent() && entity.get().getVehicle() instanceof ArmorStand armorStand) { @@ -141,7 +141,7 @@ private boolean testArmorStand(@Nullable Entity n) { } } - public @Nonnull ItemStack getOriginalItemStack(@Nonnull Item item) { + public ItemStack getOriginalItemStack(Item item) { ItemStack stack = item.getItemStack().clone(); ItemMeta im = stack.getItemMeta(); String customName = item.getCustomName(); @@ -156,7 +156,7 @@ private boolean testArmorStand(@Nullable Entity n) { return stack; } - public void placeItem(@Nonnull Player p, @Nonnull Block b) { + public void placeItem(Player p, Block b) { ItemStack hand = p.getInventory().getItemInMainHand(); String displayName = ITEM_PREFIX + System.nanoTime(); ItemStack displayItem = new CustomItemStack(hand, displayName); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidFuelSource.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidFuelSource.java index 5c3166c733..85fa83dcea 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidFuelSource.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidFuelSource.java @@ -30,7 +30,7 @@ public enum AndroidFuelSource { private final String[] lore; - AndroidFuelSource(@Nonnull String... lore) { + AndroidFuelSource(String... lore) { this.lore = lore; } @@ -39,7 +39,7 @@ public enum AndroidFuelSource { * * @return An {@link ItemStack} to display */ - @Nonnull + public ItemStack getItem() { return new CustomItemStack(HeadTexture.GENERATOR.getAsItemStack(), "&8\u21E9 &c燃料输入槽 &8\u21E9", lore); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidInterface.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidInterface.java index cc7de6945d..d81e0c8a17 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidInterface.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidInterface.java @@ -30,7 +30,7 @@ public AndroidInterface(ItemGroup itemGroup, SlimefunItemStack item, RecipeType addItemHandler(new VanillaInventoryDropHandler<>(Dispenser.class)); } - @Nonnull + @Override public BlockDispenseHandler getItemHandler() { return (e, d, block, machine) -> e.setCancelled(true); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidType.java index 189e40456d..89267475f2 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidType.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/AndroidType.java @@ -51,7 +51,7 @@ public enum AndroidType { */ NON_FIGHTER; - boolean isType(@Nonnull AndroidType type) { + boolean isType(AndroidType type) { return type == NONE || type == this || (type == NON_FIGHTER && this != FIGHTER); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Instruction.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Instruction.java index 5a611ccfa6..a82c9808af 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Instruction.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Instruction.java @@ -266,12 +266,12 @@ public enum Instruction { this(type, head, null); } - @Nonnull + public ItemStack getItem() { return item; } - @Nonnull + public AndroidType getRequiredType() { return type; } @@ -293,7 +293,7 @@ public void execute(ProgrammableAndroid android, Block b, BlockMenu inventory, B * * @return The {@link Instruction} or null if it does not exist. */ - @Nullable public static Instruction getInstruction(@Nonnull String value) { + @Nullable public static Instruction getInstruction(String value) { Validate.notNull(value, "An Instruction cannot be null!"); return nameLookup.get(value); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java index cb06c746da..b60d1b2d0a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java @@ -63,7 +63,7 @@ public MinerAndroid( } @Override - @Nonnull + public AndroidType getAndroidType() { return AndroidType.MINER; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java index 274925d1c6..95dd431955 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java @@ -164,7 +164,7 @@ public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { addItemHandler(onPlace(), onBreak()); } - @Nonnull + private BlockPlaceHandler onPlace() { return new BlockPlaceHandler(false) { @@ -190,7 +190,7 @@ public void onPlayerPlace(BlockPlaceEvent e) { }; } - @Nonnull + private BlockBreakHandler onBreak() { return new BlockBreakHandler(false, false) { @@ -393,7 +393,7 @@ private String addInstruction(String[] script, int index, Instruction instructio return builder.toString(); } - private String duplicateInstruction(@Nonnull String[] script, int index) { + private String duplicateInstruction(String[] script, int index) { int i = 0; StringBuilder builder = new StringBuilder(Instruction.START + "-"); @@ -611,7 +611,7 @@ public void openScriptEditor(Player p, Block b) { menu.open(p); } - @Nonnull + protected List getValidScriptInstructions() { List list = new ArrayList<>(); @@ -665,14 +665,14 @@ protected void editInstruction(Player p, Block b, String[] script, int index) { menu.open(p); } - @Nonnull - public String getScript(@Nonnull Location l) { + + public String getScript(Location l) { Validate.notNull(l, "Location for android not specified"); String script = StorageCacheUtils.getData(l, "script"); return script != null ? script : DEFAULT_SCRIPT; } - public void setScript(@Nonnull Location l, @Nonnull String script) { + public void setScript(Location l, String script) { Validate.notNull(l, "Location for android not specified"); Validate.notNull(script, "No script given"); Validate.isTrue(script.startsWith(Instruction.START.name() + '-'), "A script must begin with a 'START' token."); @@ -720,7 +720,7 @@ private void registerDefaultFuelTypes() { } } - public void registerFuelType(@Nonnull MachineFuel fuel) { + public void registerFuelType(MachineFuel fuel) { Validate.notNull(fuel, "Cannot register null as a Fuel type"); fuelTypes.add(fuel); @@ -946,7 +946,7 @@ private void consumeFuel(Block b, BlockMenu menu) { } } - private void constructMenu(@Nonnull BlockMenuPreset preset) { + private void constructMenu(BlockMenuPreset preset) { preset.drawBackground(BORDER); preset.drawBackground(ChestMenuUtils.getOutputSlotTexture(), OUTPUT_BORDER); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Script.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Script.java index 7ff990e48c..034ea3acbe 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Script.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/Script.java @@ -41,7 +41,7 @@ public final class Script { * @param config * The {@link Config} */ - private Script(@Nonnull Config config) { + private Script(Config config) { Validate.notNull(config); this.config = config; @@ -64,7 +64,7 @@ private Script(@Nonnull Config config) { * * @return The name */ - @Nonnull + public String getName() { return name; } @@ -75,7 +75,7 @@ public String getName() { * * @return The author of this {@link Script} */ - @Nonnull + public String getAuthor() { return author; } @@ -87,7 +87,7 @@ public String getAuthor() { * * @return The code for this {@link Script} */ - @Nonnull + public String getSourceCode() { return code; } @@ -101,7 +101,7 @@ public String getSourceCode() { * * @return Whether the given {@link OfflinePlayer} is the author of this {@link Script}. */ - public boolean isAuthor(@Nonnull OfflinePlayer p) { + public boolean isAuthor(OfflinePlayer p) { return p.getUniqueId().equals(config.getUUID("author")); } @@ -114,7 +114,7 @@ public boolean isAuthor(@Nonnull OfflinePlayer p) { * * @return Whether the given {@link Player} is able to rate this {@link Script} */ - public boolean canRate(@Nonnull Player p) { + public boolean canRate(Player p) { if (isAuthor(p)) { return false; } @@ -125,8 +125,8 @@ public boolean canRate(@Nonnull Player p) { && !downvoters.contains(p.getUniqueId().toString()); } - @Nonnull - ItemStack getAsItemStack(@Nonnull ProgrammableAndroid android, @Nonnull Player p) { + + ItemStack getAsItemStack(ProgrammableAndroid android, Player p) { List lore = new LinkedList<>(); lore.add("&7作者 &f" + getAuthor()); lore.add(""); @@ -146,7 +146,7 @@ ItemStack getAsItemStack(@Nonnull ProgrammableAndroid android, @Nonnull Player p return new CustomItemStack(android.getItem(), "&b" + getName(), lore.toArray(new String[0])); } - @Nonnull + private String getScriptRatingPercentage() { float percentage = getRating(); return NumberUtils.getColorFromPercentage(percentage) + String.valueOf(percentage) + ChatColor.WHITE + "% "; @@ -200,7 +200,7 @@ public void download() { config.save(); } - public void rate(@Nonnull Player p, boolean positive) { + public void rate(Player p, boolean positive) { config.reload(); String path = "rating." + (positive ? "positive" : "negative"); @@ -211,8 +211,8 @@ public void rate(@Nonnull Player p, boolean positive) { config.save(); } - @Nonnull - public static List