diff --git a/plugin/src/main/java/me/filoghost/chestcommands/icon/BaseConfigurableIcon.java b/plugin/src/main/java/me/filoghost/chestcommands/icon/BaseConfigurableIcon.java index 7c3ea8c..ba32909 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/icon/BaseConfigurableIcon.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/icon/BaseConfigurableIcon.java @@ -233,7 +233,7 @@ public abstract class BaseConfigurableIcon implements Icon { cachedRendering = null; } - public String renderName(Player viewer) { + public @Nullable String renderName(Player viewer) { if (name == null) { return null; } @@ -251,7 +251,7 @@ public abstract class BaseConfigurableIcon implements Icon { } } - public List renderLore(Player viewer) { + public @Nullable List renderLore(Player viewer) { if (lore == null) { return null; } diff --git a/plugin/src/main/java/me/filoghost/chestcommands/icon/InternalConfigurableIcon.java b/plugin/src/main/java/me/filoghost/chestcommands/icon/InternalConfigurableIcon.java index 557fde6..cba4206 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/icon/InternalConfigurableIcon.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/icon/InternalConfigurableIcon.java @@ -23,6 +23,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.List; @@ -166,7 +167,7 @@ public class InternalConfigurableIcon extends BaseConfigurableIcon implements Re } @Override - public ItemStack updateRendering(Player viewer, ItemStack currentRendering) { + public @Nullable ItemStack updateRendering(Player viewer, @Nullable ItemStack currentRendering) { if (currentRendering != null && shouldCacheRendering()) { // Internal icons do not change, no need to update if the item is already rendered return currentRendering; diff --git a/plugin/src/main/java/me/filoghost/chestcommands/icon/RefreshableIcon.java b/plugin/src/main/java/me/filoghost/chestcommands/icon/RefreshableIcon.java index 22d615a..6999f79 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/icon/RefreshableIcon.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/icon/RefreshableIcon.java @@ -7,9 +7,10 @@ package me.filoghost.chestcommands.icon; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.Nullable; public interface RefreshableIcon { - ItemStack updateRendering(Player viewer, ItemStack currentRendering); + @Nullable ItemStack updateRendering(Player viewer, @Nullable ItemStack currentRendering); } diff --git a/plugin/src/main/java/me/filoghost/chestcommands/legacy/UpgradeList.java b/plugin/src/main/java/me/filoghost/chestcommands/legacy/UpgradeList.java index 902be11..e325e92 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/legacy/UpgradeList.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/legacy/UpgradeList.java @@ -20,6 +20,7 @@ import me.filoghost.fcommons.collection.CollectionUtils; import me.filoghost.fcommons.config.ConfigLoader; import me.filoghost.fcommons.config.exception.ConfigException; import me.filoghost.fcommons.logging.Log; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.nio.file.Path; @@ -73,7 +74,7 @@ public class UpgradeList { } } - private static String readLegacyCommandSeparator(ConfigManager configManager) { + private static @Nullable String readLegacyCommandSeparator(ConfigManager configManager) { ConfigLoader settingsConfigLoader = configManager.getConfigLoader("config.yml"); if (!settingsConfigLoader.fileExists()) { diff --git a/plugin/src/main/java/me/filoghost/chestcommands/listener/CommandListener.java b/plugin/src/main/java/me/filoghost/chestcommands/listener/CommandListener.java index f9aff65..cd3260a 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/listener/CommandListener.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/listener/CommandListener.java @@ -11,6 +11,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.jetbrains.annotations.Nullable; public class CommandListener implements Listener { @@ -30,7 +31,7 @@ public class CommandListener implements Listener { menu.openCheckingPermission(event.getPlayer()); } - private static String getCommandName(String fullCommand) { + private static @Nullable String getCommandName(String fullCommand) { if (!fullCommand.startsWith("/")) { return null; } diff --git a/plugin/src/main/java/me/filoghost/chestcommands/menu/MenuManager.java b/plugin/src/main/java/me/filoghost/chestcommands/menu/MenuManager.java index 6c6d0bc..e21fb17 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/menu/MenuManager.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/menu/MenuManager.java @@ -18,6 +18,7 @@ import org.bukkit.event.block.Action; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.Collections; @@ -95,7 +96,7 @@ public class MenuManager { } } - public static DefaultMenuView getOpenMenuView(Player player) { + public static @Nullable DefaultMenuView getOpenMenuView(Player player) { InventoryView inventoryView = player.getOpenInventory(); if (inventoryView == null) { return null; @@ -110,7 +111,7 @@ public class MenuManager { } - public static DefaultMenuView getOpenMenuView(Inventory inventory) { + public static @Nullable DefaultMenuView getOpenMenuView(Inventory inventory) { MenuInventoryHolder inventoryHolder = getMenuInventoryHolder(inventory); if (inventoryHolder != null) { return inventoryHolder.getMenuView(); @@ -119,7 +120,7 @@ public class MenuManager { } } - private static MenuInventoryHolder getMenuInventoryHolder(Inventory inventory) { + private static @Nullable MenuInventoryHolder getMenuInventoryHolder(Inventory inventory) { if (inventory.getHolder() instanceof MenuInventoryHolder) { return (MenuInventoryHolder) inventory.getHolder(); } else { diff --git a/plugin/src/main/java/me/filoghost/chestcommands/parsing/menu/ClickType.java b/plugin/src/main/java/me/filoghost/chestcommands/parsing/menu/ClickType.java index 186b5eb..b33f8f0 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/parsing/menu/ClickType.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/parsing/menu/ClickType.java @@ -6,6 +6,7 @@ package me.filoghost.chestcommands.parsing.menu; import org.bukkit.event.block.Action; +import org.jetbrains.annotations.Nullable; public enum ClickType { @@ -13,7 +14,7 @@ public enum ClickType { RIGHT, BOTH; - public static ClickType fromOptions(boolean left, boolean right) { + public static @Nullable ClickType fromOptions(boolean left, boolean right) { if (left && right) { return BOTH; } else if (left) { diff --git a/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderManager.java b/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderManager.java index 06cbac4..c2cfcd2 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderManager.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderManager.java @@ -5,8 +5,6 @@ */ package me.filoghost.chestcommands.placeholder; -import java.util.ArrayList; -import java.util.List; import me.filoghost.chestcommands.api.PlaceholderReplacer; import me.filoghost.chestcommands.hook.PlaceholderAPIHook; import me.filoghost.chestcommands.placeholder.scanner.PlaceholderMatch; @@ -14,6 +12,10 @@ import me.filoghost.chestcommands.placeholder.scanner.PlaceholderScanner; import me.filoghost.fcommons.Preconditions; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; public class PlaceholderManager { @@ -62,7 +64,7 @@ public class PlaceholderManager { return relativePlaceholderRegistry.getPlaceholderReplacer(placeholderMatch) != null; } - private static String getReplacement(PlaceholderMatch placeholderMatch, Player player) { + private static @Nullable String getReplacement(PlaceholderMatch placeholderMatch, Player player) { PlaceholderReplacer placeholderReplacer = relativePlaceholderRegistry.getPlaceholderReplacer(placeholderMatch); if (placeholderReplacer == null) { diff --git a/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderRegistry.java b/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderRegistry.java index a192586..3d20c61 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderRegistry.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderRegistry.java @@ -5,12 +5,14 @@ */ package me.filoghost.chestcommands.placeholder; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; import me.filoghost.chestcommands.api.PlaceholderReplacer; import me.filoghost.chestcommands.placeholder.scanner.PlaceholderMatch; import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; public class PlaceholderRegistry { @@ -27,7 +29,7 @@ public class PlaceholderRegistry { .put(plugin.getName(), placeholderReplacer); } - public PlaceholderReplacer getPlaceholderReplacer(PlaceholderMatch placeholderMatch) { + public @Nullable PlaceholderReplacer getPlaceholderReplacer(PlaceholderMatch placeholderMatch) { if (placeholderMatch.getPluginNamespace() == null) { PlaceholderReplacer internalReplacer = internalPlaceholders.get(placeholderMatch.getIdentifier()); if (internalReplacer != null) { diff --git a/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderString.java b/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderString.java index 3a8e294..9f60328 100644 --- a/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderString.java +++ b/plugin/src/main/java/me/filoghost/chestcommands/placeholder/PlaceholderString.java @@ -6,6 +6,7 @@ package me.filoghost.chestcommands.placeholder; import org.bukkit.entity.Player; +import org.jetbrains.annotations.Nullable; public class PlaceholderString { @@ -13,7 +14,7 @@ public class PlaceholderString { private final String stringWithStaticPlaceholders; private final boolean hasDynamicPlaceholders; - public static PlaceholderString of(String string) { + public static @Nullable PlaceholderString of(String string) { if (string != null) { return new PlaceholderString(string); } else {