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 4b4614e58..50ac90d1a 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 @@ -21,8 +21,8 @@ import org.bukkit.inventory.meta.ItemMeta; import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon; -import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory; -import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory; +import io.github.thebusybiscuit.slimefun4.api.items.groups.LockedItemGroup; +import io.github.thebusybiscuit.slimefun4.api.items.groups.SeasonalItemGroup; import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; @@ -31,8 +31,8 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; * * @author TheBusyBiscuit * - * @see LockedCategory - * @see SeasonalCategory + * @see LockedItemGroup + * @see SeasonalItemGroup * */ public class ItemGroup implements Keyed { @@ -205,7 +205,7 @@ public class ItemGroup implements Keyed { name = item.getItemMeta().getDisplayName(); } - if (this instanceof SeasonalCategory) { + if (this instanceof SeasonalItemGroup) { meta.setDisplayName(ChatColor.GOLD + name); } else { meta.setDisplayName(ChatColor.YELLOW + name); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/FlexCategory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/FlexItemGroup.java similarity index 81% rename from src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/FlexCategory.java rename to src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/FlexItemGroup.java index 0572f3c3f..07e973683 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/FlexCategory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/FlexItemGroup.java @@ -1,4 +1,4 @@ -package io.github.thebusybiscuit.slimefun4.core.categories; +package io.github.thebusybiscuit.slimefun4.api.items.groups; import java.util.List; @@ -16,7 +16,7 @@ import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide; import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode; /** - * A {@link FlexCategory} is a {@link ItemGroup} inside the {@link SlimefunGuide} that can + * A {@link FlexItemGroup} is a {@link ItemGroup} inside the {@link SlimefunGuide} that can * be completely modified. * It cannot hold any {@link SlimefunItem} but can be completely overridden * to perform any action upon being opened. @@ -24,20 +24,20 @@ import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode; * @author TheBusyBiscuit * */ -public abstract class FlexCategory extends ItemGroup { +public abstract class FlexItemGroup extends ItemGroup { @ParametersAreNonnullByDefault - protected FlexCategory(NamespacedKey key, ItemStack item) { + protected FlexItemGroup(NamespacedKey key, ItemStack item) { this(key, item, 3); } @ParametersAreNonnullByDefault - protected FlexCategory(NamespacedKey key, ItemStack item, int tier) { + protected FlexItemGroup(NamespacedKey key, ItemStack item, int tier) { super(key, item, tier); } /** - * This method returns whether this {@link FlexCategory} is visible under the given context. + * This method returns whether this {@link FlexItemGroup} is visible under the given context. * Implementing this method gives full flexibility over who can see the Category when and where. * * @param p @@ -45,20 +45,20 @@ public abstract class FlexCategory extends ItemGroup { * @param profile * The {@link PlayerProfile} of the {@link Player} * @param layout - * The {@link SlimefunGuideMode} in which this {@link FlexCategory} is viewed + * The {@link SlimefunGuideMode} in which this {@link FlexItemGroup} is viewed * - * @return Whether to display this {@link FlexCategory} + * @return Whether to display this {@link FlexItemGroup} */ @ParametersAreNonnullByDefault public abstract boolean isVisible(Player p, PlayerProfile profile, SlimefunGuideMode layout); /** - * This method is called when a {@link Player} opens this {@link FlexCategory}. + * This method is called when a {@link Player} opens this {@link FlexItemGroup}. * This is an abstract method which needs to be implemented in order to determine what this - * {@link FlexCategory} should actually do as it cannot hold any items. + * {@link FlexItemGroup} should actually do as it cannot hold any items. * * @param p - * The {@link Player} who wants to open this {@link FlexCategory} + * The {@link Player} who wants to open this {@link FlexItemGroup} * @param profile * The corresponding {@link PlayerProfile} for that {@link Player} * @param layout diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/LockedItemGroup.java similarity index 91% rename from src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java rename to src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/LockedItemGroup.java index d557a9b19..a7db69b04 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/LockedCategory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/LockedItemGroup.java @@ -1,4 +1,4 @@ -package io.github.thebusybiscuit.slimefun4.core.categories; +package io.github.thebusybiscuit.slimefun4.api.items.groups; import java.util.ArrayList; import java.util.HashSet; @@ -29,10 +29,10 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; * @author TheBusyBiscuit * * @see ItemGroup - * @see SeasonalCategory + * @see SeasonalItemGroup * */ -public class LockedCategory extends ItemGroup { +public class LockedItemGroup extends ItemGroup { private final NamespacedKey[] keys; private final Set parents = new HashSet<>(); @@ -50,7 +50,7 @@ public class LockedCategory extends ItemGroup { * */ @ParametersAreNonnullByDefault - public LockedCategory(NamespacedKey key, ItemStack item, NamespacedKey... parents) { + public LockedItemGroup(NamespacedKey key, ItemStack item, NamespacedKey... parents) { this(key, item, 3, parents); } @@ -68,7 +68,7 @@ public class LockedCategory extends ItemGroup { * */ @ParametersAreNonnullByDefault - public LockedCategory(NamespacedKey key, ItemStack item, int tier, NamespacedKey... parents) { + public LockedItemGroup(NamespacedKey key, ItemStack item, int tier, NamespacedKey... parents) { super(key, item, tier); Validate.noNullElements(parents, "A LockedCategory must not have any 'null' parents!"); @@ -99,7 +99,7 @@ public class LockedCategory extends ItemGroup { } /** - * Gets the list of parent categories for this {@link LockedCategory}. + * Gets the list of parent categories for this {@link LockedItemGroup}. * * @return the list of parent categories * @@ -112,7 +112,7 @@ public class LockedCategory extends ItemGroup { } /** - * Adds a parent {@link ItemGroup} to this {@link LockedCategory}. + * Adds a parent {@link ItemGroup} to this {@link LockedItemGroup}. * * @param category * The {@link ItemGroup} to add as a parent @@ -129,10 +129,10 @@ public class LockedCategory extends ItemGroup { } /** - * Removes a {@link ItemGroup} from the parents of this {@link LockedCategory}. + * Removes a {@link ItemGroup} from the parents of this {@link LockedItemGroup}. * * @param category - * The {@link ItemGroup} to remove from the parents of this {@link LockedCategory} + * The {@link ItemGroup} to remove from the parents of this {@link LockedItemGroup} * * @see #getParents() * @see #addParent(ItemGroup) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/MultiCategory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/NestedItemGroup.java similarity index 73% rename from src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/MultiCategory.java rename to src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/NestedItemGroup.java index f81f02beb..528baf5ef 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/MultiCategory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/NestedItemGroup.java @@ -1,4 +1,4 @@ -package io.github.thebusybiscuit.slimefun4.core.categories; +package io.github.thebusybiscuit.slimefun4.api.items.groups; import java.util.ArrayList; import java.util.List; @@ -20,45 +20,46 @@ import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.implementation.guide.SurvivalSlimefunGuide; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; + import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu; -public class MultiCategory extends FlexCategory { +public class NestedItemGroup extends FlexItemGroup { - private static final int CATEGORY_SIZE = 36; - private final List subCategories = new ArrayList<>(); + private static final int GROUP_SIZE = 36; + private final List subGroups = new ArrayList<>(); @ParametersAreNonnullByDefault - public MultiCategory(NamespacedKey key, ItemStack item) { + public NestedItemGroup(NamespacedKey key, ItemStack item) { this(key, item, 3); } @ParametersAreNonnullByDefault - public MultiCategory(NamespacedKey key, ItemStack item, int tier) { + public NestedItemGroup(NamespacedKey key, ItemStack item, int tier) { super(key, item, tier); } /** - * This will add the given {@link SubCategory} to this {@link MultiCategory}. + * This will add the given {@link SubItemGroup} to this {@link NestedItemGroup}. * * @param category - * The {@link SubCategory} to add. + * The {@link SubItemGroup} to add. */ - public void addSubCategory(@Nonnull SubCategory category) { - Validate.notNull(category, "The Category cannot be null!"); + public void addSubGroup(@Nonnull SubItemGroup category) { + Validate.notNull(category, "The sub item group cannot be null!"); - subCategories.add(category); + subGroups.add(category); } /** - * This will remove the given {@link SubCategory} from this {@link MultiCategory} (if present). + * This will remove the given {@link SubItemGroup} from this {@link NestedItemGroup} (if present). * * @param category - * The {@link SubCategory} to remove. + * The {@link SubItemGroup} to remove. */ - public void removeSubCategory(@Nonnull SubCategory category) { - Validate.notNull(category, "The Category cannot be null!"); + public void removeSubGroup(@Nonnull SubItemGroup category) { + Validate.notNull(category, "The sub item group cannot be null!"); - subCategories.remove(category); + subGroups.remove(category); } @Override @@ -96,12 +97,12 @@ public class MultiCategory extends FlexCategory { int index = 9; - int target = (CATEGORY_SIZE * (page - 1)) - 1; + int target = (GROUP_SIZE * (page - 1)) - 1; - while (target < (subCategories.size() - 1) && index < CATEGORY_SIZE + 9) { + while (target < (subGroups.size() - 1) && index < GROUP_SIZE + 9) { target++; - SubCategory category = subCategories.get(target); + SubItemGroup category = subGroups.get(target); menu.addItem(index, category.getItem(p)); menu.addMenuClickHandler(index, (pl, slot, item, action) -> { SlimefunGuide.openCategory(profile, category, mode, 1); @@ -111,7 +112,7 @@ public class MultiCategory extends FlexCategory { index++; } - int pages = target == subCategories.size() - 1 ? page : (subCategories.size() - 1) / CATEGORY_SIZE + 1; + int pages = target == subGroups.size() - 1 ? page : (subGroups.size() - 1) / GROUP_SIZE + 1; menu.addItem(46, ChestMenuUtils.getPreviousButton(p, page, pages)); menu.addMenuClickHandler(46, (pl, slot, item, action) -> { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/SeasonalCategory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SeasonalItemGroup.java similarity index 79% rename from src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/SeasonalCategory.java rename to src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SeasonalItemGroup.java index c8330101b..a4859a1d0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/SeasonalCategory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SeasonalItemGroup.java @@ -1,4 +1,4 @@ -package io.github.thebusybiscuit.slimefun4.core.categories; +package io.github.thebusybiscuit.slimefun4.api.items.groups; import java.time.LocalDate; import java.time.Month; @@ -20,14 +20,14 @@ import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; * @author TheBusyBiscuit * * @see ItemGroup - * @see LockedCategory + * @see LockedItemGroup */ -public class SeasonalCategory extends ItemGroup { +public class SeasonalItemGroup extends ItemGroup { private final Month month; /** - * The constructor for a {@link SeasonalCategory}. + * The constructor for a {@link SeasonalItemGroup}. * * @param key * The {@link NamespacedKey} that is used to identify this {@link ItemGroup} @@ -39,7 +39,7 @@ public class SeasonalCategory extends ItemGroup { * The display item for this category */ @ParametersAreNonnullByDefault - public SeasonalCategory(NamespacedKey key, Month month, int tier, ItemStack item) { + public SeasonalItemGroup(NamespacedKey key, Month month, int tier, ItemStack item) { super(key, item, tier); Validate.notNull(month, "The Month cannot be null"); @@ -47,9 +47,9 @@ public class SeasonalCategory extends ItemGroup { } /** - * This method returns the {@link Month} in which this {@link SeasonalCategory} will appear. + * This method returns the {@link Month} in which this {@link SeasonalItemGroup} will appear. * - * @return the {@link Month} in which this {@link SeasonalCategory} appears + * @return the {@link Month} in which this {@link SeasonalItemGroup} appears */ @Nonnull public Month getMonth() { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/SubCategory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SubItemGroup.java similarity index 68% rename from src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/SubCategory.java rename to src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SubItemGroup.java index 47eb2fb66..b8a3da78b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/SubCategory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SubItemGroup.java @@ -1,4 +1,4 @@ -package io.github.thebusybiscuit.slimefun4.core.categories; +package io.github.thebusybiscuit.slimefun4.api.items.groups; import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; @@ -12,31 +12,31 @@ import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; /** - * The {@link SubCategory} is a child {@link ItemGroup} of the - * {@link MultiCategory}. + * The {@link SubItemGroup} is a child {@link ItemGroup} of the + * {@link NestedItemGroup}. * * @author TheBusyBiscuit * - * @see MultiCategory + * @see NestedItemGroup * */ -public class SubCategory extends ItemGroup { +public class SubItemGroup extends ItemGroup { - private final MultiCategory multiCategory; + private final NestedItemGroup multiCategory; @ParametersAreNonnullByDefault - public SubCategory(NamespacedKey key, MultiCategory parent, ItemStack item) { + public SubItemGroup(NamespacedKey key, NestedItemGroup parent, ItemStack item) { this(key, parent, item, 3); } @ParametersAreNonnullByDefault - public SubCategory(NamespacedKey key, MultiCategory parent, ItemStack item, int tier) { + public SubItemGroup(NamespacedKey key, NestedItemGroup parent, ItemStack item, int tier) { super(key, item, tier); Validate.notNull(parent, "The parent category cannot be null"); multiCategory = parent; - parent.addSubCategory(this); + parent.addSubGroup(this); } @Override @@ -49,7 +49,7 @@ public class SubCategory extends ItemGroup { } @Nonnull - public final MultiCategory getParent() { + public final NestedItemGroup getParent() { return multiCategory; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/package-info.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/package-info.java new file mode 100644 index 000000000..e95ee138f --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/package-info.java @@ -0,0 +1,4 @@ +/** + * This package contains a few {@link io.github.thebusybiscuit.slimefun4.api.items.ItemGroup} variations. + */ +package io.github.thebusybiscuit.slimefun4.api.items.groups; \ No newline at end of file diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/package-info.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/package-info.java deleted file mode 100644 index 2be27de3c..000000000 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/categories/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * This package stores API classes that are centered around the extension of the - * {@link me.mrCookieSlime.Slimefun.Objects.Category} class, such as - * {@link io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory} for example. - */ -package io.github.thebusybiscuit.slimefun4.core.categories; \ No newline at end of file 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 7f107d74b..04ec71b4c 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 @@ -13,8 +13,8 @@ import org.bukkit.inventory.Recipe; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; +import io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup; import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; -import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory; import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils; @@ -53,7 +53,7 @@ public class CheatSheetSlimefunGuide extends SurvivalSlimefunGuide { List categories = new LinkedList<>(); for (ItemGroup category : SlimefunPlugin.getRegistry().getCategories()) { - if (!(category instanceof FlexCategory)) { + if (!(category instanceof FlexItemGroup)) { categories.add(category); } } 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 0872fedde..89164efcd 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 @@ -31,10 +31,10 @@ import io.github.thebusybiscuit.cscorelib2.recipes.MinecraftRecipe; import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; +import io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup; +import io.github.thebusybiscuit.slimefun4.api.items.groups.LockedItemGroup; import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem; -import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory; -import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory; import io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory; import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide; import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation; @@ -117,7 +117,7 @@ public class SurvivalSlimefunGuide implements SlimefunGuideImplementation { for (ItemGroup category : SlimefunPlugin.getRegistry().getCategories()) { try { - if (!category.isHidden(p) && (!(category instanceof FlexCategory) || ((FlexCategory) category).isVisible(p, profile, getMode()))) { + if (!category.isHidden(p) && (!(category instanceof FlexItemGroup) || ((FlexItemGroup) category).isVisible(p, profile, getMode()))) { categories.add(category); } } catch (Exception | LinkageError x) { @@ -193,7 +193,7 @@ public class SurvivalSlimefunGuide implements SlimefunGuideImplementation { } private void displayCategory(ChestMenu menu, Player p, PlayerProfile profile, ItemGroup category, int index) { - if (!(category instanceof LockedCategory) || !isSurvivalMode() || ((LockedCategory) category).hasUnlocked(p, profile)) { + if (!(category instanceof LockedItemGroup) || !isSurvivalMode() || ((LockedItemGroup) category).hasUnlocked(p, profile)) { menu.addItem(index, category.getItem(p)); menu.addMenuClickHandler(index, (pl, slot, item, action) -> { openCategory(profile, category, 1); @@ -209,7 +209,7 @@ public class SurvivalSlimefunGuide implements SlimefunGuideImplementation { lore.add(""); - for (ItemGroup parent : ((LockedCategory) category).getParents()) { + for (ItemGroup parent : ((LockedItemGroup) category).getParents()) { lore.add(parent.getItem(p).getItemMeta().getDisplayName()); } @@ -226,8 +226,8 @@ public class SurvivalSlimefunGuide implements SlimefunGuideImplementation { return; } - if (category instanceof FlexCategory) { - ((FlexCategory) category).open(p, profile, getMode()); + if (category instanceof FlexItemGroup) { + ((FlexItemGroup) category).open(p, profile, getMode()); return; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/EnderTalisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/EnderTalisman.java index 738416b60..d9cc9db32 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/EnderTalisman.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/EnderTalisman.java @@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; -import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory; +import io.github.thebusybiscuit.slimefun4.api.items.groups.LockedItemGroup; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; @@ -21,7 +21,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; */ class EnderTalisman extends Talisman { - private static final LockedCategory ENDER_TALISMANS_CATEGORY = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance(), "ender_talismans"), new CustomItem(SlimefunItems.ENDER_TALISMAN, "&7Talismans - &aTier II"), 3, Talisman.TALISMANS_CATEGORY.getKey()); + private static final LockedItemGroup ENDER_TALISMANS_CATEGORY = new LockedItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "ender_talismans"), new CustomItem(SlimefunItems.ENDER_TALISMAN, "&7Talismans - &aTier II"), 3, Talisman.TALISMANS_CATEGORY.getKey()); @ParametersAreNonnullByDefault public EnderTalisman(Talisman parent, SlimefunItemStack item) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/DefaultCategories.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/DefaultCategories.java index 3c9518594..eb5eee65c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/DefaultCategories.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/DefaultCategories.java @@ -7,8 +7,8 @@ import org.bukkit.NamespacedKey; import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; -import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory; -import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory; +import io.github.thebusybiscuit.slimefun4.api.items.groups.LockedItemGroup; +import io.github.thebusybiscuit.slimefun4.api.items.groups.SeasonalItemGroup; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; import io.github.thebusybiscuit.slimefun4.utils.ChatUtils; @@ -25,8 +25,8 @@ import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; * @author TheBusyBiscuit * * @see ItemGroup - * @see LockedCategory - * @see SeasonalCategory + * @see LockedItemGroup + * @see SeasonalItemGroup * */ class DefaultCategories { @@ -51,16 +51,16 @@ class DefaultCategories { protected final ItemGroup resources = new ItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "resources"), new CustomItem(SlimefunItems.SYNTHETIC_SAPPHIRE, "&7Resources"), 1); // Locked Categories - protected final LockedCategory electricity = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance(), "electricity"), new CustomItem(SlimefunItems.NUCLEAR_REACTOR, "&bEnergy and Electricity"), 4, basicMachines.getKey()); - protected final LockedCategory androids = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance(), "androids"), new CustomItem(SlimefunItems.PROGRAMMABLE_ANDROID, "&cProgrammable Androids"), 4, basicMachines.getKey()); - protected final ItemGroup cargo = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance(), "cargo"), new CustomItem(SlimefunItems.CARGO_MANAGER, "&cCargo Management"), 4, basicMachines.getKey()); - protected final LockedCategory gps = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance(), "gps"), new CustomItem(SlimefunItems.GPS_TRANSMITTER, "&bGPS-based Machines"), 4, basicMachines.getKey()); + protected final LockedItemGroup electricity = new LockedItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "electricity"), new CustomItem(SlimefunItems.NUCLEAR_REACTOR, "&bEnergy and Electricity"), 4, basicMachines.getKey()); + protected final LockedItemGroup androids = new LockedItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "androids"), new CustomItem(SlimefunItems.PROGRAMMABLE_ANDROID, "&cProgrammable Androids"), 4, basicMachines.getKey()); + protected final ItemGroup cargo = new LockedItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "cargo"), new CustomItem(SlimefunItems.CARGO_MANAGER, "&cCargo Management"), 4, basicMachines.getKey()); + protected final LockedItemGroup gps = new LockedItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "gps"), new CustomItem(SlimefunItems.GPS_TRANSMITTER, "&bGPS-based Machines"), 4, basicMachines.getKey()); // Seasonal Categories - protected final SeasonalCategory christmas = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance(), "christmas"), Month.DECEMBER, 1, new CustomItem(SlimefunUtils.getCustomHead("215ba31cde2671b8f176de6a9ffd008035f0590d63ee240be6e8921cd2037a45"), ChatUtils.christmas("Christmas") + " &7(December only)")); - protected final SeasonalCategory valentinesDay = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance(), "valentines_day"), Month.FEBRUARY, 2, new CustomItem(SlimefunUtils.getCustomHead("55d89431d14bfef2060461b4a3565614dc51115c001fae2508e8684bc0ae6a80"), "&dValentine's Day" + " &7(14th February)")); - protected final SeasonalCategory easter = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance(), "easter"), Month.APRIL, 2, new CustomItem(HeadTexture.EASTER_EGG.getAsItemStack(), "&6Easter" + " &7(April)")); - protected final SeasonalCategory birthday = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance(), "birthday"), Month.OCTOBER, 1, new CustomItem(Material.FIREWORK_ROCKET, "&a&lTheBusyBiscuit's Birthday &7(26th October)")); - protected final SeasonalCategory halloween = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance(), "halloween"), Month.OCTOBER, 1, new CustomItem(Material.JACK_O_LANTERN, "&6&lHalloween &7(31st October)")); + protected final SeasonalItemGroup christmas = new SeasonalItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "christmas"), Month.DECEMBER, 1, new CustomItem(SlimefunUtils.getCustomHead("215ba31cde2671b8f176de6a9ffd008035f0590d63ee240be6e8921cd2037a45"), ChatUtils.christmas("Christmas") + " &7(December only)")); + protected final SeasonalItemGroup valentinesDay = new SeasonalItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "valentines_day"), Month.FEBRUARY, 2, new CustomItem(SlimefunUtils.getCustomHead("55d89431d14bfef2060461b4a3565614dc51115c001fae2508e8684bc0ae6a80"), "&dValentine's Day" + " &7(14th February)")); + protected final SeasonalItemGroup easter = new SeasonalItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "easter"), Month.APRIL, 2, new CustomItem(HeadTexture.EASTER_EGG.getAsItemStack(), "&6Easter" + " &7(April)")); + protected final SeasonalItemGroup birthday = new SeasonalItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "birthday"), Month.OCTOBER, 1, new CustomItem(Material.FIREWORK_ROCKET, "&a&lTheBusyBiscuit's Birthday &7(26th October)")); + protected final SeasonalItemGroup halloween = new SeasonalItemGroup(new NamespacedKey(SlimefunPlugin.instance(), "halloween"), Month.OCTOBER, 1, new CustomItem(Material.JACK_O_LANTERN, "&6&lHalloween &7(31st October)")); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestCategories.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestCategories.java index 551fc6834..6710a4e48 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestCategories.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestCategories.java @@ -17,10 +17,10 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; +import io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup; +import io.github.thebusybiscuit.slimefun4.api.items.groups.LockedItemGroup; +import io.github.thebusybiscuit.slimefun4.api.items.groups.SeasonalItemGroup; import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile; -import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory; -import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory; -import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory; import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode; import io.github.thebusybiscuit.slimefun4.core.researching.Research; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin; @@ -130,14 +130,14 @@ class TestCategories { @Test @DisplayName("Test LockedCategory parental locking") void testLockedCategoriesParents() { - Assertions.assertThrows(IllegalArgumentException.class, () -> new LockedCategory(new NamespacedKey(plugin, "locked"), new CustomItem(Material.GOLD_NUGGET, "&6Locked Test"), (NamespacedKey) null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> new LockedItemGroup(new NamespacedKey(plugin, "locked"), new CustomItem(Material.GOLD_NUGGET, "&6Locked Test"), (NamespacedKey) null)); ItemGroup category = new ItemGroup(new NamespacedKey(plugin, "unlocked"), new CustomItem(Material.EMERALD, "&5I am SHERlocked")); category.register(plugin); ItemGroup unregistered = new ItemGroup(new NamespacedKey(plugin, "unregistered"), new CustomItem(Material.EMERALD, "&5I am unregistered")); - LockedCategory locked = new LockedCategory(new NamespacedKey(plugin, "locked"), new CustomItem(Material.GOLD_NUGGET, "&6Locked Test"), category.getKey(), unregistered.getKey()); + LockedItemGroup locked = new LockedItemGroup(new NamespacedKey(plugin, "locked"), new CustomItem(Material.GOLD_NUGGET, "&6Locked Test"), category.getKey(), unregistered.getKey()); locked.register(plugin); Assertions.assertTrue(locked.getParents().contains(category)); @@ -159,12 +159,12 @@ class TestCategories { Player player = server.addPlayer(); PlayerProfile profile = TestUtilities.awaitProfile(player); - Assertions.assertThrows(IllegalArgumentException.class, () -> new LockedCategory(new NamespacedKey(plugin, "locked"), new CustomItem(Material.GOLD_NUGGET, "&6Locked Test"), (NamespacedKey) null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> new LockedItemGroup(new NamespacedKey(plugin, "locked"), new CustomItem(Material.GOLD_NUGGET, "&6Locked Test"), (NamespacedKey) null)); ItemGroup category = new ItemGroup(new NamespacedKey(plugin, "parent"), new CustomItem(Material.EMERALD, "&5I am SHERlocked")); category.register(plugin); - LockedCategory locked = new LockedCategory(new NamespacedKey(plugin, "locked2"), new CustomItem(Material.GOLD_NUGGET, "&6Locked Test"), category.getKey()); + LockedItemGroup locked = new LockedItemGroup(new NamespacedKey(plugin, "locked2"), new CustomItem(Material.GOLD_NUGGET, "&6Locked Test"), category.getKey()); locked.register(plugin); // No Items, so it should be unlocked @@ -192,7 +192,7 @@ class TestCategories { void testSeasonalCategories() { // Category with current Month Month month = LocalDate.now().getMonth(); - SeasonalCategory category = new SeasonalCategory(new NamespacedKey(plugin, "seasonal"), month, 1, new CustomItem(Material.NETHER_STAR, "&cSeasonal Test")); + SeasonalItemGroup category = new SeasonalItemGroup(new NamespacedKey(plugin, "seasonal"), month, 1, new CustomItem(Material.NETHER_STAR, "&cSeasonal Test")); SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "SEASONAL_ITEM", new CustomItem(Material.NETHER_STAR, "&dSeasonal Test Star")); item.setCategory(category); item.register(plugin); @@ -204,14 +204,14 @@ class TestCategories { Assertions.assertFalse(category.isHidden(player)); // Category with future Month - SeasonalCategory category2 = new SeasonalCategory(category.getKey(), month.plus(6), 1, new CustomItem(Material.MILK_BUCKET, "&dSeasonal Test")); + SeasonalItemGroup category2 = new SeasonalItemGroup(category.getKey(), month.plus(6), 1, new CustomItem(Material.MILK_BUCKET, "&dSeasonal Test")); Assertions.assertTrue(category2.isHidden(player)); } @Test @DisplayName("Test the FlexCategory") void testFlexCategory() { - FlexCategory category = new FlexCategory(new NamespacedKey(plugin, "flex"), new CustomItem(Material.REDSTONE, "&4Weird flex but ok")) { + FlexItemGroup category = new FlexItemGroup(new NamespacedKey(plugin, "flex"), new CustomItem(Material.REDSTONE, "&4Weird flex but ok")) { @Override public void open(Player p, PlayerProfile profile, SlimefunGuideMode layout) {