Skip to content

Commit 6951251

Browse files
Some additional cleanup
1 parent 9451e25 commit 6951251

28 files changed

Lines changed: 147 additions & 148 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ This RC brings a lot of breaking changes to the API. For more info on why we did
7272
* Fixed #3225
7373
* Fixed #3206
7474
* Fixed androids not respecting Worldborders
75+
* Fixed Ender Lumps showing an incorrect recipe in the guide
7576

7677
## Release Candidate 26 (20 Jul 2021)
7778
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#26

src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemGroup.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
2828

2929
/**
30-
* Represents a category, which structure multiple {@link SlimefunItem} in the {@link SlimefunGuide}.
30+
* Represents an item group, which structure
31+
* multiple {@link SlimefunItem} in the {@link SlimefunGuide}.
3132
*
3233
* @author TheBusyBiscuit
3334
*
@@ -74,8 +75,8 @@ public ItemGroup(NamespacedKey key, ItemStack item) {
7475
*/
7576
@ParametersAreNonnullByDefault
7677
public ItemGroup(NamespacedKey key, ItemStack item, int tier) {
77-
Validate.notNull(key, "A Category's NamespacedKey must not be null!");
78-
Validate.notNull(item, "A Category's ItemStack must not be null!");
78+
Validate.notNull(key, "An item group's NamespacedKey must not be null!");
79+
Validate.notNull(item, "An item group's ItemStack must not be null!");
7980

8081
this.item = item;
8182
this.key = key;
@@ -95,9 +96,10 @@ public final NamespacedKey getKey() {
9596
}
9697

9798
/**
98-
* Registers this category.
99+
* Registers this {@link ItemGroup}.
99100
* <p>
100-
* By default, a category is automatically registered when a {@link SlimefunItem} was added to it.
101+
* By default, an {@link ItemGroup} is automatically registered when
102+
* a {@link SlimefunItem} was added to it.
101103
*
102104
* @param addon
103105
* The {@link SlimefunAddon} that wants to register this {@link ItemGroup}
@@ -106,7 +108,7 @@ public void register(@Nonnull SlimefunAddon addon) {
106108
Validate.notNull(addon, "The Addon cannot be null");
107109

108110
if (isRegistered()) {
109-
throw new UnsupportedOperationException("This Category has already been registered!");
111+
throw new UnsupportedOperationException("This ItemGroup has already been registered!");
110112
}
111113

112114
this.addon = addon;
@@ -135,7 +137,7 @@ public int getTier() {
135137
public void setTier(int tier) {
136138
this.tier = tier;
137139

138-
// Refresh Category order if already registered.
140+
// Refresh ItemGroup order if already registered.
139141
if (isRegistered()) {
140142
sortCategoriesByTier();
141143
}
@@ -167,7 +169,7 @@ public final SlimefunAddon getAddon() {
167169
* the {@link SlimefunItem} that should be added to this {@link ItemGroup}
168170
*/
169171
public void add(@Nonnull SlimefunItem item) {
170-
Validate.notNull(item, "Cannot add null Items to a Category!");
172+
Validate.notNull(item, "Cannot add null Items to an ItemGroup!");
171173

172174
if (items.contains(item)) {
173175
// Ignore duplicate entries
@@ -184,7 +186,7 @@ public void add(@Nonnull SlimefunItem item) {
184186
* the {@link SlimefunItem} that should be removed from this {@link ItemGroup}
185187
*/
186188
public void remove(@Nonnull SlimefunItem item) {
187-
Validate.notNull(item, "Cannot remove null from a Category!");
189+
Validate.notNull(item, "Cannot remove null from an ItemGroup!");
188190
items.remove(item);
189191
}
190192

@@ -250,7 +252,7 @@ public String getDisplayName(@Nonnull Player p) {
250252
/**
251253
* Returns all instances of {@link SlimefunItem} bound to this {@link ItemGroup}.
252254
*
253-
* @return the list of SlimefunItems bound to this category
255+
* @return the list of SlimefunItems bound to this {@link ItemGroup}
254256
*/
255257
@Nonnull
256258
public List<SlimefunItem> getItems() {

src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/LockedItemGroup.java

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
2222

2323
/**
24-
* Represents a {@link ItemGroup} that cannot be opened until the parent category/categories
24+
* Represents a {@link ItemGroup} that cannot be opened until the parent group(s)
2525
* are fully unlocked.
2626
* <p>
2727
* See {@link ItemGroup} for the complete documentation.
@@ -38,15 +38,15 @@ public class LockedItemGroup extends ItemGroup {
3838
private final Set<ItemGroup> parents = new HashSet<>();
3939

4040
/**
41-
* The basic constructor for a LockedCategory.
41+
* The basic constructor for a LockedItemGroup.
4242
* Like {@link ItemGroup}, the default tier is automatically set to 3.
4343
*
4444
* @param key
45-
* A unique identifier for this category
45+
* A unique identifier for this group
4646
* @param item
47-
* The display item for this category
47+
* The display item for this group
4848
* @param parents
49-
* The parent categories for this category
49+
* The parent categories for this group
5050
*
5151
*/
5252
@ParametersAreNonnullByDefault
@@ -55,22 +55,22 @@ public LockedItemGroup(NamespacedKey key, ItemStack item, NamespacedKey... paren
5555
}
5656

5757
/**
58-
* The constructor for a LockedCategory.
58+
* The constructor for a LockedItemGroup.
5959
*
6060
* @param key
61-
* A unique identifier for this category
61+
* A unique identifier for this group
6262
* @param item
63-
* The display item for this category
63+
* The display item for this group
6464
* @param tier
65-
* The tier of this category
65+
* The tier of this group
6666
* @param parents
67-
* The parent categories for this category
67+
* The parent categories for this group
6868
*
6969
*/
7070
@ParametersAreNonnullByDefault
7171
public LockedItemGroup(NamespacedKey key, ItemStack item, int tier, NamespacedKey... parents) {
7272
super(key, item, tier);
73-
Validate.noNullElements(parents, "A LockedCategory must not have any 'null' parents!");
73+
Validate.noNullElements(parents, "A LockedItemGroup must not have any 'null' parents!");
7474

7575
this.keys = parents;
7676
}
@@ -94,51 +94,50 @@ public void register(@Nonnull SlimefunAddon addon) {
9494
}
9595

9696
for (NamespacedKey key : namespacedKeys) {
97-
Slimefun.logger().log(Level.INFO, "Parent \"{0}\" for Category \"{1}\" was not found, probably just disabled.", new Object[] { key, getKey() });
97+
Slimefun.logger().log(Level.INFO, "Parent \"{0}\" for LockedItemGroup \"{1}\" was not found, probably just disabled.", new Object[] { key, getKey() });
9898
}
9999
}
100100

101101
/**
102-
* Gets the list of parent categories for this {@link LockedItemGroup}.
102+
* Gets the list of parent item groups for this {@link LockedItemGroup}.
103103
*
104-
* @return the list of parent categories
104+
* @return the list of parent item groups
105105
*
106106
* @see #addParent(ItemGroup)
107107
* @see #removeParent(ItemGroup)
108108
*/
109-
@Nonnull
110-
public Set<ItemGroup> getParents() {
109+
public @Nonnull Set<ItemGroup> getParents() {
111110
return parents;
112111
}
113112

114113
/**
115114
* Adds a parent {@link ItemGroup} to this {@link LockedItemGroup}.
116115
*
117-
* @param category
116+
* @param group
118117
* The {@link ItemGroup} to add as a parent
119118
*
120119
* @see #getParents()
121120
* @see #removeParent(ItemGroup)
122121
*/
123-
public void addParent(ItemGroup category) {
124-
if (category == this || category == null) {
125-
throw new IllegalArgumentException("Category '" + item.getItemMeta().getDisplayName() + "' cannot be a parent of itself or have a 'null' parent.");
122+
public void addParent(ItemGroup group) {
123+
if (group == this || group == null) {
124+
throw new IllegalArgumentException("ItemGroup '" + item.getItemMeta().getDisplayName() + "' cannot be a parent of itself or have a 'null' parent.");
126125
}
127126

128-
parents.add(category);
127+
parents.add(group);
129128
}
130129

131130
/**
132131
* Removes a {@link ItemGroup} from the parents of this {@link LockedItemGroup}.
133132
*
134-
* @param category
133+
* @param group
135134
* The {@link ItemGroup} to remove from the parents of this {@link LockedItemGroup}
136135
*
137136
* @see #getParents()
138137
* @see #addParent(ItemGroup)
139138
*/
140-
public void removeParent(@Nonnull ItemGroup category) {
141-
parents.remove(category);
139+
public void removeParent(@Nonnull ItemGroup group) {
140+
parents.remove(group);
142141
}
143142

144143
/**
@@ -155,8 +154,8 @@ public boolean hasUnlocked(@Nonnull Player p, @Nonnull PlayerProfile profile) {
155154
Validate.notNull(p, "The player cannot be null!");
156155
Validate.notNull(profile, "The Profile cannot be null!");
157156

158-
for (ItemGroup category : parents) {
159-
for (SlimefunItem item : category.getItems()) {
157+
for (ItemGroup parent : parents) {
158+
for (SlimefunItem item : parent.getItems()) {
160159
// Check if the Player has researched every item (if the item is enabled)
161160
if (!item.isDisabledIn(p.getWorld()) && item.hasResearch() && !profile.hasUnlocked(item.getResearch())) {
162161
return false;

src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/NestedItemGroup.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,25 @@ public NestedItemGroup(NamespacedKey key, ItemStack item, int tier) {
4141
/**
4242
* This will add the given {@link SubItemGroup} to this {@link NestedItemGroup}.
4343
*
44-
* @param category
44+
* @param group
4545
* The {@link SubItemGroup} to add.
4646
*/
47-
public void addSubGroup(@Nonnull SubItemGroup category) {
48-
Validate.notNull(category, "The sub item group cannot be null!");
47+
public void addSubGroup(@Nonnull SubItemGroup group) {
48+
Validate.notNull(group, "The sub item group cannot be null!");
4949

50-
subGroups.add(category);
50+
subGroups.add(group);
5151
}
5252

5353
/**
5454
* This will remove the given {@link SubItemGroup} from this {@link NestedItemGroup} (if present).
5555
*
56-
* @param category
56+
* @param group
5757
* The {@link SubItemGroup} to remove.
5858
*/
59-
public void removeSubGroup(@Nonnull SubItemGroup category) {
60-
Validate.notNull(category, "The sub item group cannot be null!");
59+
public void removeSubGroup(@Nonnull SubItemGroup group) {
60+
Validate.notNull(group, "The sub item group cannot be null!");
6161

62-
subGroups.remove(category);
62+
subGroups.remove(group);
6363
}
6464

6565
@Override

src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SeasonalItemGroup.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ public class SeasonalItemGroup extends ItemGroup {
3232
* @param key
3333
* The {@link NamespacedKey} that is used to identify this {@link ItemGroup}
3434
* @param month
35-
* The month when the category should be displayed (from 1 = January ; to 12 = December)
35+
* The month when the {@link ItemGroup} should be displayed (from 1 = January ; to 12 = December)
3636
* @param tier
37-
* The tier of this category
37+
* The tier of this {@link ItemGroup}
3838
* @param item
39-
* The display item for this category
39+
* The display item for this {@link ItemGroup}
4040
*/
4141
@ParametersAreNonnullByDefault
4242
public SeasonalItemGroup(NamespacedKey key, Month month, int tier, ItemStack item) {
@@ -51,8 +51,7 @@ public SeasonalItemGroup(NamespacedKey key, Month month, int tier, ItemStack ite
5151
*
5252
* @return the {@link Month} in which this {@link SeasonalItemGroup} appears
5353
*/
54-
@Nonnull
55-
public Month getMonth() {
54+
public @Nonnull Month getMonth() {
5655
return month;
5756
}
5857

src/main/java/io/github/thebusybiscuit/slimefun4/api/items/groups/SubItemGroup.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
public class SubItemGroup extends ItemGroup {
2424

25-
private final NestedItemGroup multiCategory;
25+
private final NestedItemGroup parentItemGroup;
2626

2727
@ParametersAreNonnullByDefault
2828
public SubItemGroup(NamespacedKey key, NestedItemGroup parent, ItemStack item) {
@@ -33,9 +33,9 @@ public SubItemGroup(NamespacedKey key, NestedItemGroup parent, ItemStack item) {
3333
public SubItemGroup(NamespacedKey key, NestedItemGroup parent, ItemStack item, int tier) {
3434
super(key, item, tier);
3535

36-
Validate.notNull(parent, "The parent category cannot be null");
36+
Validate.notNull(parent, "The parent group cannot be null");
3737

38-
multiCategory = parent;
38+
parentItemGroup = parent;
3939
parent.addSubGroup(this);
4040
}
4141

@@ -48,17 +48,16 @@ public final boolean isHidden(@Nonnull Player p) {
4848
return true;
4949
}
5050

51-
@Nonnull
52-
public final NestedItemGroup getParent() {
53-
return multiCategory;
51+
public final @Nonnull NestedItemGroup getParent() {
52+
return parentItemGroup;
5453
}
5554

5655
@Override
5756
public final void register(@Nonnull SlimefunAddon addon) {
5857
super.register(addon);
5958

60-
if (!multiCategory.isRegistered()) {
61-
multiCategory.register(addon);
59+
if (!parentItemGroup.isRegistered()) {
60+
parentItemGroup.register(addon);
6261
}
6362
}
6463

src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/Research.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public Research(@Nonnull NamespacedKey key, int id, @Nonnull String defaultName,
7676
}
7777

7878
@Override
79-
public NamespacedKey getKey() {
79+
public @Nonnull NamespacedKey getKey() {
8080
return key;
8181
}
8282

@@ -114,8 +114,7 @@ public int getID() {
114114
*
115115
* @return The localized Name of this {@link Research}.
116116
*/
117-
@Nonnull
118-
public String getName(@Nonnull Player p) {
117+
public @Nonnull String getName(@Nonnull Player p) {
119118
String localized = Slimefun.getLocalization().getResearchName(p, key);
120119
return localized != null ? localized : name;
121120
}

src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
* This package holds everything connected to the {@link io.github.thebusybiscuit.slimefun4.core.researching.Research}
33
* class.
44
*/
5-
package io.github.thebusybiscuit.slimefun4.core.researching;
5+
package io.github.thebusybiscuit.slimefun4.api.researches;

0 commit comments

Comments
 (0)