consumer) {
- super(getSkull(id, texture), consumer);
+ this(id, getSkull(id, texture), consumer);
this.texture = getTexture(id, texture);
-
- setItemId(id);
- }
-
- private void setItemId(@Nonnull String id) {
- Validate.notNull(id, "The Item id must never be null!");
- Validate.isTrue(id.equals(id.toUpperCase(Locale.ROOT)), "Slimefun Item Ids must be uppercase! (e.g. 'MY_ITEM_ID')");
-
- if (SlimefunPlugin.instance() == null) {
- throw new PrematureCodeException("A SlimefunItemStack must never be be created before your Plugin was enabled.");
- }
-
- this.id = id;
-
- ItemMeta meta = getItemMeta();
-
- SlimefunPlugin.getItemDataService().setItemData(meta, id);
- SlimefunPlugin.getItemTextureService().setTexture(meta, id);
-
- setItemMeta(meta);
}
/**
@@ -183,7 +212,7 @@ private void setItemId(@Nonnull String id) {
* @return The {@link SlimefunItem} for this {@link SlimefunItemStack}, null if not found.
*/
public @Nullable SlimefunItem getItem() {
- return SlimefunItem.getByID(id);
+ return SlimefunItem.getById(id);
}
/**
@@ -206,14 +235,14 @@ private void setItemId(@Nonnull String id) {
return type.isInstance(item) ? type.cast(item) : null;
}
- public @Nonnull ImmutableItemMeta getImmutableMeta() {
- return immutableMeta;
+ public @Nonnull ItemMetaSnapshot getItemMetaSnapshot() {
+ return itemMetaSnapshot;
}
@Override
public boolean setItemMeta(ItemMeta meta) {
validate();
- immutableMeta = new ImmutableItemMeta(meta);
+ itemMetaSnapshot = new ItemMetaSnapshot(meta);
return super.setItemMeta(meta);
}
@@ -245,20 +274,21 @@ public void lock() {
}
public @Nullable String getDisplayName() {
- if (immutableMeta == null) {
+ if (itemMetaSnapshot == null) {
// Just to be extra safe
return null;
}
- return immutableMeta.getDisplayName().orElse(null);
+ return itemMetaSnapshot.getDisplayName().orElse(null);
}
private static @Nonnull ItemStack getSkull(@Nonnull String id, @Nonnull String texture) {
- if (SlimefunPlugin.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) {
+ if (Slimefun.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) {
return new ItemStack(Material.PLAYER_HEAD);
}
- return SkullItem.fromBase64(getTexture(id, texture));
+ PlayerSkin skin = PlayerSkin.fromBase64(getTexture(id, texture));
+ return PlayerHead.getItemStack(skin);
}
private static @Nonnull String getTexture(@Nonnull String id, @Nonnull String texture) {
@@ -267,7 +297,7 @@ public void lock() {
if (texture.startsWith("ey")) {
return texture;
- } else if (PatternUtils.HEXADECIMAL.matcher(texture).matches()) {
+ } else if (CommonPatterns.HEXADECIMAL.matcher(texture).matches()) {
String value = "{\"textures\":{\"SKIN\":{\"url\":\"http://textures.minecraft.net/texture/" + texture + "\"}}}";
return Base64.getEncoder().encodeToString(value.getBytes(StandardCharsets.UTF_8));
} else {
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 77%
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 39f6800220..8f518660e8 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;
@@ -9,14 +9,14 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
- * A {@link FlexCategory} is a {@link Category} 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 @@
* @author TheBusyBiscuit
*
*/
-public abstract class FlexCategory extends Category {
+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 @@ protected FlexCategory(NamespacedKey key, ItemStack item, int tier) {
* @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 69%
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 d5334e011b..a85553d5cc 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;
@@ -15,31 +15,31 @@
import org.bukkit.inventory.ItemStack;
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.player.PlayerProfile;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
- * Represents a {@link Category} that cannot be opened until the parent category/categories
+ * Represents a {@link ItemGroup} that cannot be opened until the parent category/categories
* are fully unlocked.
*
- * See {@link Category} for the complete documentation.
+ * See {@link ItemGroup} for the complete documentation.
*
* @author TheBusyBiscuit
*
- * @see Category
- * @see SeasonalCategory
+ * @see ItemGroup
+ * @see SeasonalItemGroup
*
*/
-public class LockedCategory extends Category {
+public class LockedItemGroup extends ItemGroup {
private final NamespacedKey[] keys;
- private final Set parents = new HashSet<>();
+ private final Set parents = new HashSet<>();
/**
* The basic constructor for a LockedCategory.
- * Like {@link Category}, the default tier is automatically set to 3.
+ * Like {@link ItemGroup}, the default tier is automatically set to 3.
*
* @param key
* A unique identifier for this category
@@ -50,7 +50,7 @@ public class LockedCategory extends Category {
*
*/
@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 LockedCategory(NamespacedKey key, ItemStack item, NamespacedKey... parent
*
*/
@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!");
@@ -87,40 +87,40 @@ public void register(@Nonnull SlimefunAddon addon) {
}
}
- for (Category category : SlimefunPlugin.getRegistry().getCategories()) {
+ for (ItemGroup category : Slimefun.getRegistry().getAllItemGroups()) {
if (namespacedKeys.remove(category.getKey())) {
addParent(category);
}
}
for (NamespacedKey key : namespacedKeys) {
- SlimefunPlugin.logger().log(Level.INFO, "Parent \"{0}\" for Category \"{1}\" was not found, probably just disabled.", new Object[] { key, getKey() });
+ Slimefun.logger().log(Level.INFO, "Parent \"{0}\" for Category \"{1}\" was not found, probably just disabled.", new Object[] { key, getKey() });
}
}
/**
- * 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
*
- * @see #addParent(Category)
- * @see #removeParent(Category)
+ * @see #addParent(ItemGroup)
+ * @see #removeParent(ItemGroup)
*/
@Nonnull
- public Set getParents() {
+ public Set getParents() {
return parents;
}
/**
- * Adds a parent {@link Category} to this {@link LockedCategory}.
+ * Adds a parent {@link ItemGroup} to this {@link LockedItemGroup}.
*
* @param category
- * The {@link Category} to add as a parent
+ * The {@link ItemGroup} to add as a parent
*
* @see #getParents()
- * @see #removeParent(Category)
+ * @see #removeParent(ItemGroup)
*/
- public void addParent(Category category) {
+ public void addParent(ItemGroup category) {
if (category == this || category == null) {
throw new IllegalArgumentException("Category '" + item.getItemMeta().getDisplayName() + "' cannot be a parent of itself or have a 'null' parent.");
}
@@ -129,15 +129,15 @@ public void addParent(Category category) {
}
/**
- * Removes a {@link Category} from the parents of this {@link LockedCategory}.
+ * Removes a {@link ItemGroup} from the parents of this {@link LockedItemGroup}.
*
* @param category
- * The {@link Category} 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(Category)
+ * @see #addParent(ItemGroup)
*/
- public void removeParent(@Nonnull Category category) {
+ public void removeParent(@Nonnull ItemGroup category) {
parents.remove(category);
}
@@ -155,7 +155,7 @@ public boolean hasUnlocked(@Nonnull Player p, @Nonnull PlayerProfile profile) {
Validate.notNull(p, "The player cannot be null!");
Validate.notNull(profile, "The Profile cannot be null!");
- for (Category category : parents) {
+ for (ItemGroup category : parents) {
for (SlimefunItem item : category.getItems()) {
// Check if the Player has researched every item (if the item is enabled)
if (!item.isDisabledIn(p.getWorld()) && item.hasResearch() && !profile.hasUnlocked(item.getResearch())) {
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 65%
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 2de0dfe6ad..cbcdcb0127 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;
@@ -12,53 +12,54 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.bakedlibs.dough.items.CustomItemStack;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
import io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
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
@@ -81,14 +82,14 @@ private void openGuide(Player p, PlayerProfile profile, SlimefunGuideMode mode,
history.add(this, page);
}
- ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "guide.title.main"));
- SurvivalSlimefunGuide guide = (SurvivalSlimefunGuide) SlimefunPlugin.getRegistry().getSlimefunGuide(mode);
+ ChestMenu menu = new ChestMenu(Slimefun.getLocalization().getMessage(p, "guide.title.main"));
+ SurvivalSlimefunGuide guide = (SurvivalSlimefunGuide) Slimefun.getRegistry().getSlimefunGuide(mode);
menu.setEmptySlotsClickable(false);
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), guide.getSound(), 1, 1));
guide.createHeader(p, profile, menu);
- menu.addItem(1, new CustomItem(ChestMenuUtils.getBackButton(p, "", ChatColor.GRAY + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.guide"))));
+ menu.addItem(1, new CustomItemStack(ChestMenuUtils.getBackButton(p, "", ChatColor.GRAY + Slimefun.getLocalization().getMessage(p, "guide.back.guide"))));
menu.addMenuClickHandler(1, (pl, s, is, action) -> {
SlimefunGuide.openMainMenu(profile, mode, history.getMainMenuPage());
return false;
@@ -96,12 +97,12 @@ private void openGuide(Player p, PlayerProfile profile, SlimefunGuideMode mode,
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 @@ private void openGuide(Player p, PlayerProfile profile, SlimefunGuideMode mode,
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 69%
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 4e0920d181..a4859a1d07 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;
@@ -11,26 +11,26 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import me.mrCookieSlime.Slimefun.Objects.Category;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
/**
- * Represents a {@link Category} that is only displayed in the Guide during
+ * Represents a {@link ItemGroup} that is only displayed in the Guide during
* a specified {@link Month}.
*
* @author TheBusyBiscuit
*
- * @see Category
- * @see LockedCategory
+ * @see ItemGroup
+ * @see LockedItemGroup
*/
-public class SeasonalCategory extends Category {
+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 Category}
+ * The {@link NamespacedKey} that is used to identify this {@link ItemGroup}
* @param month
* The month when the category should be displayed (from 1 = January ; to 12 = December)
* @param tier
@@ -39,7 +39,7 @@ public class SeasonalCategory extends Category {
* 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 SeasonalCategory(NamespacedKey key, Month month, int tier, ItemStack item
}
/**
- * 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 64%
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 8da6cbafe5..b8a3da78bd 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;
@@ -9,34 +9,34 @@
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
-import me.mrCookieSlime.Slimefun.Objects.Category;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
/**
- * The {@link SubCategory} is a child {@link Category} 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 Category {
+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 final boolean isHidden(@Nonnull Player p) {
}
@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 0000000000..e95ee138f5
--- /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/api/items/settings/DoubleRangeSetting.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/settings/DoubleRangeSetting.java
index f337db5103..3caeb974b3 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
@@ -6,7 +6,7 @@
import org.apache.commons.lang.Validate;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* This variation of {@link ItemSetting} allows you to define an {@link Double} range
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 dbb67b0f3b..a588a02abd 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
@@ -7,7 +7,7 @@
import javax.annotation.ParametersAreNonnullByDefault;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* This variation of {@link ItemSetting} allows you to allow {@link Enum} constants to be
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 b78722d354..58e5dc34bf 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
@@ -6,7 +6,7 @@
import org.apache.commons.lang.Validate;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* This variation of {@link ItemSetting} allows you to define an {@link Integer} range
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 6e4170d140..b518e351ac 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
@@ -10,7 +10,7 @@
import org.bukkit.Tag;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* This variation of {@link ItemSetting} allows you to define a default {@link Tag}.
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 2e5ed68df1..49fb36520e 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
@@ -15,9 +15,9 @@
import org.bukkit.Particle;
import org.bukkit.World;
-import io.github.thebusybiscuit.cscorelib2.blocks.BlockPosition;
+import io.github.bakedlibs.dough.blocks.BlockPosition;
import io.github.thebusybiscuit.slimefun4.core.networks.NetworkManager;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.NetworkListener;
/**
@@ -248,7 +248,7 @@ private void discoverNeighbors(@Nonnull Location l) {
public void display() {
if (manager.isVisualizerEnabled()) {
// TODO: Make Color configurable / network-dependent
- SlimefunPlugin.runSync(new NetworkVisualizer(this, Color.BLUE));
+ Slimefun.runSync(new NetworkVisualizer(this, Color.BLUE));
}
}
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 336a6bfbe2..5d942114f7 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
@@ -9,8 +9,8 @@
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.bakedlibs.dough.config.Config;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.SlimefunBackpack;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener;
@@ -125,7 +125,7 @@ public Inventory getInventory() {
* The players who this Backpack will be shown to
*/
public void open(Player... players) {
- SlimefunPlugin.runSync(() -> {
+ Slimefun.runSync(() -> {
for (Player p : players) {
p.openInventory(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 dcb7387c66..49e3748518 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
@@ -30,19 +30,19 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
+import io.github.bakedlibs.dough.common.ChatColors;
+import io.github.bakedlibs.dough.common.CommonPatterns;
+import io.github.bakedlibs.dough.config.Config;
import io.github.thebusybiscuit.slimefun4.api.events.AsyncProfileLoadEvent;
import io.github.thebusybiscuit.slimefun4.api.gps.Waypoint;
import io.github.thebusybiscuit.slimefun4.api.items.HashedArmorpiece;
+import io.github.thebusybiscuit.slimefun4.api.researches.Research;
import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType;
import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectiveArmor;
import io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory;
-import io.github.thebusybiscuit.slimefun4.core.researching.Research;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
-import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
/**
* A class that can store a Player's {@link Research} progress for caching purposes.
@@ -85,7 +85,7 @@ protected PlayerProfile(@Nonnull OfflinePlayer p) {
}
private void loadProfileData() {
- for (Research research : SlimefunPlugin.getRegistry().getResearches()) {
+ for (Research research : Slimefun.getRegistry().getResearches()) {
if (configFile.contains("researches." + research.getID())) {
researches.add(research);
}
@@ -99,7 +99,7 @@ private void loadProfileData() {
waypoints.add(new Waypoint(this, key, loc, waypointName));
}
} catch (Exception x) {
- SlimefunPlugin.logger().log(Level.WARNING, x, () -> "Could not load Waypoint \"" + key + "\" for Player \"" + name + '"');
+ Slimefun.logger().log(Level.WARNING, x, () -> "Could not load Waypoint \"" + key + "\" for Player \"" + name + '"');
}
}
}
@@ -307,9 +307,9 @@ public final void markDirty() {
}
public @Nonnull String getTitle() {
- List titles = SlimefunPlugin.getRegistry().getResearchRanks();
+ List titles = Slimefun.getRegistry().getResearchRanks();
- float fraction = (float) researches.size() / SlimefunPlugin.getRegistry().getResearches().size();
+ float fraction = (float) researches.size() / Slimefun.getRegistry().getResearches().size();
int index = (int) (fraction * (titles.size() - 1));
return titles.get(index);
@@ -318,7 +318,7 @@ public final void markDirty() {
public void sendStats(@Nonnull CommandSender sender) {
Set unlockedResearches = getResearches();
int levels = unlockedResearches.stream().mapToInt(Research::getCost).sum();
- int allResearches = SlimefunPlugin.getRegistry().getResearches().size();
+ int allResearches = Slimefun.getRegistry().getResearches().size();
float progress = Math.round(((unlockedResearches.size() * 100.0F) / allResearches) * 100.0F) / 100.0F;
@@ -368,18 +368,18 @@ public static boolean get(@Nonnull OfflinePlayer p, @Nonnull Consumer {
+ Bukkit.getScheduler().runTaskAsynchronously(Slimefun.instance(), () -> {
AsyncProfileLoadEvent event = new AsyncProfileLoadEvent(new PlayerProfile(p));
Bukkit.getPluginManager().callEvent(event);
- SlimefunPlugin.getRegistry().getPlayerProfiles().put(uuid, event.getProfile());
+ Slimefun.getRegistry().getPlayerProfiles().put(uuid, event.getProfile());
callback.accept(event.getProfile());
});
@@ -398,11 +398,11 @@ public static boolean get(@Nonnull OfflinePlayer p, @Nonnull Consumer {
+ Bukkit.getScheduler().runTaskAsynchronously(Slimefun.instance(), () -> {
PlayerProfile pp = new PlayerProfile(p);
- SlimefunPlugin.getRegistry().getPlayerProfiles().put(p.getUniqueId(), pp);
+ Slimefun.getRegistry().getPlayerProfiles().put(p.getUniqueId(), pp);
});
return false;
@@ -422,11 +422,11 @@ public static boolean request(@Nonnull OfflinePlayer p) {
* @return An {@link Optional} describing the result
*/
public static @Nonnull Optional find(@Nonnull OfflinePlayer p) {
- return Optional.ofNullable(SlimefunPlugin.getRegistry().getPlayerProfiles().get(p.getUniqueId()));
+ return Optional.ofNullable(Slimefun.getRegistry().getPlayerProfiles().get(p.getUniqueId()));
}
public static @Nonnull Iterator iterator() {
- return SlimefunPlugin.getRegistry().getPlayerProfiles().values().iterator();
+ return Slimefun.getRegistry().getPlayerProfiles().values().iterator();
}
public static void getBackpack(@Nullable ItemStack item, @Nonnull Consumer callback) {
@@ -439,9 +439,9 @@ public static void getBackpack(@Nullable ItemStack item, @Nonnull Consumer optional = PersistentDataAPI.getOptionalString(p, getKey());
if (optional.isPresent()) {
- String[] data = PatternUtils.SEMICOLON.split(optional.get());
+ String[] data = CommonPatterns.SEMICOLON.split(optional.get());
long timestamp = Long.parseLong(data[1]);
if (timestamp == 0 || timestamp >= System.currentTimeMillis()) {
@@ -123,7 +123,7 @@ public boolean isPresent(@Nonnull Player p) {
Optional optional = PersistentDataAPI.getOptionalString(p, getKey());
if (optional.isPresent()) {
- String[] data = PatternUtils.SEMICOLON.split(optional.get());
+ String[] data = CommonPatterns.SEMICOLON.split(optional.get());
return OptionalInt.of(Integer.parseInt(data[0]));
} else {
return OptionalInt.empty();
diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Lists/RecipeType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java
similarity index 64%
rename from src/main/java/me/mrCookieSlime/Slimefun/Lists/RecipeType.java
rename to src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java
index 3b00ee351a..828c78ddb3 100644
--- a/src/main/java/me/mrCookieSlime/Slimefun/Lists/RecipeType.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java
@@ -1,4 +1,4 @@
-package me.mrCookieSlime.Slimefun.Lists;
+package io.github.thebusybiscuit.slimefun4.api.recipes;
import java.util.ArrayList;
import java.util.Arrays;
@@ -21,50 +21,50 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
-import io.github.thebusybiscuit.cscorelib2.recipes.MinecraftRecipe;
+import io.github.bakedlibs.dough.items.CustomItemStack;
+import io.github.bakedlibs.dough.recipes.MinecraftRecipe;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AltarRecipe;
import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientAltar;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-// This class will be reworked and relocated in the "Recipe Rewrite"
+// TODO: Remove this class and rewrite the recipe system
public class RecipeType implements Keyed {
- public static final RecipeType MULTIBLOCK = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "multiblock"), new CustomItem(Material.BRICKS, "&bMultiBlock", "", "&a&oBuild it in the World"));
- public static final RecipeType ARMOR_FORGE = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "armor_forge"), SlimefunItems.ARMOR_FORGE, "", "&a&oCraft it in an Armor Forge");
- public static final RecipeType GRIND_STONE = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "grind_stone"), SlimefunItems.GRIND_STONE, "", "&a&oGrind it using the Grind Stone");
- public static final RecipeType SMELTERY = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "smeltery"), SlimefunItems.SMELTERY, "", "&a&oSmelt it using a Smeltery");
- public static final RecipeType ORE_CRUSHER = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "ore_crusher"), SlimefunItems.ORE_CRUSHER, "", "&a&oCrush it using the Ore Crusher");
- public static final RecipeType GOLD_PAN = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "gold_pan"), SlimefunItems.GOLD_PAN, "", "&a&oUse a Gold Pan on Gravel to obtain this Item");
- public static final RecipeType COMPRESSOR = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "compressor"), SlimefunItems.COMPRESSOR, "", "&a&oCompress it using the Compressor");
- public static final RecipeType PRESSURE_CHAMBER = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "pressure_chamber"), SlimefunItems.PRESSURE_CHAMBER, "", "&a&oCompress it using the Pressure Chamber");
- public static final RecipeType MAGIC_WORKBENCH = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "magic_workbench"), SlimefunItems.MAGIC_WORKBENCH, "", "&a&oCraft it in a Magic Workbench");
- public static final RecipeType ORE_WASHER = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "ore_washer"), SlimefunItems.ORE_WASHER, "", "&a&oWash it in an Ore Washer");
- public static final RecipeType ENHANCED_CRAFTING_TABLE = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "enhanced_crafting_table"), SlimefunItems.ENHANCED_CRAFTING_TABLE, "", "&a&oA regular Crafting Table cannot", "&a&ohold this massive Amount of Power...");
- public static final RecipeType JUICER = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "juicer"), SlimefunItems.JUICER, "", "&a&oUsed for Juice Creation");
-
- public static final RecipeType ANCIENT_ALTAR = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "ancient_altar"), SlimefunItems.ANCIENT_ALTAR, (recipe, output) -> {
+ public static final RecipeType MULTIBLOCK = new RecipeType(new NamespacedKey(Slimefun.instance(), "multiblock"), new CustomItemStack(Material.BRICKS, "&bMultiBlock", "", "&a&oBuild it in the World"));
+ public static final RecipeType ARMOR_FORGE = new RecipeType(new NamespacedKey(Slimefun.instance(), "armor_forge"), SlimefunItems.ARMOR_FORGE, "", "&a&oCraft it in an Armor Forge");
+ public static final RecipeType GRIND_STONE = new RecipeType(new NamespacedKey(Slimefun.instance(), "grind_stone"), SlimefunItems.GRIND_STONE, "", "&a&oGrind it using the Grind Stone");
+ public static final RecipeType SMELTERY = new RecipeType(new NamespacedKey(Slimefun.instance(), "smeltery"), SlimefunItems.SMELTERY, "", "&a&oSmelt it using a Smeltery");
+ public static final RecipeType ORE_CRUSHER = new RecipeType(new NamespacedKey(Slimefun.instance(), "ore_crusher"), SlimefunItems.ORE_CRUSHER, "", "&a&oCrush it using the Ore Crusher");
+ public static final RecipeType GOLD_PAN = new RecipeType(new NamespacedKey(Slimefun.instance(), "gold_pan"), SlimefunItems.GOLD_PAN, "", "&a&oUse a Gold Pan on Gravel to obtain this Item");
+ public static final RecipeType COMPRESSOR = new RecipeType(new NamespacedKey(Slimefun.instance(), "compressor"), SlimefunItems.COMPRESSOR, "", "&a&oCompress it using the Compressor");
+ public static final RecipeType PRESSURE_CHAMBER = new RecipeType(new NamespacedKey(Slimefun.instance(), "pressure_chamber"), SlimefunItems.PRESSURE_CHAMBER, "", "&a&oCompress it using the Pressure Chamber");
+ public static final RecipeType MAGIC_WORKBENCH = new RecipeType(new NamespacedKey(Slimefun.instance(), "magic_workbench"), SlimefunItems.MAGIC_WORKBENCH, "", "&a&oCraft it in a Magic Workbench");
+ public static final RecipeType ORE_WASHER = new RecipeType(new NamespacedKey(Slimefun.instance(), "ore_washer"), SlimefunItems.ORE_WASHER, "", "&a&oWash it in an Ore Washer");
+ public static final RecipeType ENHANCED_CRAFTING_TABLE = new RecipeType(new NamespacedKey(Slimefun.instance(), "enhanced_crafting_table"), SlimefunItems.ENHANCED_CRAFTING_TABLE, "", "&a&oA regular Crafting Table cannot", "&a&ohold this massive Amount of Power...");
+ public static final RecipeType JUICER = new RecipeType(new NamespacedKey(Slimefun.instance(), "juicer"), SlimefunItems.JUICER, "", "&a&oUsed for Juice Creation");
+
+ public static final RecipeType ANCIENT_ALTAR = new RecipeType(new NamespacedKey(Slimefun.instance(), "ancient_altar"), SlimefunItems.ANCIENT_ALTAR, (recipe, output) -> {
AltarRecipe altarRecipe = new AltarRecipe(Arrays.asList(recipe), output);
AncientAltar altar = ((AncientAltar) SlimefunItems.ANCIENT_ALTAR.getItem());
altar.getRecipes().add(altarRecipe);
});
- public static final RecipeType MOB_DROP = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "mob_drop"), new CustomItem(Material.IRON_SWORD, "&bMob Drop"), RecipeType::registerMobDrop, "", "&rKill the specified Mob to obtain this Item");
- public static final RecipeType BARTER_DROP = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "barter_drop"), new CustomItem(Material.GOLD_INGOT, "&bBarter Drop"), RecipeType::registerBarterDrop, "&aBarter with piglins for a chance", "&ato obtain this item");
+ public static final RecipeType MOB_DROP = new RecipeType(new NamespacedKey(Slimefun.instance(), "mob_drop"), new CustomItemStack(Material.IRON_SWORD, "&bMob Drop"), RecipeType::registerMobDrop, "", "&rKill the specified Mob to obtain this Item");
+ public static final RecipeType BARTER_DROP = new RecipeType(new NamespacedKey(Slimefun.instance(), "barter_drop"), new CustomItemStack(Material.GOLD_INGOT, "&bBarter Drop"), RecipeType::registerBarterDrop, "&aBarter with piglins for a chance", "&ato obtain this item");
- public static final RecipeType HEATED_PRESSURE_CHAMBER = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "heated_pressure_chamber"), SlimefunItems.HEATED_PRESSURE_CHAMBER);
- public static final RecipeType FOOD_FABRICATOR = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "food_fabricator"), SlimefunItems.FOOD_FABRICATOR);
- public static final RecipeType FOOD_COMPOSTER = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "food_composter"), SlimefunItems.FOOD_COMPOSTER);
- public static final RecipeType FREEZER = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "freezer"), SlimefunItems.FREEZER);
- public static final RecipeType REFINERY = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "refinery"), SlimefunItems.REFINERY);
+ public static final RecipeType HEATED_PRESSURE_CHAMBER = new RecipeType(new NamespacedKey(Slimefun.instance(), "heated_pressure_chamber"), SlimefunItems.HEATED_PRESSURE_CHAMBER);
+ public static final RecipeType FOOD_FABRICATOR = new RecipeType(new NamespacedKey(Slimefun.instance(), "food_fabricator"), SlimefunItems.FOOD_FABRICATOR);
+ public static final RecipeType FOOD_COMPOSTER = new RecipeType(new NamespacedKey(Slimefun.instance(), "food_composter"), SlimefunItems.FOOD_COMPOSTER);
+ public static final RecipeType FREEZER = new RecipeType(new NamespacedKey(Slimefun.instance(), "freezer"), SlimefunItems.FREEZER);
+ public static final RecipeType REFINERY = new RecipeType(new NamespacedKey(Slimefun.instance(), "refinery"), SlimefunItems.REFINERY);
- public static final RecipeType GEO_MINER = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "geo_miner"), SlimefunItems.GEO_MINER);
- public static final RecipeType NUCLEAR_REACTOR = new RecipeType(new NamespacedKey(SlimefunPlugin.instance(), "nuclear_reactor"), SlimefunItems.NUCLEAR_REACTOR);
+ public static final RecipeType GEO_MINER = new RecipeType(new NamespacedKey(Slimefun.instance(), "geo_miner"), SlimefunItems.GEO_MINER);
+ public static final RecipeType NUCLEAR_REACTOR = new RecipeType(new NamespacedKey(Slimefun.instance(), "nuclear_reactor"), SlimefunItems.NUCLEAR_REACTOR);
public static final RecipeType NULL = new RecipeType();
@@ -76,7 +76,7 @@ public class RecipeType implements Keyed {
private RecipeType() {
this.item = null;
this.machine = "";
- this.key = new NamespacedKey(SlimefunPlugin.instance(), "null");
+ this.key = new NamespacedKey(Slimefun.instance(), "null");
}
public RecipeType(ItemStack item, String machine) {
@@ -84,9 +84,9 @@ public RecipeType(ItemStack item, String machine) {
this.machine = machine;
if (machine.length() > 0) {
- this.key = new NamespacedKey(SlimefunPlugin.instance(), machine.toLowerCase(Locale.ROOT));
+ this.key = new NamespacedKey(Slimefun.instance(), machine.toLowerCase(Locale.ROOT));
} else {
- this.key = new NamespacedKey(SlimefunPlugin.instance(), "unknown");
+ this.key = new NamespacedKey(Slimefun.instance(), "unknown");
}
}
@@ -95,7 +95,7 @@ public RecipeType(NamespacedKey key, SlimefunItemStack slimefunItem, String... l
}
public RecipeType(NamespacedKey key, ItemStack item, BiConsumer callback, String... lore) {
- this.item = new CustomItem(item, null, lore);
+ this.item = new CustomItemStack(item, null, lore);
this.key = key;
this.consumer = callback;
@@ -122,7 +122,7 @@ public void register(ItemStack[] recipe, ItemStack result) {
if (consumer != null) {
consumer.accept(recipe, result);
} else {
- SlimefunItem slimefunItem = SlimefunItem.getByID(this.machine);
+ SlimefunItem slimefunItem = SlimefunItem.getById(this.machine);
if (slimefunItem instanceof MultiBlockMachine) {
((MultiBlockMachine) slimefunItem).addRecipe(recipe, result);
@@ -135,11 +135,11 @@ public void register(ItemStack[] recipe, ItemStack result) {
}
public @Nonnull ItemStack getItem(Player p) {
- return SlimefunPlugin.getLocalization().getRecipeTypeItem(p, this);
+ return Slimefun.getLocalization().getRecipeTypeItem(p, this);
}
public SlimefunItem getMachine() {
- return SlimefunItem.getByID(machine);
+ return SlimefunItem.getById(machine);
}
@Override
@@ -163,8 +163,8 @@ public final int hashCode() {
@ParametersAreNonnullByDefault
private static void registerBarterDrop(ItemStack[] recipe, ItemStack output) {
- if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
- SlimefunPlugin.getRegistry().getBarteringDrops().add(output);
+ if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
+ Slimefun.getRegistry().getBarteringDrops().add(output);
}
}
@@ -172,9 +172,9 @@ private static void registerBarterDrop(ItemStack[] recipe, ItemStack output) {
private static void registerMobDrop(ItemStack[] recipe, ItemStack output) {
String mob = ChatColor.stripColor(recipe[4].getItemMeta().getDisplayName()).toUpperCase(Locale.ROOT).replace(' ', '_');
EntityType entity = EntityType.valueOf(mob);
- Set dropping = SlimefunPlugin.getRegistry().getMobDrops().getOrDefault(entity, new HashSet<>());
+ Set dropping = Slimefun.getRegistry().getMobDrops().getOrDefault(entity, new HashSet<>());
dropping.add(output);
- SlimefunPlugin.getRegistry().getMobDrops().put(entity, dropping);
+ Slimefun.getRegistry().getMobDrops().put(entity, dropping);
}
public static List getRecipeInputs(MultiBlockMachine machine) {
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/package-info.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/package-info.java
new file mode 100644
index 0000000000..ac5c2a8d45
--- /dev/null
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * This package contains all classes related to our recipe system.
+ */
+package io.github.thebusybiscuit.slimefun4.api.recipes;
\ No newline at end of file
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/PlayerResearchTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/PlayerResearchTask.java
similarity index 74%
rename from src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/PlayerResearchTask.java
rename to src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/PlayerResearchTask.java
index 305d821038..de395c4357 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/PlayerResearchTask.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/PlayerResearchTask.java
@@ -1,4 +1,4 @@
-package io.github.thebusybiscuit.slimefun4.core.researching;
+package io.github.thebusybiscuit.slimefun4.api.researches;
import java.util.function.Consumer;
@@ -13,7 +13,7 @@
import io.github.thebusybiscuit.slimefun4.api.events.ResearchUnlockEvent;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
import io.github.thebusybiscuit.slimefun4.core.guide.options.SlimefunGuideSettings;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.FireworkUtils;
/**
@@ -63,9 +63,9 @@ public void accept(PlayerProfile profile) {
}
if (!isInstant) {
- SlimefunPlugin.runSync(() -> {
+ Slimefun.runSync(() -> {
p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 1F);
- SlimefunPlugin.getLocalization().sendMessage(p, "messages.research.progress", true, msg -> msg.replace(PLACEHOLDER, research.getName(p)).replace("%progress%", "0%"));
+ Slimefun.getLocalization().sendMessage(p, "messages.research.progress", true, msg -> msg.replace(PLACEHOLDER, research.getName(p)).replace("%progress%", "0%"));
}, 5L);
}
@@ -74,14 +74,14 @@ public void accept(PlayerProfile profile) {
if (!event.isCancelled()) {
if (isInstant) {
- SlimefunPlugin.runSync(() -> unlockResearch(p, profile));
- } else if (SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().add(p.getUniqueId())) {
- SlimefunPlugin.getLocalization().sendMessage(p, "messages.research.start", true, msg -> msg.replace(PLACEHOLDER, research.getName(p)));
+ Slimefun.runSync(() -> unlockResearch(p, profile));
+ } else if (Slimefun.getRegistry().getCurrentlyResearchingPlayers().add(p.getUniqueId())) {
+ Slimefun.getLocalization().sendMessage(p, "messages.research.start", true, msg -> msg.replace(PLACEHOLDER, research.getName(p)));
sendUpdateMessage(p);
- SlimefunPlugin.runSync(() -> {
+ Slimefun.runSync(() -> {
unlockResearch(p, profile);
- SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().remove(p.getUniqueId());
+ Slimefun.getRegistry().getCurrentlyResearchingPlayers().remove(p.getUniqueId());
}, (RESEARCH_PROGRESS.length + 1) * 20L);
}
}
@@ -92,10 +92,10 @@ private void sendUpdateMessage(@Nonnull Player p) {
for (int i = 1; i < RESEARCH_PROGRESS.length + 1; i++) {
int index = i;
- SlimefunPlugin.runSync(() -> {
+ Slimefun.runSync(() -> {
p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 1);
- SlimefunPlugin.getLocalization().sendMessage(p, "messages.research.progress", true, msg -> {
+ Slimefun.getLocalization().sendMessage(p, "messages.research.progress", true, msg -> {
String progress = RESEARCH_PROGRESS[index - 1] + "%";
return msg.replace(PLACEHOLDER, research.getName(p)).replace("%progress%", progress);
});
@@ -105,11 +105,11 @@ private void sendUpdateMessage(@Nonnull Player p) {
private void unlockResearch(@Nonnull Player p, @Nonnull PlayerProfile profile) {
profile.setResearched(research, true);
- SlimefunPlugin.getLocalization().sendMessage(p, "messages.unlocked", true, msg -> msg.replace(PLACEHOLDER, research.getName(p)));
+ Slimefun.getLocalization().sendMessage(p, "messages.unlocked", true, msg -> msg.replace(PLACEHOLDER, research.getName(p)));
onFinish(p);
// Check if the Server and the Player have enabled fireworks for researches
- if (SlimefunPlugin.getRegistry().isResearchFireworkEnabled() && SlimefunGuideSettings.hasFireworksEnabled(p)) {
+ if (Slimefun.getRegistry().isResearchFireworkEnabled() && SlimefunGuideSettings.hasFireworksEnabled(p)) {
FireworkUtils.launchRandom(p, 1);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/Research.java
similarity index 85%
rename from src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java
rename to src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/Research.java
index 99950d5d49..a9de074551 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/Research.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/Research.java
@@ -1,4 +1,4 @@
-package io.github.thebusybiscuit.slimefun4.core.researching;
+package io.github.thebusybiscuit.slimefun4.api.researches;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -20,13 +20,13 @@
import io.github.thebusybiscuit.slimefun4.api.events.PlayerPreResearchEvent;
import io.github.thebusybiscuit.slimefun4.api.events.ResearchUnlockEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.setup.ResearchSetup;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* Represents a research, which is bound to one
@@ -88,7 +88,7 @@ public NamespacedKey getKey() {
* @return Whether this {@link Research} is enabled or not
*/
public boolean isEnabled() {
- return SlimefunPlugin.getRegistry().isResearchingEnabled() && enabled;
+ return Slimefun.getRegistry().isResearchingEnabled() && enabled;
}
/**
@@ -116,7 +116,7 @@ public int getID() {
*/
@Nonnull
public String getName(@Nonnull Player p) {
- String localized = SlimefunPlugin.getLocalization().getResearchName(p, key);
+ String localized = Slimefun.getLocalization().getResearchName(p, key);
return localized != null ? localized : name;
}
@@ -201,25 +201,25 @@ public List getAffectedItems() {
* @param sfItem
* The {@link SlimefunItem} on which the {@link Player} clicked.
* @param category
- * The {@link Category} where the {@link Player} was.
+ * The {@link ItemGroup} where the {@link Player} was.
* @param page
- * The page number of where the {@link Player} was in the {@link Category};
+ * The page number of where the {@link Player} was in the {@link ItemGroup};
*
*/
@ParametersAreNonnullByDefault
- public void unlockFromGuide(SlimefunGuideImplementation guide, Player player, PlayerProfile profile, SlimefunItem sfItem, Category category, int page) {
- if (!SlimefunPlugin.getRegistry().getCurrentlyResearchingPlayers().contains(player.getUniqueId())) {
+ public void unlockFromGuide(SlimefunGuideImplementation guide, Player player, PlayerProfile profile, SlimefunItem sfItem, ItemGroup category, int page) {
+ if (!Slimefun.getRegistry().getCurrentlyResearchingPlayers().contains(player.getUniqueId())) {
if (profile.hasUnlocked(this)) {
- guide.openCategory(profile, category, page);
+ guide.openItemGroup(profile, category, page);
} else {
PlayerPreResearchEvent event = new PlayerPreResearchEvent(player, this, sfItem);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
if (this.canUnlock(player)) {
- guide.unlockItem(player, sfItem, pl -> guide.openCategory(profile, category, page));
+ guide.unlockItem(player, sfItem, pl -> guide.openItemGroup(profile, category, page));
} else {
- SlimefunPlugin.getLocalization().sendMessage(player, "messages.not-enough-xp", true);
+ Slimefun.getLocalization().sendMessage(player, "messages.not-enough-xp", true);
}
}
}
@@ -239,7 +239,7 @@ public boolean canUnlock(@Nonnull Player p) {
return true;
}
- boolean creativeResearch = p.getGameMode() == GameMode.CREATIVE && SlimefunPlugin.getRegistry().isFreeCreativeResearchingEnabled();
+ boolean creativeResearch = p.getGameMode() == GameMode.CREATIVE && Slimefun.getRegistry().isFreeCreativeResearchingEnabled();
return creativeResearch || p.getLevel() >= cost;
}
@@ -273,10 +273,10 @@ public void unlock(@Nonnull Player p, boolean isInstant, @Nullable Consumer(items)) {
if (item != null) {
item.setResearch(null);
@@ -287,13 +287,13 @@ public void register() {
return;
}
- SlimefunPlugin.getResearchCfg().setDefaultValue(path + ".cost", getCost());
- SlimefunPlugin.getResearchCfg().setDefaultValue(path + ".enabled", true);
+ Slimefun.getResearchCfg().setDefaultValue(path + ".cost", getCost());
+ Slimefun.getResearchCfg().setDefaultValue(path + ".enabled", true);
- setCost(SlimefunPlugin.getResearchCfg().getInt(path + ".cost"));
+ setCost(Slimefun.getResearchCfg().getInt(path + ".cost"));
enabled = true;
- SlimefunPlugin.getRegistry().getResearches().add(this);
+ Slimefun.getRegistry().getResearches().add(this);
}
/**
@@ -310,7 +310,7 @@ public static Optional getResearch(@Nullable NamespacedKey key) {
return Optional.empty();
}
- for (Research research : SlimefunPlugin.getRegistry().getResearches()) {
+ for (Research research : Slimefun.getRegistry().getResearches()) {
if (research.getKey().equals(key)) {
return Optional.of(research);
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/package-info.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/package-info.java
similarity index 100%
rename from src/main/java/io/github/thebusybiscuit/slimefun4/core/researching/package-info.java
rename to src/main/java/io/github/thebusybiscuit/slimefun4/api/researches/package-info.java
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 6658c3b69e..bf896ecac6 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/SlimefunRegistry.java
@@ -23,21 +23,22 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.collections.KeyMap;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
+import io.github.bakedlibs.dough.collections.KeyMap;
+import io.github.bakedlibs.dough.config.Config;
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
+import io.github.thebusybiscuit.slimefun4.api.researches.Research;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlock;
-import io.github.thebusybiscuit.slimefun4.core.researching.Research;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.guide.CheatSheetSlimefunGuide;
import io.github.thebusybiscuit.slimefun4.implementation.guide.SurvivalSlimefunGuide;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
+
import me.mrCookieSlime.Slimefun.api.BlockInfoConfig;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
@@ -56,7 +57,7 @@ public final class SlimefunRegistry {
private final List slimefunItems = new ArrayList<>();
private final List enabledItems = new ArrayList<>();
- private final List categories = new ArrayList<>();
+ private final List categories = new ArrayList<>();
private final List multiblocks = new LinkedList<>();
private final List researches = new LinkedList<>();
@@ -93,7 +94,7 @@ public final class SlimefunRegistry {
private final Map universalInventories = new HashMap<>();
private final Map, Set> globalItemHandlers = new HashMap<>();
- public void load(@Nonnull SlimefunPlugin plugin, @Nonnull Config cfg) {
+ public void load(@Nonnull Slimefun plugin, @Nonnull Config cfg) {
Validate.notNull(plugin, "The Plugin cannot be null!");
Validate.notNull(cfg, "The Config cannot be null!");
@@ -164,12 +165,11 @@ public void setAutoLoadingMode(boolean mode) {
}
/**
- * This returns a {@link List} containing every enabled {@link Category}.
+ * This returns a {@link List} containing every enabled {@link ItemGroup}.
*
- * @return {@link List} containing every enabled {@link Category}
+ * @return {@link List} containing every enabled {@link ItemGroup}
*/
- @Nonnull
- public List getCategories() {
+ public @Nonnull List getAllItemGroups() {
return categories;
}
@@ -178,8 +178,7 @@ public List getCategories() {
*
* @return A {@link List} containing every {@link SlimefunItem}
*/
- @Nonnull
- public List getAllSlimefunItems() {
+ public @Nonnull List getAllSlimefunItems() {
return slimefunItems;
}
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 804c66a5f1..7a766315f6 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
@@ -3,7 +3,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import io.github.thebusybiscuit.slimefun4.utils.UnbreakingAlgorithm;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
@@ -11,8 +10,9 @@
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.bakedlibs.dough.config.Config;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.utils.UnbreakingAlgorithm;
/**
* This interface, when attached to a {@link SlimefunItem}, provides an easy method for damaging
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 066fbdbd89..64a9063ec3 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
@@ -7,15 +7,16 @@
import org.apache.commons.lang.Validate;
import org.bukkit.Location;
-import io.github.thebusybiscuit.cscorelib2.blocks.BlockPosition;
+import io.github.bakedlibs.dough.blocks.BlockPosition;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNet;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.Capacitor;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
/**
@@ -140,7 +141,7 @@ default void setCharge(@Nonnull Location l, int charge) {
}
}
} catch (Exception | LinkageError x) {
- SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "Exception while trying to set the energy-charge for \"" + getId() + "\" at " + new BlockPosition(l));
+ Slimefun.logger().log(Level.SEVERE, x, () -> "Exception while trying to set the energy-charge for \"" + getId() + "\" at " + new BlockPosition(l));
}
}
@@ -167,7 +168,7 @@ default void addCharge(@Nonnull Location l, int charge) {
}
}
} catch (Exception | LinkageError x) {
- SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "Exception while trying to add an energy-charge for \"" + getId() + "\" at " + new BlockPosition(l));
+ Slimefun.logger().log(Level.SEVERE, x, () -> "Exception while trying to add an energy-charge for \"" + getId() + "\" at " + new BlockPosition(l));
}
}
@@ -194,7 +195,7 @@ default void removeCharge(@Nonnull Location l, int charge) {
}
}
} catch (Exception | LinkageError x) {
- SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "Exception while trying to remove an energy-charge for \"" + getId() + "\" at " + new BlockPosition(l));
+ Slimefun.logger().log(Level.SEVERE, x, () -> "Exception while trying to remove an energy-charge for \"" + getId() + "\" at " + new BlockPosition(l));
}
}
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 db5a43982c..10dafe4d4b 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
@@ -8,6 +8,7 @@
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.AbstractEnergyProvider;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors.Reactor;
+
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
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 67eb4191b9..b14e32c35c 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
@@ -6,9 +6,9 @@
import org.bukkit.block.Block;
import org.bukkit.util.Vector;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
+import io.github.bakedlibs.dough.common.ChatColors;
import io.github.thebusybiscuit.slimefun4.core.services.holograms.HologramsService;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.HologramProjector;
/**
@@ -33,7 +33,7 @@ public interface HologramOwner extends ItemAttribute {
*/
default void updateHologram(@Nonnull Block b, @Nonnull String text) {
Location loc = b.getLocation().add(getHologramOffset(b));
- SlimefunPlugin.getHologramsService().setHologramLabel(loc, ChatColors.color(text));
+ Slimefun.getHologramsService().setHologramLabel(loc, ChatColors.color(text));
}
/**
@@ -44,7 +44,7 @@ default void updateHologram(@Nonnull Block b, @Nonnull String text) {
*/
default void removeHologram(@Nonnull Block b) {
Location loc = b.getLocation().add(getHologramOffset(b));
- SlimefunPlugin.getHologramsService().removeHologram(loc);
+ Slimefun.getHologramsService().removeHologram(loc);
}
/**
@@ -59,7 +59,7 @@ default void removeHologram(@Nonnull Block b) {
*/
@Nonnull
default Vector getHologramOffset(@Nonnull Block block) {
- return SlimefunPlugin.getHologramsService().getDefaultOffset();
+ return Slimefun.getHologramsService().getDefaultOffset();
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ItemAttribute.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ItemAttribute.java
index 2aef96f788..44236086ba 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ItemAttribute.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/ItemAttribute.java
@@ -2,8 +2,8 @@
import javax.annotation.Nonnull;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* An empty interface that only serves the purpose of bundling together all
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineProcessHolder.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineProcessHolder.java
index 6b998397dc..7a1c283f6b 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineProcessHolder.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/MachineProcessHolder.java
@@ -2,9 +2,9 @@
import javax.annotation.Nonnull;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.machines.MachineOperation;
import io.github.thebusybiscuit.slimefun4.core.machines.MachineProcessor;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* This {@link ItemAttribute} marks a {@link SlimefunItem} as a {@link MachineProcessHolder}.
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotConfigurable.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotConfigurable.java
index 813bd2437f..f69984d9fd 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotConfigurable.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotConfigurable.java
@@ -1,6 +1,6 @@
package io.github.thebusybiscuit.slimefun4.core.attributes;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* Implement this interface for any {@link SlimefunItem} to prevent
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotPlaceable.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotPlaceable.java
index aa72ddf722..464e91b911 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotPlaceable.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/NotPlaceable.java
@@ -3,7 +3,7 @@
import org.bukkit.block.Block;
import org.bukkit.event.block.BlockPlaceEvent;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* Implement this interface for any {@link SlimefunItem} to prevent
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/PiglinBarterDrop.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/PiglinBarterDrop.java
index 25d1bf5b33..cda9536f8b 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/PiglinBarterDrop.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/PiglinBarterDrop.java
@@ -3,9 +3,9 @@
import org.bukkit.entity.Piglin;
import org.bukkit.event.entity.EntityDropItemEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.entity.PiglinListener;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* This interface, when attached to a {@link SlimefunItem}, provides a variable (0-100%) chance for
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 413490c7aa..28130d102e 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
@@ -8,7 +8,7 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* DO NOT IMPLEMENT THIS INTERFACE
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 d1d8534825..22b09378d0 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
@@ -2,7 +2,7 @@
import javax.annotation.Nonnull;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* This Interface, when attached to a class that inherits from {@link SlimefunItem}, marks
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RandomMobDrop.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RandomMobDrop.java
index aa9db1c07a..9643760391 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RandomMobDrop.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/RandomMobDrop.java
@@ -4,10 +4,10 @@
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDeathEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.implementation.items.misc.BasicCircuitBoard;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.entity.MobDropListener;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* This interface, when attached to a {@link SlimefunItem}, provides an easy method for adding
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Rechargeable.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Rechargeable.java
index bce6080522..e76348c62f 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Rechargeable.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Rechargeable.java
@@ -1,16 +1,16 @@
package io.github.thebusybiscuit.slimefun4.core.attributes;
-import io.github.thebusybiscuit.slimefun4.utils.ChargeUtils;
import org.apache.commons.lang.Validate;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNet;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.gadgets.Jetpack;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.gadgets.MultiTool;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.ChargingBench;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.utils.ChargeUtils;
/**
* A {@link Rechargeable} {@link SlimefunItem} can hold energy and is able to
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 724f2aa459..c85cce7f3f 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
@@ -7,11 +7,12 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.items.geo.GEOMiner;
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.GoldPan;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
/**
@@ -49,6 +50,6 @@ default String getLabelLocalPath() {
@Nonnull
default String getRecipeSectionLabel(@Nonnull Player p) {
- return "&7\u21E9 " + SlimefunPlugin.getLocalization().getMessage(p, getLabelLocalPath()) + " \u21E9";
+ return "&7\u21E9 " + Slimefun.getLocalization().getMessage(p, getLabelLocalPath()) + " \u21E9";
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Soulbound.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Soulbound.java
index 882b35bc79..c8ddd7fbba 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Soulbound.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/attributes/Soulbound.java
@@ -1,7 +1,7 @@
package io.github.thebusybiscuit.slimefun4.core.attributes;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.SoulboundItem;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* This Interface, when attached to a class that inherits from {@link SlimefunItem}, marks
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 cc39762594..712f0df3ea 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
@@ -5,8 +5,8 @@
import org.bukkit.block.Block;
import org.bukkit.entity.Wither;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.WitherProofBlock;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* This Interface, when attached to a class that inherits from {@link SlimefunItem}, marks
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 2be27de3c0..0000000000
--- 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/core/commands/SlimefunCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/SlimefunCommand.java
index f5f997c848..4ef1a411a5 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
@@ -16,9 +16,9 @@
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
+import io.github.bakedlibs.dough.common.ChatColors;
import io.github.thebusybiscuit.slimefun4.core.commands.subcommands.SlimefunSubCommands;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This {@link CommandExecutor} holds the functionality of our {@code /slimefun} command.
@@ -29,7 +29,7 @@
public class SlimefunCommand implements CommandExecutor, Listener {
private boolean registered = false;
- private final SlimefunPlugin plugin;
+ private final Slimefun plugin;
private final List commands = new LinkedList<>();
private final Map commandUsage = new HashMap<>();
@@ -37,9 +37,9 @@ public class SlimefunCommand implements CommandExecutor, Listener {
* Creates a new instance of {@link SlimefunCommand}
*
* @param plugin
- * The instance of our {@link SlimefunPlugin}
+ * The instance of our {@link Slimefun}
*/
- public SlimefunCommand(@Nonnull SlimefunPlugin plugin) {
+ public SlimefunCommand(@Nonnull Slimefun plugin) {
this.plugin = plugin;
}
@@ -54,7 +54,7 @@ public void register() {
commands.addAll(SlimefunSubCommands.getAllCommands(this));
}
- public @Nonnull SlimefunPlugin getPlugin() {
+ public @Nonnull Slimefun getPlugin() {
return plugin;
}
@@ -92,7 +92,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
public void sendHelp(@Nonnull CommandSender sender) {
sender.sendMessage("");
- sender.sendMessage(ChatColors.color("&aSlimefun &2v" + SlimefunPlugin.getVersion()));
+ sender.sendMessage(ChatColors.color("&aSlimefun &2v" + Slimefun.getVersion()));
sender.sendMessage("");
for (SubCommand cmd : commands) {
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 e22d222ec6..07ca70bf0c 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
@@ -14,9 +14,9 @@
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
-import io.github.thebusybiscuit.slimefun4.core.researching.Research;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.researches.Research;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class SlimefunTabCompleter implements TabCompleter {
@@ -37,7 +37,7 @@ public List onTabComplete(CommandSender sender, Command cmd, String labe
if (args[0].equalsIgnoreCase("give")) {
return createReturnList(getSlimefunItems(), args[2]);
} else if (args[0].equalsIgnoreCase("research")) {
- List researches = SlimefunPlugin.getRegistry().getResearches();
+ List researches = Slimefun.getRegistry().getResearches();
List suggestions = new LinkedList<>();
suggestions.add("all");
@@ -95,7 +95,7 @@ private List createReturnList(@Nonnull List list, @Nonnull Strin
@Nonnull
private List getSlimefunItems() {
- List items = SlimefunPlugin.getRegistry().getEnabledSlimefunItems();
+ List items = Slimefun.getRegistry().getEnabledSlimefunItems();
List list = new ArrayList<>(items.size());
for (SlimefunItem item : items) {
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 3bc2630bf9..56350d931e 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
@@ -11,7 +11,7 @@
import org.bukkit.entity.Player;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This class represents a {@link SubCommand}, it is a {@link Command} that starts with
@@ -24,14 +24,14 @@
*/
public abstract class SubCommand {
- protected final SlimefunPlugin plugin;
+ protected final Slimefun plugin;
protected final SlimefunCommand cmd;
private final String name;
private final boolean hidden;
@ParametersAreNonnullByDefault
- protected SubCommand(SlimefunPlugin plugin, SlimefunCommand cmd, String name, boolean hidden) {
+ protected SubCommand(Slimefun plugin, SlimefunCommand cmd, String name, boolean hidden) {
this.plugin = plugin;
this.cmd = cmd;
@@ -83,9 +83,9 @@ protected String getDescription() {
@Nonnull
public String getDescription(@Nonnull CommandSender sender) {
if (sender instanceof Player) {
- return SlimefunPlugin.getLocalization().getMessage((Player) sender, getDescription());
+ return Slimefun.getLocalization().getMessage((Player) sender, getDescription());
} else {
- return SlimefunPlugin.getLocalization().getMessage(getDescription());
+ return Slimefun.getLocalization().getMessage(getDescription());
}
}
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 d1914e6670..29aaca7400 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
@@ -8,13 +8,13 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import io.github.bakedlibs.dough.common.CommonPatterns;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.RestoredBackpack;
-import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
/**
* This command that allows for backpack retrieval in the event they are lost.
@@ -29,7 +29,7 @@
class BackpackCommand extends SubCommand {
@ParametersAreNonnullByDefault
- BackpackCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ BackpackCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "backpack", false);
}
@@ -43,12 +43,12 @@ public void onExecute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
if (sender.hasPermission("slimefun.command.backpack")) {
if (args.length != 3) {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf backpack "));
+ Slimefun.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf backpack "));
return;
}
- if (!PatternUtils.NUMERIC.matcher(args[2]).matches()) {
- SlimefunPlugin.getLocalization().sendMessage(sender, "commands.backpack.invalid-id");
+ if (!CommonPatterns.NUMERIC.matcher(args[2]).matches()) {
+ Slimefun.getLocalization().sendMessage(sender, "commands.backpack.invalid-id");
return;
}
@@ -56,7 +56,7 @@ public void onExecute(CommandSender sender, String[] args) {
OfflinePlayer backpackOwner = Bukkit.getOfflinePlayer(args[1]);
if (!(backpackOwner instanceof Player) && !backpackOwner.hasPlayedBefore()) {
- SlimefunPlugin.getLocalization().sendMessage(sender, "commands.backpack.player-never-joined");
+ Slimefun.getLocalization().sendMessage(sender, "commands.backpack.player-never-joined");
return;
}
@@ -64,22 +64,22 @@ public void onExecute(CommandSender sender, String[] args) {
PlayerProfile.get(backpackOwner, profile -> {
if (!profile.getBackpack(id).isPresent()) {
- SlimefunPlugin.getLocalization().sendMessage(sender, "commands.backpack.backpack-does-not-exist");
+ Slimefun.getLocalization().sendMessage(sender, "commands.backpack.backpack-does-not-exist");
return;
}
- SlimefunPlugin.runSync(() -> {
+ Slimefun.runSync(() -> {
ItemStack item = SlimefunItems.RESTORED_BACKPACK.clone();
- SlimefunPlugin.getBackpackListener().setBackpackId(backpackOwner, item, 2, id);
+ Slimefun.getBackpackListener().setBackpackId(backpackOwner, item, 2, id);
((Player) sender).getInventory().addItem(item);
- SlimefunPlugin.getLocalization().sendMessage(sender, "commands.backpack.restored-backpack-given");
+ Slimefun.getLocalization().sendMessage(sender, "commands.backpack.restored-backpack-given");
});
});
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.only-players", true);
}
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ChargeCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ChargeCommand.java
index c06d5fbd1b..6bfbf147ab 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ChargeCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/ChargeCommand.java
@@ -6,11 +6,11 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.Rechargeable;
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* {@link ChargeCommand} adds an in game command which charges any {@link Rechargeable}
@@ -22,7 +22,7 @@
class ChargeCommand extends SubCommand {
@ParametersAreNonnullByDefault
- ChargeCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ ChargeCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "charge", false);
}
@@ -42,15 +42,15 @@ public void onExecute(CommandSender sender, String[] args) {
if (slimefunItem instanceof Rechargeable) {
Rechargeable rechargeableItem = (Rechargeable) slimefunItem;
rechargeableItem.setItemCharge(item, rechargeableItem.getMaxItemCharge(item));
- SlimefunPlugin.getLocalization().sendMessage(sender, "commands.charge.charge-success", true);
+ Slimefun.getLocalization().sendMessage(sender, "commands.charge.charge-success", true);
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "commands.charge.not-rechargeable", true);
+ Slimefun.getLocalization().sendMessage(sender, "commands.charge.not-rechargeable", true);
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.only-players", true);
}
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/CheatCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/CheatCommand.java
index 659023daa3..f3fcd49872 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/CheatCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/CheatCommand.java
@@ -8,12 +8,12 @@
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class CheatCommand extends SubCommand {
@ParametersAreNonnullByDefault
- CheatCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ CheatCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "cheat", false);
}
@@ -23,10 +23,10 @@ public void onExecute(CommandSender sender, String[] args) {
if (sender.hasPermission("slimefun.cheat.items")) {
SlimefunGuide.openCheatMenu((Player) sender);
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.only-players", true);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/DebugFishCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/DebugFishCommand.java
index 619b6d2ec6..2214360e37 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/DebugFishCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/DebugFishCommand.java
@@ -8,12 +8,12 @@
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class DebugFishCommand extends SubCommand {
@ParametersAreNonnullByDefault
- DebugFishCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ DebugFishCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "debug_fish", true);
}
@@ -22,7 +22,7 @@ public void onExecute(CommandSender sender, String[] args) {
if (sender instanceof Player && sender.hasPermission("slimefun.debugging")) {
((Player) sender).getInventory().addItem(SlimefunItems.DEBUG_FISH.clone());
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GiveCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GiveCommand.java
index f0efe22d05..5d56959e84 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GiveCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GiveCommand.java
@@ -1,23 +1,24 @@
package io.github.thebusybiscuit.slimefun4.core.commands.subcommands;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
-import io.github.thebusybiscuit.cscorelib2.players.PlayerList;
-import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
-import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
-import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import javax.annotation.ParametersAreNonnullByDefault;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+import io.github.bakedlibs.dough.common.CommonPatterns;
+import io.github.bakedlibs.dough.common.PlayerList;
+import io.github.bakedlibs.dough.items.CustomItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
+import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
+import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
+
class GiveCommand extends SubCommand {
private static final String PLACEHOLDER_PLAYER = "%player%";
@@ -25,7 +26,7 @@ class GiveCommand extends SubCommand {
private static final String PLACEHOLDER_AMOUNT = "%amount%";
@ParametersAreNonnullByDefault
- GiveCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ GiveCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "give", false);
}
@@ -38,42 +39,42 @@ public void onExecute(CommandSender sender, String[] args) {
if (player.isPresent()) {
Player p = player.get();
- SlimefunItem sfItem = SlimefunItem.getByID(args[2].toUpperCase(Locale.ROOT));
+ SlimefunItem sfItem = SlimefunItem.getById(args[2].toUpperCase(Locale.ROOT));
if (sfItem != null) {
giveItem(sender, p, sfItem, args);
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.invalid-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, args[2]));
+ Slimefun.getLocalization().sendMessage(sender, "messages.invalid-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, args[2]));
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-online", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]));
+ Slimefun.getLocalization().sendMessage(sender, "messages.not-online", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]));
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf give [Amount]"));
+ Slimefun.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf give [Amount]"));
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
}
private void giveItem(CommandSender sender, Player p, SlimefunItem sfItem, String[] args) {
if (sfItem instanceof MultiBlockMachine) {
- SlimefunPlugin.getLocalization().sendMessage(sender, "guide.cheat.no-multiblocks");
+ Slimefun.getLocalization().sendMessage(sender, "guide.cheat.no-multiblocks");
} else {
int amount = parseAmount(args);
if (amount > 0) {
- SlimefunPlugin.getLocalization().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
- Map excess = p.getInventory().addItem(new CustomItem(sfItem.getItem(), amount));
- if (SlimefunPlugin.getCfg().getBoolean("options.drop-excess-sf-give-items") && !excess.isEmpty()) {
+ Slimefun.getLocalization().sendMessage(p, "messages.given-item", true, msg -> msg.replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
+ Map excess = p.getInventory().addItem(new CustomItemStack(sfItem.getItem(), amount));
+ if (Slimefun.getCfg().getBoolean("options.drop-excess-sf-give-items") && !excess.isEmpty()) {
for (ItemStack is : excess.values()) {
p.getWorld().dropItem(p.getLocation(), is);
}
}
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.give-item", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
+ Slimefun.getLocalization().sendMessage(sender, "messages.give-item", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount)));
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.invalid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3]));
+ Slimefun.getLocalization().sendMessage(sender, "messages.invalid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3]));
}
}
}
@@ -82,7 +83,7 @@ private int parseAmount(String[] args) {
int amount = 1;
if (args.length == 4) {
- if (PatternUtils.NUMERIC.matcher(args[3]).matches()) {
+ if (CommonPatterns.NUMERIC.matcher(args[3]).matches()) {
amount = Integer.parseInt(args[3]);
} else {
return 0;
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GuideCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GuideCommand.java
index 94b49f630b..7849d49e4b 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GuideCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/GuideCommand.java
@@ -9,12 +9,12 @@
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class GuideCommand extends SubCommand {
@ParametersAreNonnullByDefault
- GuideCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ GuideCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "guide", false);
}
@@ -25,10 +25,10 @@ public void onExecute(CommandSender sender, String[] args) {
SlimefunGuideMode design = SlimefunGuide.getDefaultMode();
((Player) sender).getInventory().addItem(SlimefunGuide.getItem(design).clone());
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.only-players", true);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/HelpCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/HelpCommand.java
index 6ff08892f2..b3e411d388 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/HelpCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/HelpCommand.java
@@ -6,12 +6,12 @@
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class HelpCommand extends SubCommand {
@ParametersAreNonnullByDefault
- HelpCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ HelpCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "help", false);
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/OpenGuideCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/OpenGuideCommand.java
index 7e4b88d7bc..2d89f09b03 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/OpenGuideCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/OpenGuideCommand.java
@@ -9,12 +9,12 @@
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class OpenGuideCommand extends SubCommand {
@ParametersAreNonnullByDefault
- OpenGuideCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ OpenGuideCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "open_guide", false);
}
@@ -25,10 +25,10 @@ public void onExecute(CommandSender sender, String[] args) {
if (sender.hasPermission("slimefun.command.open_guide")) {
SlimefunGuide.openGuide((Player) sender, SlimefunGuideMode.SURVIVAL_MODE);
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.only-players", 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 59dbd7dd44..caf6f6d254 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
@@ -9,12 +9,12 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import io.github.thebusybiscuit.cscorelib2.players.PlayerList;
+import io.github.bakedlibs.dough.common.PlayerList;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
+import io.github.thebusybiscuit.slimefun4.api.researches.Research;
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
-import io.github.thebusybiscuit.slimefun4.core.researching.Research;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class ResearchCommand extends SubCommand {
@@ -22,7 +22,7 @@ class ResearchCommand extends SubCommand {
private static final String PLACEHOLDER_RESEARCH = "%research%";
@ParametersAreNonnullByDefault
- ResearchCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ ResearchCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "research", false);
}
@@ -51,13 +51,13 @@ public void onExecute(CommandSender sender, String[] args) {
}
});
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-online", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]));
+ Slimefun.getLocalization().sendMessage(sender, "messages.not-online", true, msg -> msg.replace(PLACEHOLDER_PLAYER, args[1]));
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf research "));
+ Slimefun.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf research "));
}
}
@@ -68,18 +68,18 @@ private void giveResearch(CommandSender sender, Player p, String input) {
if (research.isPresent()) {
research.get().unlock(p, true, player -> {
UnaryOperator variables = msg -> msg.replace(PLACEHOLDER_PLAYER, player.getName()).replace(PLACEHOLDER_RESEARCH, research.get().getName(player));
- SlimefunPlugin.getLocalization().sendMessage(player, "messages.give-research", true, variables);
+ Slimefun.getLocalization().sendMessage(player, "messages.give-research", true, variables);
});
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.invalid-research", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, input));
+ Slimefun.getLocalization().sendMessage(sender, "messages.invalid-research", true, msg -> msg.replace(PLACEHOLDER_RESEARCH, input));
}
}
@ParametersAreNonnullByDefault
private void researchAll(CommandSender sender, PlayerProfile profile, Player p) {
- for (Research res : SlimefunPlugin.getRegistry().getResearches()) {
+ for (Research res : Slimefun.getRegistry().getResearches()) {
if (!profile.hasUnlocked(res)) {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.give-research", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()).replace(PLACEHOLDER_RESEARCH, res.getName(p)));
+ Slimefun.getLocalization().sendMessage(sender, "messages.give-research", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()).replace(PLACEHOLDER_RESEARCH, res.getName(p)));
}
res.unlock(p, true);
@@ -88,11 +88,11 @@ private void researchAll(CommandSender sender, PlayerProfile profile, Player p)
@ParametersAreNonnullByDefault
private void reset(PlayerProfile profile, Player p) {
- for (Research research : SlimefunPlugin.getRegistry().getResearches()) {
+ for (Research research : Slimefun.getRegistry().getResearches()) {
profile.setResearched(research, false);
}
- SlimefunPlugin.getLocalization().sendMessage(p, "commands.research.reset", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()));
+ Slimefun.getLocalization().sendMessage(p, "commands.research.reset", true, msg -> msg.replace(PLACEHOLDER_PLAYER, p.getName()));
}
@Nonnull
@@ -101,7 +101,7 @@ private Optional getResearchFromString(@Nonnull String input) {
return Optional.empty();
}
- for (Research research : SlimefunPlugin.getRegistry().getResearches()) {
+ for (Research research : Slimefun.getRegistry().getResearches()) {
if (research.getKey().toString().equalsIgnoreCase(input)) {
return Optional.of(research);
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/SearchCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/SearchCommand.java
index 56a4faaa11..3e87fb40b7 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/SearchCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/SearchCommand.java
@@ -12,12 +12,12 @@
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class SearchCommand extends SubCommand {
@ParametersAreNonnullByDefault
- SearchCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ SearchCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "search", false);
}
@@ -29,13 +29,13 @@ public void onExecute(CommandSender sender, String[] args) {
String query = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
PlayerProfile.get((Player) sender, profile -> SlimefunGuide.openSearch(profile, query, SlimefunGuideMode.SURVIVAL_MODE, true));
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf search "));
+ Slimefun.getLocalization().sendMessage(sender, "messages.usage", true, msg -> msg.replace("%usage%", "/sf search "));
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.only-players", true);
}
}
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 488750f995..e13dc3c5d6 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
@@ -8,7 +8,7 @@
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This class holds the implementations of every {@link SubCommand}.
@@ -24,7 +24,7 @@ private SlimefunSubCommands() {}
@Nonnull
public static Collection getAllCommands(@Nonnull SlimefunCommand cmd) {
- SlimefunPlugin plugin = cmd.getPlugin();
+ Slimefun plugin = cmd.getPlugin();
List commands = new LinkedList<>();
commands.add(new HelpCommand(plugin, cmd));
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/StatsCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/StatsCommand.java
index a6e3651fb9..6e08f6e01f 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/StatsCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/StatsCommand.java
@@ -8,16 +8,16 @@
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
-import io.github.thebusybiscuit.cscorelib2.players.PlayerList;
+import io.github.bakedlibs.dough.common.PlayerList;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class StatsCommand extends SubCommand {
@ParametersAreNonnullByDefault
- StatsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ StatsCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "stats", false);
}
@@ -30,15 +30,15 @@ public void onExecute(CommandSender sender, String[] args) {
if (player.isPresent()) {
PlayerProfile.get(player.get(), profile -> profile.sendStats(sender));
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-online", true, msg -> msg.replace("%player%", args[1]));
+ Slimefun.getLocalization().sendMessage(sender, "messages.not-online", true, msg -> msg.replace("%player%", args[1]));
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
} else if (sender instanceof Player) {
PlayerProfile.get((Player) sender, profile -> profile.sendStats(sender));
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.only-players", true);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java
index fbd31fe07e..8401e3b5db 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/commands/subcommands/TeleporterCommand.java
@@ -10,12 +10,12 @@
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class TeleporterCommand extends SubCommand {
@ParametersAreNonnullByDefault
- TeleporterCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ TeleporterCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "teleporter", false);
}
@@ -25,25 +25,25 @@ public void onExecute(CommandSender sender, String[] args) {
if (sender.hasPermission("slimefun.command.teleporter")) {
if (args.length == 1) {
Player p = (Player) sender;
- SlimefunPlugin.getGPSNetwork().getTeleportationManager().openTeleporterGUI(p, p.getUniqueId(), p.getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999);
+ Slimefun.getGPSNetwork().getTeleportationManager().openTeleporterGUI(p, p.getUniqueId(), p.getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999);
} else if (args.length == 2) {
@SuppressWarnings("deprecation")
OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);
if (player.getName() != null) {
- SlimefunPlugin.getGPSNetwork().getTeleportationManager().openTeleporterGUI((Player) sender, player.getUniqueId(), ((Player) sender).getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999);
+ Slimefun.getGPSNetwork().getTeleportationManager().openTeleporterGUI((Player) sender, player.getUniqueId(), ((Player) sender).getLocation().getBlock().getRelative(BlockFace.DOWN), 999999999);
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.unknown-player", msg -> msg.replace("%player%", args[1]));
+ Slimefun.getLocalization().sendMessage(sender, "messages.unknown-player", msg -> msg.replace("%player%", args[1]));
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.usage", msg -> msg.replace("%usage%", "/sf teleporter [Player]"));
+ Slimefun.getLocalization().sendMessage(sender, "messages.usage", msg -> msg.replace("%usage%", "/sf teleporter [Player]"));
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission");
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission");
}
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players");
+ Slimefun.getLocalization().sendMessage(sender, "messages.only-players");
}
}
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 849abbef43..74abcd9023 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
@@ -17,7 +17,7 @@
import io.github.thebusybiscuit.slimefun4.core.services.profiler.PerformanceInspector;
import io.github.thebusybiscuit.slimefun4.core.services.profiler.inspectors.ConsolePerformanceInspector;
import io.github.thebusybiscuit.slimefun4.core.services.profiler.inspectors.PlayerPerformanceInspector;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class TimingsCommand extends SubCommand {
@@ -25,7 +25,7 @@ class TimingsCommand extends SubCommand {
private final Set flags = new HashSet<>(Arrays.asList("verbose"));
@ParametersAreNonnullByDefault
- TimingsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ TimingsCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "timings", false);
}
@@ -44,16 +44,16 @@ public void onExecute(CommandSender sender, String[] args) {
boolean verbose = hasFlag(args, "verbose");
if (verbose && sender instanceof Player) {
- SlimefunPlugin.getLocalization().sendMessage(sender, "commands.timings.verbose-player", true);
+ Slimefun.getLocalization().sendMessage(sender, "commands.timings.verbose-player", true);
return;
}
- SlimefunPlugin.getLocalization().sendMessage(sender, "commands.timings.please-wait", true);
+ Slimefun.getLocalization().sendMessage(sender, "commands.timings.please-wait", true);
PerformanceInspector inspector = inspectorOf(sender, verbose);
- SlimefunPlugin.getProfiler().requestSummary(inspector);
+ Slimefun.getProfiler().requestSummary(inspector);
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
}
@@ -67,7 +67,7 @@ private boolean hasInvalidFlags(CommandSender sender, String[] args) {
if (argument.startsWith(FLAG_PREFIX) && !flags.contains(argument.substring(2))) {
hasInvalidFlags = true;
- SlimefunPlugin.getLocalization().sendMessage(sender, "commands.timings.unknown-flag", true, msg -> msg.replace("%flag%", argument));
+ Slimefun.getLocalization().sendMessage(sender, "commands.timings.unknown-flag", true, msg -> msg.replace("%flag%", argument));
}
}
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 3fb66d57f6..f01b19112a 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
@@ -13,9 +13,10 @@
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
import io.papermc.lib.PaperLib;
+
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
@@ -44,7 +45,7 @@ class VersionsCommand extends SubCommand {
private static final String JAVA_VERSION_NOTICE = "As of Minecraft 1.17 Java 16 will be required!";
@ParametersAreNonnullByDefault
- VersionsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
+ VersionsCommand(Slimefun plugin, SlimefunCommand cmd) {
super(plugin, cmd, "versions", false);
}
@@ -67,22 +68,22 @@ public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) {
.color(ChatColor.DARK_GREEN)
.append("Slimefun ")
.color(ChatColor.GREEN)
- .append(SlimefunPlugin.getVersion() + '\n')
+ .append(Slimefun.getVersion() + '\n')
.color(ChatColor.DARK_GREEN);
// @formatter:on
- if (SlimefunPlugin.getMetricsService().getVersion() != null) {
+ if (Slimefun.getMetricsService().getVersion() != null) {
// @formatter:off
builder.append("Metrics-Module ")
.color(ChatColor.GREEN)
- .append("#" + SlimefunPlugin.getMetricsService().getVersion() + '\n')
+ .append("#" + Slimefun.getMetricsService().getVersion() + '\n')
.color(ChatColor.DARK_GREEN);
// @formatter:on
}
addJavaVersion(builder);
- if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) {
+ if (Slimefun.getRegistry().isBackwardsCompatible()) {
// @formatter:off
HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(
"Backwards compatibility has a negative impact on performance!\n" +
@@ -99,7 +100,7 @@ public void onExecute(@Nonnull CommandSender sender, @Nonnull String[] args) {
sender.spigot().sendMessage(builder.create());
} else {
- SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
+ Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
}
@@ -123,7 +124,7 @@ private void addJavaVersion(@Nonnull ComponentBuilder builder) {
}
private void addPluginVersions(@Nonnull ComponentBuilder builder) {
- Collection addons = SlimefunPlugin.getInstalledAddons();
+ Collection addons = Slimefun.getInstalledAddons();
if (addons.isEmpty()) {
builder.append("No Addons installed").color(ChatColor.GRAY).italic(true);
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 1cf0f62f67..320efd86a0 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
@@ -10,9 +10,9 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* {@link GuideHistory} represents the browsing history of a {@link Player} through the
@@ -70,16 +70,16 @@ public int getMainMenuPage() {
}
/**
- * This method adds a {@link Category} to this {@link GuideHistory}.
- * Should the {@link Category} already be the last element in this {@link GuideHistory},
+ * This method adds a {@link ItemGroup} to this {@link GuideHistory}.
+ * Should the {@link ItemGroup} already be the last element in this {@link GuideHistory},
* then the entry will be overridden with the new page.
*
* @param category
- * The {@link Category} that should be added to this {@link GuideHistory}
+ * The {@link ItemGroup} that should be added to this {@link GuideHistory}
* @param page
- * The current page of the {@link Category} that should be stored
+ * The current page of the {@link ItemGroup} that should be stored
*/
- public void add(@Nonnull Category category, int page) {
+ public void add(@Nonnull ItemGroup category, int page) {
refresh(category, page);
}
@@ -188,8 +188,8 @@ public void goBack(@Nonnull SlimefunGuideImplementation guide) {
private void open(@Nonnull SlimefunGuideImplementation guide, @Nullable GuideEntry entry) {
if (entry == null) {
guide.openMainMenu(profile, mainMenuPage);
- } else if (entry.getIndexedObject() instanceof Category) {
- guide.openCategory(profile, (Category) entry.getIndexedObject(), entry.getPage());
+ } else if (entry.getIndexedObject() instanceof ItemGroup) {
+ guide.openItemGroup(profile, (ItemGroup) entry.getIndexedObject(), entry.getPage());
} else if (entry.getIndexedObject() instanceof SlimefunItem) {
guide.displayItem(profile, (SlimefunItem) entry.getIndexedObject(), false);
} else if (entry.getIndexedObject() instanceof ItemStack) {
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 779f634d1c..6949054084 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
@@ -10,14 +10,13 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.guide.SurvivalSlimefunGuide;
-
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.SlimefunGuideItem;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* This is a static utility class that provides convenient access to the methods
@@ -35,7 +34,7 @@ private SlimefunGuide() {}
@Nonnull
public static ItemStack getItem(@Nonnull SlimefunGuideMode design) {
- return SlimefunPlugin.getRegistry().getSlimefunGuide(design).getItem();
+ return Slimefun.getRegistry().getSlimefunGuide(design).getItem();
}
public static void openCheatMenu(@Nonnull Player p) {
@@ -55,7 +54,7 @@ public static void openGuide(@Nonnull Player p, @Nullable ItemStack guide) {
}
public static void openGuide(@Nonnull Player p, @Nonnull SlimefunGuideMode mode) {
- if (!SlimefunPlugin.getWorldSettingsService().isWorldEnabled(p.getWorld())) {
+ if (!Slimefun.getWorldSettingsService().isWorldEnabled(p.getWorld())) {
return;
}
@@ -63,7 +62,7 @@ public static void openGuide(@Nonnull Player p, @Nonnull SlimefunGuideMode mode)
if (optional.isPresent()) {
PlayerProfile profile = optional.get();
- SlimefunGuideImplementation guide = SlimefunPlugin.getRegistry().getSlimefunGuide(mode);
+ SlimefunGuideImplementation guide = Slimefun.getRegistry().getSlimefunGuide(mode);
profile.getGuideHistory().openLastEntry(guide);
} else {
openMainMenuAsync(p, mode, 1);
@@ -72,35 +71,35 @@ public static void openGuide(@Nonnull Player p, @Nonnull SlimefunGuideMode mode)
@ParametersAreNonnullByDefault
private static void openMainMenuAsync(Player player, SlimefunGuideMode mode, int selectedPage) {
- if (!PlayerProfile.get(player, profile -> SlimefunPlugin.runSync(() -> openMainMenu(profile, mode, selectedPage)))) {
- SlimefunPlugin.getLocalization().sendMessage(player, "messages.opening-guide");
+ if (!PlayerProfile.get(player, profile -> Slimefun.runSync(() -> openMainMenu(profile, mode, selectedPage)))) {
+ Slimefun.getLocalization().sendMessage(player, "messages.opening-guide");
}
}
@ParametersAreNonnullByDefault
public static void openMainMenu(PlayerProfile profile, SlimefunGuideMode mode, int selectedPage) {
- SlimefunPlugin.getRegistry().getSlimefunGuide(mode).openMainMenu(profile, selectedPage);
+ Slimefun.getRegistry().getSlimefunGuide(mode).openMainMenu(profile, selectedPage);
}
@ParametersAreNonnullByDefault
- public static void openCategory(PlayerProfile profile, Category category, SlimefunGuideMode mode, int selectedPage) {
- SlimefunPlugin.getRegistry().getSlimefunGuide(mode).openCategory(profile, category, selectedPage);
+ public static void openCategory(PlayerProfile profile, ItemGroup category, SlimefunGuideMode mode, int selectedPage) {
+ Slimefun.getRegistry().getSlimefunGuide(mode).openItemGroup(profile, category, selectedPage);
}
@ParametersAreNonnullByDefault
public static void openSearch(PlayerProfile profile, String input, SlimefunGuideMode mode, boolean addToHistory) {
- SlimefunGuideImplementation guide = SlimefunPlugin.getRegistry().getSlimefunGuide(mode);
+ SlimefunGuideImplementation guide = Slimefun.getRegistry().getSlimefunGuide(mode);
guide.openSearch(profile, input, addToHistory);
}
@ParametersAreNonnullByDefault
public static void displayItem(PlayerProfile profile, ItemStack item, boolean addToHistory) {
- SlimefunPlugin.getRegistry().getSlimefunGuide(SlimefunGuideMode.SURVIVAL_MODE).displayItem(profile, item, 0, addToHistory);
+ Slimefun.getRegistry().getSlimefunGuide(SlimefunGuideMode.SURVIVAL_MODE).displayItem(profile, item, 0, addToHistory);
}
@ParametersAreNonnullByDefault
public static void displayItem(PlayerProfile profile, SlimefunItem item, boolean addToHistory) {
- SlimefunPlugin.getRegistry().getSlimefunGuide(SlimefunGuideMode.SURVIVAL_MODE).displayItem(profile, item, addToHistory);
+ Slimefun.getRegistry().getSlimefunGuide(SlimefunGuideMode.SURVIVAL_MODE).displayItem(profile, item, addToHistory);
}
/**
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 8dceaa855a..d035715ed7 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
@@ -9,13 +9,13 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
+import io.github.thebusybiscuit.slimefun4.api.researches.Research;
import io.github.thebusybiscuit.slimefun4.core.guide.options.SlimefunGuideSettings;
-import io.github.thebusybiscuit.slimefun4.core.researching.Research;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.guide.SurvivalSlimefunGuide;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* This interface is used for the different implementations that add behaviour
@@ -52,7 +52,7 @@ public interface SlimefunGuideImplementation {
void openMainMenu(PlayerProfile profile, int page);
@ParametersAreNonnullByDefault
- void openCategory(PlayerProfile profile, Category category, int page);
+ void openItemGroup(PlayerProfile profile, ItemGroup group, int page);
@ParametersAreNonnullByDefault
void openSearch(PlayerProfile profile, String input, boolean addToHistory);
@@ -67,12 +67,12 @@ public interface SlimefunGuideImplementation {
default void unlockItem(Player p, SlimefunItem sfitem, Consumer callback) {
Research research = sfitem.getResearch();
- if (p.getGameMode() == GameMode.CREATIVE && SlimefunPlugin.getRegistry().isFreeCreativeResearchingEnabled()) {
+ if (p.getGameMode() == GameMode.CREATIVE && Slimefun.getRegistry().isFreeCreativeResearchingEnabled()) {
research.unlock(p, true, callback);
} else {
p.setLevel(p.getLevel() - research.getCost());
- boolean skipLearningAnimation = SlimefunPlugin.getRegistry().isLearningAnimationDisabled() || !SlimefunGuideSettings.hasLearningAnimationEnabled(p);
+ boolean skipLearningAnimation = Slimefun.getRegistry().isLearningAnimationDisabled() || !SlimefunGuideSettings.hasLearningAnimationEnabled(p);
research.unlock(p, skipLearningAnimation, callback);
}
}
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 8c439f4362..25c6776b45 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
@@ -1,7 +1,8 @@
package io.github.thebusybiscuit.slimefun4.core.guide;
-import io.github.thebusybiscuit.cscorelib2.inventory.ChestMenu;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
/**
* This enum holds the different designs a {@link SlimefunGuide} can have.
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/ContributorsMenu.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/ContributorsMenu.java
index 7ce154874f..951a9e064f 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/ContributorsMenu.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/ContributorsMenu.java
@@ -11,14 +11,15 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.bakedlibs.dough.common.ChatColors;
+import io.github.bakedlibs.dough.common.CommonPatterns;
+import io.github.bakedlibs.dough.items.CustomItemStack;
import io.github.thebusybiscuit.slimefun4.core.services.github.Contributor;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
-import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
/**
@@ -32,20 +33,20 @@ final class ContributorsMenu {
private ContributorsMenu() {}
public static void open(Player p, int page) {
- ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "guide.title.credits"));
+ ChestMenu menu = new ChestMenu(Slimefun.getLocalization().getMessage(p, "guide.title.credits"));
menu.setEmptySlotsClickable(false);
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 0.7F, 0.7F));
ChestMenuUtils.drawBackground(menu, 0, 2, 3, 4, 5, 6, 7, 8, 45, 47, 48, 49, 50, 51, 53);
- menu.addItem(1, new CustomItem(ChestMenuUtils.getBackButton(p, "", "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.settings"))));
+ menu.addItem(1, new CustomItemStack(ChestMenuUtils.getBackButton(p, "", "&7" + Slimefun.getLocalization().getMessage(p, "guide.back.settings"))));
menu.addMenuClickHandler(1, (pl, slot, item, action) -> {
SlimefunGuideSettings.openSettings(pl, p.getInventory().getItemInMainHand());
return false;
});
- List contributors = new ArrayList<>(SlimefunPlugin.getGitHubService().getContributors().values());
+ List contributors = new ArrayList<>(Slimefun.getGitHubService().getContributors().values());
contributors.sort(Comparator.comparingInt(Contributor::getPosition));
for (int i = page * 36; i < contributors.size() && i < (page + 1) * 36; i++) {
@@ -98,16 +99,16 @@ private static ItemStack getContributorHead(Player p, Contributor contributor) {
String info = entry.getKey();
if (!info.startsWith("&")) {
- String[] segments = PatternUtils.COMMA.split(info);
- info = SlimefunPlugin.getLocalization().getMessage(p, "guide.credits.roles." + segments[0]);
+ String[] segments = CommonPatterns.COMMA.split(info);
+ info = Slimefun.getLocalization().getMessage(p, "guide.credits.roles." + segments[0]);
if (segments.length == 2) {
- info += " &7(" + SlimefunPlugin.getLocalization().getMessage(p, "languages." + segments[1]) + ')';
+ info += " &7(" + Slimefun.getLocalization().getMessage(p, "languages." + segments[1]) + ')';
}
}
if (entry.getValue() > 0) {
- String commits = SlimefunPlugin.getLocalization().getMessage(p, "guide.credits." + (entry.getValue() > 1 ? "commits" : "commit"));
+ String commits = Slimefun.getLocalization().getMessage(p, "guide.credits." + (entry.getValue() > 1 ? "commits" : "commit"));
info += " &7(" + entry.getValue() + ' ' + commits + ')';
}
@@ -117,7 +118,7 @@ private static ItemStack getContributorHead(Player p, Contributor contributor) {
if (contributor.getProfile() != null) {
lore.add("");
- lore.add(ChatColors.color("&7\u21E8 &e") + SlimefunPlugin.getLocalization().getMessage(p, "guide.credits.profile-link"));
+ lore.add(ChatColors.color("&7\u21E8 &e") + Slimefun.getLocalization().getMessage(p, "guide.credits.profile-link"));
}
meta.setLore(lore);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/FireworksOption.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/FireworksOption.java
index 25465c92df..85fa76612f 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/FireworksOption.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/FireworksOption.java
@@ -7,28 +7,28 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.bakedlibs.dough.data.persistent.PersistentDataAPI;
+import io.github.bakedlibs.dough.items.CustomItemStack;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
class FireworksOption implements SlimefunGuideOption {
@Override
public SlimefunAddon getAddon() {
- return SlimefunPlugin.instance();
+ return Slimefun.instance();
}
@Override
public NamespacedKey getKey() {
- return new NamespacedKey(SlimefunPlugin.instance(), "research_fireworks");
+ return new NamespacedKey(Slimefun.instance(), "research_fireworks");
}
@Override
public Optional getDisplayItem(Player p, ItemStack guide) {
- if (SlimefunPlugin.getRegistry().isResearchFireworkEnabled()) {
+ if (Slimefun.getRegistry().isResearchFireworkEnabled()) {
boolean enabled = getSelectedOption(p, guide).orElse(true);
- ItemStack item = new CustomItem(Material.FIREWORK_ROCKET, "&bFireworks: &" + (enabled ? "aYes" : "4No"), "", "&7You can now toggle whether you", "&7will be presented with a big firework", "&7upon researching an item.", "", "&7\u21E8 &eClick to " + (enabled ? "disable" : "enable") + " your fireworks");
+ ItemStack item = new CustomItemStack(Material.FIREWORK_ROCKET, "&bFireworks: &" + (enabled ? "aYes" : "4No"), "", "&7You can now toggle whether you", "&7will be presented with a big firework", "&7upon researching an item.", "", "&7\u21E8 &eClick to " + (enabled ? "disable" : "enable") + " your fireworks");
return Optional.of(item);
} else {
return Optional.empty();
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 bd7506eeba..f86694211d 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
@@ -17,7 +17,7 @@
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
@@ -26,13 +26,13 @@ class GuideModeOption implements SlimefunGuideOption {
@Nonnull
@Override
public SlimefunAddon getAddon() {
- return SlimefunPlugin.instance();
+ return Slimefun.instance();
}
@Nonnull
@Override
public NamespacedKey getKey() {
- return new NamespacedKey(SlimefunPlugin.instance(), "guide_mode");
+ return new NamespacedKey(Slimefun.instance(), "guide_mode");
}
@Nonnull
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 2b949d4295..11040f2c3f 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
@@ -10,10 +10,10 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.bakedlibs.dough.data.persistent.PersistentDataAPI;
+import io.github.bakedlibs.dough.items.CustomItemStack;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* {@link LearningAnimationOption} represents a setting in the Slimefun guide book.
@@ -27,28 +27,28 @@ class LearningAnimationOption implements SlimefunGuideOption {
@Nonnull
@Override
public SlimefunAddon getAddon() {
- return SlimefunPlugin.instance();
+ return Slimefun.instance();
}
@Nonnull
@Override
public NamespacedKey getKey() {
- return new NamespacedKey(SlimefunPlugin.instance(), "research_learning_animation");
+ return new NamespacedKey(Slimefun.instance(), "research_learning_animation");
}
@Nonnull
@Override
public Optional getDisplayItem(@Nonnull Player p, @Nonnull ItemStack guide) {
- if (SlimefunPlugin.getRegistry().isLearningAnimationDisabled()) {
+ if (Slimefun.getRegistry().isLearningAnimationDisabled()) {
return Optional.empty();
} else {
boolean enabled = getSelectedOption(p, guide).orElse(true);
String optionState = enabled ? "enabled" : "disabled";
- List lore = SlimefunPlugin.getLocalization().getMessages(p, "guide.options.learning-animation." + optionState + ".text");
+ List lore = Slimefun.getLocalization().getMessages(p, "guide.options.learning-animation." + optionState + ".text");
lore.add("");
- lore.add("&7\u21E8 " + SlimefunPlugin.getLocalization().getMessage(p, "guide.options.learning-animation." + optionState + ".click"));
+ lore.add("&7\u21E8 " + Slimefun.getLocalization().getMessage(p, "guide.options.learning-animation." + optionState + ".click"));
- ItemStack item = new CustomItem(enabled ? Material.MAP : Material.PAPER, lore);
+ ItemStack item = new CustomItemStack(enabled ? Material.MAP : Material.PAPER, lore);
return Optional.of(item);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/PlayerLanguageOption.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/PlayerLanguageOption.java
index e435bfdf8f..a6fe624586 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/PlayerLanguageOption.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/PlayerLanguageOption.java
@@ -10,45 +10,46 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.bakedlibs.dough.data.persistent.PersistentDataAPI;
+import io.github.bakedlibs.dough.items.CustomItemStack;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
import io.github.thebusybiscuit.slimefun4.api.events.PlayerLanguageChangeEvent;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
class PlayerLanguageOption implements SlimefunGuideOption {
@Override
public SlimefunAddon getAddon() {
- return SlimefunPlugin.instance();
+ return Slimefun.instance();
}
@Override
public NamespacedKey getKey() {
- return SlimefunPlugin.getLocalization().getKey();
+ return Slimefun.getLocalization().getKey();
}
@Override
public Optional getDisplayItem(Player p, ItemStack guide) {
- if (SlimefunPlugin.getLocalization().isEnabled()) {
- Language language = SlimefunPlugin.getLocalization().getLanguage(p);
- String languageName = language.isDefault() ? (SlimefunPlugin.getLocalization().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + language.getName(p) + ")") : SlimefunPlugin.getLocalization().getMessage(p, "languages." + language.getId());
+ if (Slimefun.getLocalization().isEnabled()) {
+ Language language = Slimefun.getLocalization().getLanguage(p);
+ String languageName = language.isDefault() ? (Slimefun.getLocalization().getMessage(p, "languages.default") + ChatColor.DARK_GRAY + " (" + language.getName(p) + ")") : Slimefun.getLocalization().getMessage(p, "languages." + language.getId());
List lore = new ArrayList<>();
lore.add("");
- lore.add("&e&o" + SlimefunPlugin.getLocalization().getMessage(p, "guide.work-in-progress"));
+ lore.add("&e&o" + Slimefun.getLocalization().getMessage(p, "guide.work-in-progress"));
lore.add("");
- lore.addAll(SlimefunPlugin.getLocalization().getMessages(p, "guide.languages.description", msg -> msg.replace("%contributors%", String.valueOf(SlimefunPlugin.getGitHubService().getContributors().size()))));
+ lore.addAll(Slimefun.getLocalization().getMessages(p, "guide.languages.description", msg -> msg.replace("%contributors%", String.valueOf(Slimefun.getGitHubService().getContributors().size()))));
lore.add("");
- lore.add("&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.change"));
+ lore.add("&7\u21E8 &e" + Slimefun.getLocalization().getMessage(p, "guide.languages.change"));
- ItemStack item = new CustomItem(language.getItem(), "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.selected-language") + " &a" + languageName, lore.toArray(new String[0]));
+ ItemStack item = new CustomItemStack(language.getItem(), "&7" + Slimefun.getLocalization().getMessage(p, "guide.languages.selected-language") + " &a" + languageName, lore.toArray(new String[0]));
return Optional.of(item);
} else {
return Optional.empty();
@@ -62,7 +63,7 @@ public void onClick(Player p, ItemStack guide) {
@Override
public Optional getSelectedOption(Player p, ItemStack guide) {
- return Optional.of(SlimefunPlugin.getLocalization().getLanguage(p).getId());
+ return Optional.of(Slimefun.getLocalization().getLanguage(p).getId());
}
@Override
@@ -75,19 +76,19 @@ public void setSelectedOption(Player p, ItemStack guide, String value) {
}
private void openLanguageSelection(Player p, ItemStack guide) {
- ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "guide.title.languages"));
+ ChestMenu menu = new ChestMenu(Slimefun.getLocalization().getMessage(p, "guide.title.languages"));
menu.setEmptySlotsClickable(false);
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 0.7F, 0.7F));
for (int i = 0; i < 9; i++) {
if (i == 1) {
- menu.addItem(1, ChestMenuUtils.getBackButton(p, "", "&7" + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.settings")), (pl, slot, item, action) -> {
+ menu.addItem(1, ChestMenuUtils.getBackButton(p, "", "&7" + Slimefun.getLocalization().getMessage(p, "guide.back.settings")), (pl, slot, item, action) -> {
SlimefunGuideSettings.openSettings(pl, guide);
return false;
});
} else if (i == 7) {
- menu.addItem(7, new CustomItem(SlimefunUtils.getCustomHead(HeadTexture.ADD_NEW_LANGUAGE.getTexture()), SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.translations.name"), "", "&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.translations.lore")), (pl, slot, item, action) -> {
+ menu.addItem(7, new CustomItemStack(SlimefunUtils.getCustomHead(HeadTexture.ADD_NEW_LANGUAGE.getTexture()), Slimefun.getLocalization().getMessage(p, "guide.languages.translations.name"), "", "&7\u21E8 &e" + Slimefun.getLocalization().getMessage(p, "guide.languages.translations.lore")), (pl, slot, item, action) -> {
ChatUtils.sendURL(pl, "https://github.com/Slimefun/Slimefun4/wiki/Translating-Slimefun");
pl.closeInventory();
return false;
@@ -97,14 +98,14 @@ private void openLanguageSelection(Player p, ItemStack guide) {
}
}
- Language defaultLanguage = SlimefunPlugin.getLocalization().getDefaultLanguage();
- String defaultLanguageString = SlimefunPlugin.getLocalization().getMessage(p, "languages.default");
+ Language defaultLanguage = Slimefun.getLocalization().getDefaultLanguage();
+ String defaultLanguageString = Slimefun.getLocalization().getMessage(p, "languages.default");
- menu.addItem(9, new CustomItem(defaultLanguage.getItem(), ChatColor.GRAY + defaultLanguageString + ChatColor.DARK_GRAY + " (" + defaultLanguage.getName(p) + ")", "", "&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.select-default")), (pl, i, item, action) -> {
- SlimefunPlugin.instance().getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocalization().getLanguage(pl), defaultLanguage));
+ menu.addItem(9, new CustomItemStack(defaultLanguage.getItem(), ChatColor.GRAY + defaultLanguageString + ChatColor.DARK_GRAY + " (" + defaultLanguage.getName(p) + ")", "", "&7\u21E8 &e" + Slimefun.getLocalization().getMessage(p, "guide.languages.select-default")), (pl, i, item, action) -> {
+ Slimefun.instance().getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, Slimefun.getLocalization().getLanguage(pl), defaultLanguage));
setSelectedOption(pl, guide, null);
- SlimefunPlugin.getLocalization().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", defaultLanguageString));
+ Slimefun.getLocalization().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", defaultLanguageString));
SlimefunGuideSettings.openSettings(pl, guide);
return false;
@@ -112,13 +113,13 @@ private void openLanguageSelection(Player p, ItemStack guide) {
int slot = 10;
- for (Language language : SlimefunPlugin.getLocalization().getLanguages()) {
- menu.addItem(slot, new CustomItem(language.getItem(), ChatColor.GREEN + language.getName(p), "&b" + language.getTranslationProgress() + '%', "", "&7\u21E8 &e" + SlimefunPlugin.getLocalization().getMessage(p, "guide.languages.select")), (pl, i, item, action) -> {
- SlimefunPlugin.instance().getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, SlimefunPlugin.getLocalization().getLanguage(pl), language));
+ for (Language language : Slimefun.getLocalization().getLanguages()) {
+ menu.addItem(slot, new CustomItemStack(language.getItem(), ChatColor.GREEN + language.getName(p), "&b" + language.getTranslationProgress() + '%', "", "&7\u21E8 &e" + Slimefun.getLocalization().getMessage(p, "guide.languages.select")), (pl, i, item, action) -> {
+ Slimefun.instance().getServer().getPluginManager().callEvent(new PlayerLanguageChangeEvent(pl, Slimefun.getLocalization().getLanguage(pl), language));
setSelectedOption(pl, guide, language.getId());
String name = language.getName(pl);
- SlimefunPlugin.getLocalization().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", name));
+ Slimefun.getLocalization().sendMessage(pl, "guide.languages.updated", msg -> msg.replace("%lang%", name));
SlimefunGuideSettings.openSettings(pl, guide);
return false;
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 7c74f80a8c..48b7ac5a50 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
@@ -14,18 +14,19 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.bakedlibs.dough.items.CustomItemStack;
+import io.github.thebusybiscuit.slimefun4.api.researches.Research;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
-import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import io.github.thebusybiscuit.slimefun4.core.services.LocalizationService;
import io.github.thebusybiscuit.slimefun4.core.services.github.GitHubService;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
/**
@@ -59,7 +60,7 @@ public static void addOption(@Nonnull SlimefunGuideOption option) {
@ParametersAreNonnullByDefault
public static void openSettings(Player p, ItemStack guide) {
- ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "guide.title.settings"));
+ ChestMenu menu = new ChestMenu(Slimefun.getLocalization().getMessage(p, "guide.title.settings"));
menu.setEmptySlotsClickable(false);
menu.addMenuOpeningHandler(pl -> pl.playSound(pl.getLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 0.7F, 0.7F));
@@ -74,10 +75,10 @@ public static void openSettings(Player p, ItemStack guide) {
@ParametersAreNonnullByDefault
private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
- LocalizationService locale = SlimefunPlugin.getLocalization();
+ LocalizationService locale = Slimefun.getLocalization();
// @formatter:off
- menu.addItem(0, new CustomItem(SlimefunGuide.getItem(SlimefunGuideMode.SURVIVAL_MODE),
+ menu.addItem(0, new CustomItemStack(SlimefunGuide.getItem(SlimefunGuideMode.SURVIVAL_MODE),
"&e\u21E6 " + locale.getMessage(p, "guide.back.title"),
"",
"&7" + locale.getMessage(p, "guide.back.guide")
@@ -89,7 +90,7 @@ private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
return false;
});
- GitHubService github = SlimefunPlugin.getGitHubService();
+ GitHubService github = Slimefun.getGitHubService();
List contributorsLore = new ArrayList<>();
contributorsLore.add("");
@@ -98,7 +99,7 @@ private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
contributorsLore.add("&7\u21E8 &e" + locale.getMessage(p, "guide.credits.open"));
// @formatter:off
- menu.addItem(2, new CustomItem(SlimefunUtils.getCustomHead("e952d2b3f351a6b0487cc59db31bf5f2641133e5ba0006b18576e996a0293e52"),
+ menu.addItem(2, new CustomItemStack(SlimefunUtils.getCustomHead("e952d2b3f351a6b0487cc59db31bf5f2641133e5ba0006b18576e996a0293e52"),
"&c" + locale.getMessage(p, "guide.title.credits"),
contributorsLore.toArray(new String[0])
));
@@ -110,18 +111,18 @@ private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
});
// @formatter:off
- menu.addItem(4, new CustomItem(Material.WRITABLE_BOOK,
+ menu.addItem(4, new CustomItemStack(Material.WRITABLE_BOOK,
ChatColor.GREEN + locale.getMessage(p, "guide.title.versions"),
"&7&o" + locale.getMessage(p, "guide.tooltips.versions-notice"),
"",
"&fMinecraft: &a" + Bukkit.getBukkitVersion(),
- "&fSlimefun: &a" + SlimefunPlugin.getVersion()),
+ "&fSlimefun: &a" + Slimefun.getVersion()),
ChestMenuUtils.getEmptyClickHandler()
);
// @formatter:on
// @formatter:off
- menu.addItem(6, new CustomItem(Material.COMPARATOR,
+ menu.addItem(6, new CustomItemStack(Material.COMPARATOR,
"&e" + locale.getMessage(p, "guide.title.source"),
"", "&7Last Activity: &a" + NumberUtils.getElapsedTime(github.getLastUpdate()) + " ago",
"&7Forks: &e" + github.getForks(),
@@ -143,7 +144,7 @@ private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
});
// @formatter:off
- menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK,
+ menu.addItem(8, new CustomItemStack(Material.KNOWLEDGE_BOOK,
"&3" + locale.getMessage(p, "guide.title.wiki"),
"", "&7Do you need help with an Item or machine?",
"&7You cannot figure out what to do?",
@@ -161,14 +162,14 @@ private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
});
// @formatter:off
- menu.addItem(47, new CustomItem(Material.BOOKSHELF,
+ menu.addItem(47, new CustomItemStack(Material.BOOKSHELF,
"&3" + locale.getMessage(p, "guide.title.addons"),
"",
"&7Slimefun is huge. But its addons are what makes",
"&7this plugin truly shine. Go check them out, some",
"&7of them may be exactly what you were missing out on!",
"",
- "&7Installed on this Server: &b" + SlimefunPlugin.getInstalledAddons().size(),
+ "&7Installed on this Server: &b" + Slimefun.getInstalledAddons().size(),
"",
"&7\u21E8 &eClick to see all available addons for Slimefun4"
));
@@ -180,9 +181,9 @@ private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
return false;
});
- if (SlimefunPlugin.getUpdater().getBranch().isOfficial()) {
+ if (Slimefun.getUpdater().getBranch().isOfficial()) {
// @formatter:off
- menu.addItem(49, new CustomItem(Material.REDSTONE_TORCH,
+ menu.addItem(49, new CustomItemStack(Material.REDSTONE_TORCH,
"&4" + locale.getMessage(p, "guide.title.bugs"),
"",
"&7&oBug reports have to be made in English!",
@@ -203,7 +204,7 @@ private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {
menu.addItem(49, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
}
- menu.addItem(51, new CustomItem(Material.TOTEM_OF_UNDYING, ChatColor.RED + locale.getMessage(p, "guide.work-in-progress")), (pl, slot, item, action) -> {
+ menu.addItem(51, new CustomItemStack(Material.TOTEM_OF_UNDYING, ChatColor.RED + locale.getMessage(p, "guide.work-in-progress")), (pl, slot, item, action) -> {
// Add something here
return false;
});
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 c22731e79a..7bd704a509 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
@@ -11,9 +11,9 @@
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.api.events.AndroidMineEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.androids.MinerAndroid;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
/**
* The {@link BlockBreakHandler} is called when a {@link Block} is broken
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockDispenseHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockDispenseHandler.java
index 4376080967..8f10c0fa97 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockDispenseHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockDispenseHandler.java
@@ -8,10 +8,10 @@
import org.bukkit.event.block.BlockDispenseEvent;
import io.github.thebusybiscuit.slimefun4.api.exceptions.IncompatibleItemHandlerException;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.BlockPlacer;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
/**
* This {@link ItemHandler} is triggered when the {@link SlimefunItem} it was assigned to
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 871040f67b..e2cb771bfc 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
@@ -7,9 +7,9 @@
import org.bukkit.event.block.BlockPlaceEvent;
import io.github.thebusybiscuit.slimefun4.api.events.BlockPlacerPlaceEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.BlockPlacer;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
/**
* This {@link ItemHandler} is called whenever a {@link Block} was placed.
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockUseHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockUseHandler.java
index a88f963d0e..0aeac6f4a9 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockUseHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BlockUseHandler.java
@@ -4,9 +4,9 @@
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
import io.github.thebusybiscuit.slimefun4.api.exceptions.IncompatibleItemHandlerException;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
@FunctionalInterface
public interface BlockUseHandler extends ItemHandler {
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BowShootHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BowShootHandler.java
index 6cfa617689..f2c5aa7df0 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BowShootHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/BowShootHandler.java
@@ -7,9 +7,9 @@
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import io.github.thebusybiscuit.slimefun4.api.exceptions.IncompatibleItemHandlerException;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SlimefunBow;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
/**
* This {@link ItemHandler} is triggered when the {@link SlimefunItem} it was assigned to
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/EntityInteractHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/EntityInteractHandler.java
index ca50f0abef..1091d3a335 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/EntityInteractHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/EntityInteractHandler.java
@@ -7,10 +7,10 @@
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.entity.EntityInteractionListener;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
/**
* This is triggered when a {@link Player} interacts with an {@link Entity}.
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/EntityKillHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/EntityKillHandler.java
index 919da18a9f..21ec3c0179 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/EntityKillHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/EntityKillHandler.java
@@ -5,9 +5,9 @@
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
/**
* If this {@link ItemHandler} is added to a {@link SlimefunItem} it will listen
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/GlobalItemHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/GlobalItemHandler.java
index e747a41c8d..df5f0a92e7 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/GlobalItemHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/GlobalItemHandler.java
@@ -3,8 +3,8 @@
import org.bukkit.event.Event;
import org.bukkit.event.Listener;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* A {@link GlobalItemHandler} is a special type of {@link ItemHandler}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemConsumptionHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemConsumptionHandler.java
index 3e7756cf8d..69a5d44089 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemConsumptionHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemConsumptionHandler.java
@@ -4,11 +4,11 @@
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.food.DietCookie;
import io.github.thebusybiscuit.slimefun4.implementation.items.food.FortuneCookie;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
/**
* This {@link ItemHandler} is triggered when the {@link SlimefunItem} it was assigned to
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemDropHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemDropHandler.java
index f11506e0f2..a0e6efbb6a 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemDropHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemDropHandler.java
@@ -6,7 +6,7 @@
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerDropItemEvent;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
/**
* The {@link ItemDropHandler} is a {@link GlobalItemHandler} which listens to
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemUseHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemUseHandler.java
index cccbb295cd..e0ef00c672 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemUseHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ItemUseHandler.java
@@ -3,9 +3,9 @@
import org.bukkit.entity.Player;
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
/**
* This {@link ItemHandler} is triggered when the {@link SlimefunItem} it was assigned to
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/MultiBlockInteractionHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/MultiBlockInteractionHandler.java
index 36f2ce0ed1..0ae90600bd 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/MultiBlockInteractionHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/MultiBlockInteractionHandler.java
@@ -6,10 +6,10 @@
import org.bukkit.entity.Player;
import io.github.thebusybiscuit.slimefun4.api.exceptions.IncompatibleItemHandlerException;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlock;
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
/**
* This {@link ItemHandler} is called whenever a {@link Player} interacts with
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 78fe5c98fb..17e01dde0f 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
@@ -12,13 +12,14 @@
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.GlassPane;
-import io.github.thebusybiscuit.cscorelib2.collections.LoopIterator;
+import io.github.bakedlibs.dough.collections.LoopIterator;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.RainbowBlock;
import io.github.thebusybiscuit.slimefun4.utils.ColoredMaterial;
+
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
/**
@@ -69,7 +70,7 @@ public RainbowTickHandler(@Nonnull ColoredMaterial material) {
* @return Whether the array contained any {@link GlassPane} materials
*/
private boolean containsGlassPanes(@Nonnull List materials) {
- if (SlimefunPlugin.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) {
+ if (Slimefun.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) {
// BlockData is not available to us during Unit Tests :/
return false;
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ToolUseHandler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ToolUseHandler.java
index df533811df..579b5f5749 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ToolUseHandler.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/handlers/ToolUseHandler.java
@@ -7,8 +7,8 @@
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* This {@link ItemHandler} is called when a {@link Block} is broken with a {@link SlimefunItem}
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 b31a29732f..99fda746be 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
@@ -7,8 +7,8 @@
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.inventory.ItemStack;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* This is triggered when a {@link Player} attacks an {@link Entity}.
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 5d192ee748..71aa91b8a5 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
@@ -13,10 +13,11 @@
import org.bukkit.event.Event;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.blocks.BlockPosition;
+import io.github.bakedlibs.dough.blocks.BlockPosition;
import io.github.thebusybiscuit.slimefun4.api.events.AsyncMachineOperationFinishEvent;
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineProcessHolder;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
+
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
/**
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 b311205bd5..d69e862149 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
@@ -16,9 +16,9 @@
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.api.events.MultiBlockInteractEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.handlers.MultiBlockInteractionHandler;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* A {@link MultiBlock} represents a structure build in a {@link World}.
@@ -45,7 +45,7 @@ public class MultiBlock {
SUPPORTED_TAGS.add(Tag.WOODEN_FENCES);
// Add Soul Fire support on 1.16
- if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
+ if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
SUPPORTED_TAGS.add(Tag.FIRE);
}
}
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 35ec1e17da..3f3f9c17cf 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
@@ -20,22 +20,21 @@
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
-import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
+import io.github.bakedlibs.dough.inventory.InvUtils;
+import io.github.bakedlibs.dough.protection.Interaction;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSpawnReason;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.core.handlers.MultiBlockInteractionHandler;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.OutputChest;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-
/**
* A {@link MultiBlockMachine} is a {@link SlimefunItem} that is built in the {@link World}.
* It holds recipes and a {@link MultiBlock} object which represents its structure.
@@ -52,7 +51,7 @@ public abstract class MultiBlockMachine extends SlimefunItem implements NotPlace
protected final MultiBlock multiblock;
@ParametersAreNonnullByDefault
- protected MultiBlockMachine(Category category, SlimefunItemStack item, ItemStack[] recipe, ItemStack[] machineRecipes, BlockFace trigger) {
+ protected MultiBlockMachine(ItemGroup category, SlimefunItemStack item, ItemStack[] recipe, ItemStack[] machineRecipes, BlockFace trigger) {
super(category, item, RecipeType.MULTIBLOCK, recipe);
this.recipes = new ArrayList<>();
this.displayRecipes = new ArrayList<>();
@@ -63,7 +62,7 @@ protected MultiBlockMachine(Category category, SlimefunItemStack item, ItemStack
}
@ParametersAreNonnullByDefault
- protected MultiBlockMachine(Category category, SlimefunItemStack item, ItemStack[] recipe, BlockFace trigger) {
+ protected MultiBlockMachine(ItemGroup category, SlimefunItemStack item, ItemStack[] recipe, BlockFace trigger) {
this(category, item, recipe, new ItemStack[0], trigger);
}
@@ -99,7 +98,7 @@ public void register(@Nonnull SlimefunAddon addon) {
@Override
public void postRegister() {
- SlimefunPlugin.getRegistry().getMultiBlocks().add(multiblock);
+ Slimefun.getRegistry().getMultiBlocks().add(multiblock);
}
@Override
@@ -118,7 +117,7 @@ public void load() {
protected @Nonnull MultiBlockInteractionHandler getInteractionHandler() {
return (p, mb, b) -> {
if (mb.equals(getMultiBlock())) {
- if (canUse(p, true) && SlimefunPlugin.getProtectionManager().hasPermission(p, b.getLocation(), ProtectableAction.INTERACT_BLOCK)) {
+ if (canUse(p, true) && Slimefun.getProtectionManager().hasPermission(p, b.getLocation(), Interaction.INTERACT_BLOCK)) {
onInteract(p, b);
}
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 dd726af28a..14d88e121d 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
@@ -14,13 +14,14 @@
import org.bukkit.Location;
import org.bukkit.Server;
-import io.github.thebusybiscuit.cscorelib2.blocks.BlockPosition;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
+import io.github.bakedlibs.dough.blocks.BlockPosition;
+import io.github.bakedlibs.dough.config.Config;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.api.network.Network;
import io.github.thebusybiscuit.slimefun4.core.networks.cargo.CargoNet;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.NetworkListener;
+
import me.mrCookieSlime.Slimefun.api.BlockStorage;
/**
@@ -201,7 +202,7 @@ public void updateAllNetworks(@Nonnull Location l) {
*
* (Skip for Unit Tests as they don't support block info yet)
*/
- if (!BlockStorage.hasBlockInfo(l) && SlimefunPlugin.getMinecraftVersion() != MinecraftVersion.UNIT_TEST) {
+ if (!BlockStorage.hasBlockInfo(l) && Slimefun.getMinecraftVersion() != MinecraftVersion.UNIT_TEST) {
return;
}
@@ -209,7 +210,7 @@ public void updateAllNetworks(@Nonnull Location l) {
network.markDirty(l);
}
} catch (Exception x) {
- SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "An Exception was thrown while causing a networks update @ " + new BlockPosition(l));
+ Slimefun.logger().log(Level.SEVERE, x, () -> "An Exception was thrown while causing a networks update @ " + new BlockPosition(l));
}
}
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 6261f4593c..82666eacb5 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
@@ -17,7 +17,6 @@
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
-import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -30,15 +29,17 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.bakedlibs.dough.common.ChatColors;
+import io.github.bakedlibs.dough.items.CustomItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.network.Network;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
import io.papermc.lib.PaperLib;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
@@ -58,7 +59,7 @@ abstract class AbstractItemNetwork extends Network {
private static final int[] TERMINAL_SLOTS = { 0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 39, 40, 41, 42 };
private static final int TERMINAL_OUT_SLOT = 17;
- private final ItemStack terminalPlaceholderItem = new CustomItem(Material.BARRIER, "&4No Item cached");
+ private final ItemStack terminalPlaceholderItem = new CustomItemStack(Material.BARRIER, "&4No Item cached");
protected final Set terminals = new HashSet<>();
protected final Set imports = new HashSet<>();
@@ -81,7 +82,7 @@ abstract class AbstractItemNetwork extends Network {
protected Map filterCache = new HashMap<>();
protected AbstractItemNetwork(Location regulator) {
- super(SlimefunPlugin.getNetworkManager(), regulator);
+ super(Slimefun.getNetworkManager(), regulator);
}
protected Optional getAttachedBlock(Location l) {
@@ -174,13 +175,13 @@ private void collectExtractionRequest(Map inventories, Item
if (stack == null) {
stack = is;
} else {
- stack = new CustomItem(stack, stack.getAmount() + is.getAmount());
+ stack = new CustomItemStack(stack, stack.getAmount() + is.getAmount());
}
if (is.getAmount() == item.getAmount()) {
break;
} else {
- item = new CustomItem(item, item.getAmount() - is.getAmount());
+ item = new CustomItemStack(item, item.getAmount() - is.getAmount());
}
}
}
@@ -192,7 +193,7 @@ private void collectExtractionRequest(Map inventories, Item
if (prev == null) {
terminal.replaceExistingItem(slot, stack);
} else {
- terminal.replaceExistingItem(slot, new CustomItem(stack, stack.getAmount() + prev.getAmount()));
+ terminal.replaceExistingItem(slot, new CustomItemStack(stack, stack.getAmount() + prev.getAmount()));
}
}
@@ -200,10 +201,10 @@ private void collectExtractionRequest(Map inventories, Item
}
private void collectImportRequests(Map inventories) {
- SlimefunItem item = SlimefunItem.getByID("CT_IMPORT_BUS");
+ SlimefunItem item = SlimefunItem.getById("CT_IMPORT_BUS");
for (Location bus : imports) {
- long timestamp = SlimefunPlugin.getProfiler().newEntry();
+ long timestamp = Slimefun.getProfiler().newEntry();
BlockMenu menu = BlockStorage.getInventory(bus);
if (menu.getItemInSlot(17) == null) {
@@ -222,15 +223,15 @@ private void collectImportRequests(Map inventories) {
itemRequests.add(new ItemRequest(bus, 17, menu.getItemInSlot(17), ItemTransportFlow.INSERT));
}
- SlimefunPlugin.getProfiler().closeEntry(bus, item, timestamp);
+ Slimefun.getProfiler().closeEntry(bus, item, timestamp);
}
}
private void collectExportRequests(Map inventories) {
- SlimefunItem item = SlimefunItem.getByID("CT_EXPORT_BUS");
+ SlimefunItem item = SlimefunItem.getById("CT_EXPORT_BUS");
for (Location bus : exports) {
- long timestamp = SlimefunPlugin.getProfiler().newEntry();
+ long timestamp = Slimefun.getProfiler().newEntry();
BlockMenu menu = BlockStorage.getInventory(bus);
ItemStack itemSlot17 = menu.getItemInSlot(17);
@@ -246,7 +247,7 @@ private void collectExportRequests(Map inventories) {
ItemStack template = menu.getItemInSlot(slot);
if (template != null) {
- items.add(new CustomItem(template, 1));
+ items.add(new CustomItemStack(template, 1));
}
}
@@ -263,7 +264,7 @@ private void collectExportRequests(Map inventories) {
}
}
- SlimefunPlugin.getProfiler().closeEntry(bus, item, timestamp);
+ Slimefun.getProfiler().closeEntry(bus, item, timestamp);
}
}
@@ -298,7 +299,7 @@ protected long updateTerminals(@Nonnull Set providers) {
// gonna use no more than one terminal anyway, so this might be fine
long timestamp = System.nanoTime();
Location firstTerminal = null;
- SlimefunItem item = SlimefunItem.getByID("CHEST_TERMINAL");
+ SlimefunItem item = SlimefunItem.getById("CHEST_TERMINAL");
List items = findAvailableItems(providers);
try {
@@ -327,7 +328,7 @@ protected long updateTerminals(@Nonnull Set providers) {
}
if (firstTerminal != null) {
- return SlimefunPlugin.getProfiler().closeEntry(firstTerminal, item, timestamp);
+ return Slimefun.getProfiler().closeEntry(firstTerminal, item, timestamp);
} else {
return System.nanoTime() - timestamp;
}
@@ -386,7 +387,7 @@ private void updateTerminal(Location l, BlockMenu terminal, int slot, int index,
terminal.replaceExistingItem(slot, stack);
terminal.addMenuClickHandler(slot, (p, sl, is, action) -> {
int amount = item.getInt() > item.getItem().getMaxStackSize() ? item.getItem().getMaxStackSize() : item.getInt();
- ItemStack requestedItem = new CustomItem(item.getItem(), action.isRightClicked() ? amount : 1);
+ ItemStack requestedItem = new CustomItemStack(item.getItem(), action.isRightClicked() ? amount : 1);
itemRequests.add(new ItemRequest(l, 44, requestedItem, ItemTransportFlow.WITHDRAW));
return false;
});
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 7b236c0950..29b87c18b3 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
@@ -16,11 +16,12 @@
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
+import io.github.bakedlibs.dough.common.CommonPatterns;
import io.github.thebusybiscuit.slimefun4.api.network.Network;
import io.github.thebusybiscuit.slimefun4.api.network.NetworkComponent;
import io.github.thebusybiscuit.slimefun4.core.attributes.HologramOwner;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
+
import me.mrCookieSlime.Slimefun.api.BlockStorage;
/**
@@ -41,7 +42,7 @@
public class CargoNet extends AbstractItemNetwork implements HologramOwner {
private static final int RANGE = 5;
- private static final int TICK_DELAY = SlimefunPlugin.getCfg().getInt("networks.cargo-ticker-delay");
+ private static final int TICK_DELAY = Slimefun.getCfg().getInt("networks.cargo-ticker-delay");
private final Set inputNodes = new HashSet<>();
private final Set outputNodes = new HashSet<>();
@@ -51,18 +52,18 @@ public class CargoNet extends AbstractItemNetwork implements HologramOwner {
@Nullable
public static CargoNet getNetworkFromLocation(@Nonnull Location l) {
- return SlimefunPlugin.getNetworkManager().getNetworkFromLocation(l, CargoNet.class).orElse(null);
+ return Slimefun.getNetworkManager().getNetworkFromLocation(l, CargoNet.class).orElse(null);
}
@Nonnull
public static CargoNet getNetworkFromLocationOrCreate(@Nonnull Location l) {
- Optional cargoNetwork = SlimefunPlugin.getNetworkManager().getNetworkFromLocation(l, CargoNet.class);
+ Optional cargoNetwork = Slimefun.getNetworkManager().getNetworkFromLocation(l, CargoNet.class);
if (cargoNetwork.isPresent()) {
return cargoNetwork.get();
} else {
CargoNet network = new CargoNet(l);
- SlimefunPlugin.getNetworkManager().registerNetwork(network);
+ Slimefun.getNetworkManager().registerNetwork(network);
return network;
}
}
@@ -183,10 +184,10 @@ public void tick(@Nonnull Block b) {
display();
}
- SlimefunPlugin.getProfiler().scheduleEntries((terminals.isEmpty() ? 1 : 2) + inputs.size());
+ Slimefun.getProfiler().scheduleEntries((terminals.isEmpty() ? 1 : 2) + inputs.size());
CargoNetworkTask runnable = new CargoNetworkTask(this, inputs, outputs, chestTerminalInputs, chestTerminalOutputs);
- SlimefunPlugin.runSync(runnable);
+ Slimefun.runSync(runnable);
}
}
@@ -260,8 +261,8 @@ private static int getFrequency(@Nonnull Location node) {
if (frequency == null) {
return 0;
- } else if (!PatternUtils.NUMERIC.matcher(frequency).matches()) {
- SlimefunPlugin.logger().log(Level.SEVERE, () -> "Failed to parse a Cargo Node Frequency (" + node.getWorld().getName() + " - " + node.getBlockX() + ',' + node.getBlockY() + ',' + node.getBlockZ() + "): " + frequency);
+ } else if (!CommonPatterns.NUMERIC.matcher(frequency).matches()) {
+ Slimefun.logger().log(Level.SEVERE, () -> "Failed to parse a Cargo Node Frequency (" + node.getWorld().getName() + " - " + node.getBlockX() + ',' + node.getBlockY() + ',' + node.getBlockZ() + "): " + frequency);
return 0;
} else {
return Integer.parseInt(frequency);
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNetworkTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNetworkTask.java
index 176c46de5a..edece7dcbd 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNetworkTask.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/CargoNetworkTask.java
@@ -20,16 +20,16 @@
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.blocks.BlockPosition;
+import io.github.bakedlibs.dough.blocks.BlockPosition;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSpawnReason;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.networks.NetworkManager;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
@@ -61,7 +61,7 @@ class CargoNetworkTask implements Runnable {
@ParametersAreNonnullByDefault
CargoNetworkTask(CargoNet network, Map inputs, Map> outputs, Set chestTerminalInputs, Set chestTerminalOutputs) {
this.network = network;
- this.manager = SlimefunPlugin.getNetworkManager();
+ this.manager = Slimefun.getNetworkManager();
this.inputs = inputs;
this.outputs = outputs;
@@ -75,7 +75,7 @@ public void run() {
try {
// Chest Terminal Code
- if (SlimefunPlugin.getIntegrations().isChestTerminalInstalled()) {
+ if (Slimefun.getIntegrations().isChestTerminalInstalled()) {
network.handleItemRequests(inventories, chestTerminalInputs, chestTerminalOutputs);
}
@@ -92,20 +92,20 @@ public void run() {
attachedBlock.ifPresent(block -> routeItems(input, block, entry.getValue(), outputs));
// This will prevent this timings from showing up for the Cargo Manager
- timestamp += SlimefunPlugin.getProfiler().closeEntry(entry.getKey(), inputNode, nodeTimestamp);
+ timestamp += Slimefun.getProfiler().closeEntry(entry.getKey(), inputNode, nodeTimestamp);
}
// Chest Terminal Code
- if (SlimefunPlugin.getIntegrations().isChestTerminalInstalled()) {
+ if (Slimefun.getIntegrations().isChestTerminalInstalled()) {
// This will deduct any CT timings and attribute them towards the actual terminal
timestamp += network.updateTerminals(chestTerminalInputs);
}
} catch (Exception | LinkageError x) {
- SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "An Exception was caught while ticking a Cargo network @ " + new BlockPosition(network.getRegulator()));
+ Slimefun.logger().log(Level.SEVERE, x, () -> "An Exception was caught while ticking a Cargo network @ " + new BlockPosition(network.getRegulator()));
}
// Submit a timings report
- SlimefunPlugin.getProfiler().closeEntry(network.getRegulator(), SlimefunItems.CARGO_MANAGER.getItem(), timestamp);
+ Slimefun.getProfiler().closeEntry(network.getRegulator(), SlimefunItems.CARGO_MANAGER.getItem(), timestamp);
}
@ParametersAreNonnullByDefault
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 0c9b58c54d..c5b3b9b52f 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
@@ -16,12 +16,13 @@
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.bakedlibs.dough.inventory.InvUtils;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag;
import io.papermc.lib.PaperLib;
+
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.DirtyChestMenu;
@@ -409,7 +410,7 @@ private static boolean isSmeltable(@Nullable ItemStack stack, boolean lazy) {
if (lazy) {
return stack != null && Tag.LOGS.isTagged(stack.getType());
} else {
- return SlimefunPlugin.getMinecraftRecipeService().isSmeltable(stack);
+ return Slimefun.getMinecraftRecipeService().isSmeltable(stack);
}
}
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 7fbbb71969..dc0bc529fb 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
@@ -11,11 +11,12 @@
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.cargo.CargoNode;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
+
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
@@ -79,7 +80,7 @@ public void update(@Nonnull Block b) {
// Store the returned Config instance to avoid heavy calls
Config blockData = BlockStorage.getLocationInfo(b.getLocation());
String id = blockData.getString("id");
- SlimefunItem item = SlimefunItem.getByID(id);
+ SlimefunItem item = SlimefunItem.getById(id);
BlockMenu menu = BlockStorage.getInventory(b.getLocation());
if (!(item instanceof CargoNode) || menu == null) {
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 6d3c0bcaa8..d149efdc79 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
@@ -1,12 +1,12 @@
package io.github.thebusybiscuit.slimefun4.core.networks.cargo;
+import javax.annotation.Nonnull;
+
import org.apache.commons.lang.Validate;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
-import javax.annotation.Nonnull;
-
class ItemStackAndInteger {
private ItemStack 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 d91e4c2b6f..da488e7d7c 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
@@ -16,16 +16,17 @@
import org.bukkit.block.Block;
import io.github.thebusybiscuit.slimefun4.api.ErrorReport;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.network.Network;
import io.github.thebusybiscuit.slimefun4.api.network.NetworkComponent;
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetProvider;
import io.github.thebusybiscuit.slimefun4.core.attributes.HologramOwner;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
+
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
/**
@@ -50,7 +51,7 @@ public class EnergyNet extends Network implements HologramOwner {
private final Map consumers = new HashMap<>();
protected EnergyNet(@Nonnull Location l) {
- super(SlimefunPlugin.getNetworkManager(), l);
+ super(Slimefun.getNetworkManager(), l);
}
@Override
@@ -118,11 +119,11 @@ public void onClassificationChange(Location l, NetworkComponent from, NetworkCom
}
public void tick(@Nonnull Block b) {
- AtomicLong timestamp = new AtomicLong(SlimefunPlugin.getProfiler().newEntry());
+ AtomicLong timestamp = new AtomicLong(Slimefun.getProfiler().newEntry());
if (!regulator.equals(b.getLocation())) {
updateHologram(b, "&4Multiple Energy Regulators connected");
- SlimefunPlugin.getProfiler().closeEntry(b.getLocation(), SlimefunItems.ENERGY_REGULATOR.getItem(), timestamp.get());
+ Slimefun.getProfiler().closeEntry(b.getLocation(), SlimefunItems.ENERGY_REGULATOR.getItem(), timestamp.get());
return;
}
@@ -162,7 +163,7 @@ public void tick(@Nonnull Block b) {
}
// We have subtracted the timings from Generators, so they do not show up twice.
- SlimefunPlugin.getProfiler().closeEntry(b.getLocation(), SlimefunItems.ENERGY_REGULATOR.getItem(), timestamp.get());
+ Slimefun.getProfiler().closeEntry(b.getLocation(), SlimefunItems.ENERGY_REGULATOR.getItem(), timestamp.get());
}
private void storeRemainingEnergy(int remainingEnergy) {
@@ -209,7 +210,7 @@ private int tickAllGenerators(@Nonnull LongConsumer timings) {
int supply = 0;
for (Map.Entry entry : generators.entrySet()) {
- long timestamp = SlimefunPlugin.getProfiler().newEntry();
+ long timestamp = Slimefun.getProfiler().newEntry();
Location loc = entry.getKey();
EnergyNetProvider provider = entry.getValue();
SlimefunItem item = (SlimefunItem) provider;
@@ -226,7 +227,7 @@ private int tickAllGenerators(@Nonnull LongConsumer timings) {
explodedBlocks.add(loc);
BlockStorage.clearBlockInfo(loc);
- SlimefunPlugin.runSync(() -> {
+ Slimefun.runSync(() -> {
loc.getBlock().setType(Material.LAVA);
loc.getWorld().createExplosion(loc, 0F, false);
});
@@ -238,7 +239,7 @@ private int tickAllGenerators(@Nonnull LongConsumer timings) {
new ErrorReport<>(throwable, loc, item);
}
- long time = SlimefunPlugin.getProfiler().closeEntry(loc, item, timestamp);
+ long time = Slimefun.getProfiler().closeEntry(loc, item, timestamp);
timings.accept(time);
}
@@ -292,7 +293,7 @@ private static EnergyNetComponent getComponent(@Nonnull Location l) {
*/
@Nullable
public static EnergyNet getNetworkFromLocation(@Nonnull Location l) {
- return SlimefunPlugin.getNetworkManager().getNetworkFromLocation(l, EnergyNet.class).orElse(null);
+ return Slimefun.getNetworkManager().getNetworkFromLocation(l, EnergyNet.class).orElse(null);
}
/**
@@ -306,13 +307,13 @@ public static EnergyNet getNetworkFromLocation(@Nonnull Location l) {
*/
@Nonnull
public static EnergyNet getNetworkFromLocationOrCreate(@Nonnull Location l) {
- Optional energyNetwork = SlimefunPlugin.getNetworkManager().getNetworkFromLocation(l, EnergyNet.class);
+ Optional energyNetwork = Slimefun.getNetworkManager().getNetworkFromLocation(l, EnergyNet.class);
if (energyNetwork.isPresent()) {
return energyNetwork.get();
} else {
EnergyNet network = new EnergyNet(l);
- SlimefunPlugin.getNetworkManager().registerNetwork(network);
+ Slimefun.getNetworkManager().registerNetwork(network);
return network;
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNetComponentType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNetComponentType.java
index ef05a84669..8340260dcb 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNetComponentType.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNetComponentType.java
@@ -6,6 +6,7 @@
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.Capacitor;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.EnergyConnector;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.reactors.Reactor;
+
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AGenerator;
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 75112519bd..a0455323f6 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
@@ -13,7 +13,8 @@
import org.bukkit.entity.Player;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
+
import me.mrCookieSlime.Slimefun.api.BlockStorage;
/**
@@ -35,7 +36,7 @@ public class AutoSavingService {
* @param interval
* The interval in which to run this task
*/
- public void start(@Nonnull SlimefunPlugin plugin, int interval) {
+ public void start(@Nonnull Slimefun plugin, int interval) {
this.interval = interval;
plugin.getServer().getScheduler().runTaskTimer(plugin, this::saveAllPlayers, 2000L, interval * 60L * 20L);
@@ -65,7 +66,7 @@ private void saveAllPlayers() {
}
if (players > 0) {
- SlimefunPlugin.logger().log(Level.INFO, "Auto-saved all player data for {0} player(s)!", players);
+ Slimefun.logger().log(Level.INFO, "Auto-saved all player data for {0} player(s)!", players);
}
}
@@ -88,7 +89,7 @@ private void saveAllBlocks() {
}
if (!worlds.isEmpty()) {
- SlimefunPlugin.logger().log(Level.INFO, "Auto-saving block data... (Next auto-save: {0}m)", interval);
+ Slimefun.logger().log(Level.INFO, "Auto-saving block data... (Next auto-save: {0}m)", interval);
for (BlockStorage storage : worlds) {
storage.save();
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 a4827a4191..80ce5b999b 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
@@ -19,7 +19,7 @@
import org.apache.commons.lang.Validate;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This Service creates a Backup of your Slimefun world data on every server shutdown.
@@ -54,7 +54,7 @@ public void run() {
try {
purgeBackups(backups);
} catch (IOException e) {
- SlimefunPlugin.logger().log(Level.WARNING, "Could not delete an old backup", e);
+ Slimefun.logger().log(Level.WARNING, "Could not delete an old backup", e);
}
}
@@ -67,12 +67,12 @@ public void run() {
createBackup(output);
}
- SlimefunPlugin.logger().log(Level.INFO, "Backed up Slimefun data to: {0}", file.getName());
+ Slimefun.logger().log(Level.INFO, "Backed up Slimefun data to: {0}", file.getName());
} else {
- SlimefunPlugin.logger().log(Level.WARNING, "Could not create backup-file: {0}", file.getName());
+ Slimefun.logger().log(Level.WARNING, "Could not create backup-file: {0}", file.getName());
}
} catch (IOException x) {
- SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "An Exception occurred while creating a backup for Slimefun " + SlimefunPlugin.getVersion());
+ Slimefun.logger().log(Level.SEVERE, x, () -> "An Exception occurred while creating a backup for Slimefun " + Slimefun.getVersion());
}
}
}
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 462ec8f04a..2d952c642d 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
@@ -19,7 +19,7 @@
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.Plugin;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.papermc.lib.PaperLib;
/**
@@ -78,12 +78,12 @@ public void setBlockData(@Nonnull Block b, @Nonnull String value) {
container.set(namespacedKey, PersistentDataType.STRING, value);
state.update();
} catch (Exception x) {
- SlimefunPlugin.logger().log(Level.SEVERE, "Please check if your Server Software is up to date!");
+ Slimefun.logger().log(Level.SEVERE, "Please check if your Server Software is up to date!");
String serverSoftware = PaperLib.isSpigot() && !PaperLib.isPaper() ? "Spigot" : Bukkit.getName();
- SlimefunPlugin.logger().log(Level.SEVERE, () -> serverSoftware + " | " + Bukkit.getVersion() + " | " + Bukkit.getBukkitVersion());
+ Slimefun.logger().log(Level.SEVERE, () -> serverSoftware + " | " + Bukkit.getVersion() + " | " + Bukkit.getBukkitVersion());
- SlimefunPlugin.logger().log(Level.SEVERE, "An Exception was thrown while trying to set Persistent Data for a Block", x);
+ Slimefun.logger().log(Level.SEVERE, "An Exception was thrown while trying to set Persistent Data for a Block", x);
}
}
}
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 dceed32418..fa5d258627 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
@@ -15,8 +15,8 @@
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.Plugin;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
/**
* This Service is responsible for applying NBT data to a {@link SlimefunItemStack}.
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 faa6326bef..7c84a1de2a 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
@@ -16,10 +16,10 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import io.github.bakedlibs.dough.config.Config;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This Service is responsible for applying custom model data to any {@link SlimefunItemStack}
@@ -93,7 +93,7 @@ public void register(@Nonnull Collection items, boolean save) {
}
private void loadDefaultValues() {
- InputStream inputStream = SlimefunPlugin.class.getResourceAsStream("/item-models.yml");
+ InputStream inputStream = Slimefun.class.getResourceAsStream("/item-models.yml");
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
FileConfiguration cfg = YamlConfiguration.loadConfiguration(reader);
@@ -102,7 +102,7 @@ private void loadDefaultValues() {
config.setDefaultValue(key, cfg.getInt(key));
}
} catch (Exception e) {
- SlimefunPlugin.logger().log(Level.SEVERE, "Failed to load default item-models.yml file", e);
+ Slimefun.logger().log(Level.SEVERE, "Failed to load default item-models.yml file", e);
}
}
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 4a78b3974e..75c9e56913 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
@@ -27,7 +27,7 @@
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
import io.github.thebusybiscuit.slimefun4.core.services.localization.LanguageFile;
import io.github.thebusybiscuit.slimefun4.core.services.localization.SlimefunLocalization;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
/**
@@ -46,12 +46,12 @@ public class LocalizationService extends SlimefunLocalization {
// All supported languages are stored in this LinkedHashMap, it is Linked so we keep the order
private final Map languages = new LinkedHashMap<>();
private final boolean translationsEnabled;
- private final SlimefunPlugin plugin;
+ private final Slimefun plugin;
private final String prefix;
private final NamespacedKey languageKey;
private final Language defaultLanguage;
- public LocalizationService(@Nonnull SlimefunPlugin plugin, @Nullable String prefix, @Nullable String serverDefaultLanguage) {
+ public LocalizationService(@Nonnull Slimefun plugin, @Nullable String prefix, @Nullable String serverDefaultLanguage) {
super(plugin);
this.plugin = plugin;
@@ -59,7 +59,7 @@ public LocalizationService(@Nonnull SlimefunPlugin plugin, @Nullable String pref
languageKey = new NamespacedKey(plugin, LANGUAGE_PATH);
if (serverDefaultLanguage != null) {
- translationsEnabled = SlimefunPlugin.getCfg().getBoolean("options.enable-translations");
+ translationsEnabled = Slimefun.getCfg().getBoolean("options.enable-translations");
defaultLanguage = new Language(serverDefaultLanguage, "11b3188fd44902f72602bd7c2141f5a70673a411adb3d81862c69e536166b");
defaultLanguage.setFile(LanguageFile.MESSAGES, getConfig().getConfiguration());
@@ -79,7 +79,7 @@ public LocalizationService(@Nonnull SlimefunPlugin plugin, @Nullable String pref
plugin.getLogger().log(Level.WARNING, "Could not recognize the given language: \"{0}\"", serverDefaultLanguage);
}
- SlimefunPlugin.logger().log(Level.INFO, "Available languages: {0}", String.join(", ", languages.keySet()));
+ Slimefun.logger().log(Level.INFO, "Available languages: {0}", String.join(", ", languages.keySet()));
save();
} else {
translationsEnabled = false;
@@ -178,7 +178,7 @@ private void setLanguage(@Nonnull String language, boolean reset) {
}
}
- SlimefunPlugin.logger().log(Level.INFO, "Loaded language \"{0}\"", language);
+ Slimefun.logger().log(Level.INFO, "Loaded language \"{0}\"", language);
getConfig().setValue(LANGUAGE_PATH, language);
// Loading in the defaults from our resources folder
@@ -188,7 +188,7 @@ private void setLanguage(@Nonnull String language, boolean reset) {
FileConfiguration config = YamlConfiguration.loadConfiguration(reader);
getConfig().getConfiguration().setDefaults(config);
} catch (IOException e) {
- SlimefunPlugin.logger().log(Level.SEVERE, e, () -> "Failed to load language file: \"" + path + "\"");
+ Slimefun.logger().log(Level.SEVERE, e, () -> "Failed to load language file: \"" + path + "\"");
}
save();
@@ -266,7 +266,7 @@ private FileConfiguration streamConfigFile(@Nonnull String file, @Nullable FileC
return config;
} catch (IOException e) {
- SlimefunPlugin.logger().log(Level.SEVERE, e, () -> "Failed to load language file into memory: \"" + file + "\"");
+ Slimefun.logger().log(Level.SEVERE, e, () -> "Failed to load language file into memory: \"" + file + "\"");
return new YamlConfiguration();
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java
index d70276444f..eda60a5594 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/MetricsService.java
@@ -15,8 +15,9 @@
import org.bukkit.plugin.Plugin;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
+import io.github.bakedlibs.dough.common.CommonPatterns;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
+
import kong.unirest.GetRequest;
import kong.unirest.HttpResponse;
import kong.unirest.JsonNode;
@@ -56,7 +57,7 @@ public class MetricsService {
*/
private static final String DOWNLOAD_URL = "https://github.com/Slimefun/" + REPO_NAME + "/releases/download";
- private final SlimefunPlugin plugin;
+ private final Slimefun plugin;
private final File parentFolder;
private final File metricsModuleFile;
@@ -79,9 +80,9 @@ public class MetricsService {
* This constructs a new instance of our {@link MetricsService}.
*
* @param plugin
- * Our {@link SlimefunPlugin} instance
+ * Our {@link Slimefun} instance
*/
- public MetricsService(@Nonnull SlimefunPlugin plugin) {
+ public MetricsService(@Nonnull Slimefun plugin) {
this.plugin = plugin;
this.parentFolder = new File(plugin.getDataFolder(), "cache" + File.separatorChar + "modules");
@@ -130,7 +131,7 @@ public void start() {
String version = metricsClass.getPackage().getImplementationVersion();
// This is required to be sync due to bStats.
- SlimefunPlugin.runSync(() -> {
+ Slimefun.runSync(() -> {
try {
start.invoke(null);
plugin.getLogger().info("Metrics build #" + version + " started.");
@@ -167,7 +168,7 @@ public void cleanUp() {
* @return if there is an update available.
*/
public boolean checkForUpdate(@Nullable String currentVersion) {
- if (currentVersion == null || !PatternUtils.NUMERIC.matcher(currentVersion).matches()) {
+ if (currentVersion == null || !CommonPatterns.NUMERIC.matcher(currentVersion).matches()) {
return false;
}
@@ -276,6 +277,6 @@ public String getVersion() {
* @return True if the current server has metrics auto-updates enabled.
*/
public boolean hasAutoUpdates() {
- return SlimefunPlugin.instance().getConfig().getBoolean("metrics.auto-update");
+ return Slimefun.instance().getConfig().getBoolean("metrics.auto-update");
}
}
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 ccc8785ab5..f959a7493c 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
@@ -22,8 +22,8 @@
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.Plugin;
-import io.github.thebusybiscuit.cscorelib2.recipes.MinecraftRecipe;
-import io.github.thebusybiscuit.cscorelib2.recipes.RecipeSnapshot;
+import io.github.bakedlibs.dough.recipes.MinecraftRecipe;
+import io.github.bakedlibs.dough.recipes.RecipeSnapshot;
import io.github.thebusybiscuit.slimefun4.implementation.guide.SurvivalSlimefunGuide;
/**
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 8e11d95636..a0dc615d30 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
@@ -17,12 +17,12 @@
import org.bukkit.Server;
import org.bukkit.World;
-import io.github.thebusybiscuit.cscorelib2.collections.OptionalMap;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
+import io.github.bakedlibs.dough.collections.OptionalMap;
+import io.github.bakedlibs.dough.config.Config;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This Service is responsible for disabling a {@link SlimefunItem} in a certain {@link World}.
@@ -32,13 +32,13 @@
*/
public class PerWorldSettingsService {
- private final SlimefunPlugin plugin;
+ private final Slimefun plugin;
private final OptionalMap> disabledItems = new OptionalMap<>(HashMap::new);
private final Map> disabledAddons = new HashMap<>();
private final Set disabledWorlds = new HashSet<>();
- public PerWorldSettingsService(@Nonnull SlimefunPlugin plugin) {
+ public PerWorldSettingsService(@Nonnull Slimefun plugin) {
this.plugin = plugin;
}
@@ -175,7 +175,7 @@ public void save(@Nonnull World world) {
Config config = getConfig(world);
- for (SlimefunItem item : SlimefunPlugin.getRegistry().getEnabledSlimefunItems()) {
+ for (SlimefunItem item : Slimefun.getRegistry().getEnabledSlimefunItems()) {
if (item != null) {
String addon = item.getAddon().getName().toLowerCase(Locale.ROOT);
config.setValue(addon + '.' + item.getId(), !items.contains(item.getId()));
@@ -206,7 +206,7 @@ private Set loadWorldFromConfig(@Nonnull World world) {
loadItemsFromWorldConfig(name, config, items);
// We don't actually wanna write to disk during a Unit test
- if (SlimefunPlugin.getMinecraftVersion() != MinecraftVersion.UNIT_TEST) {
+ if (Slimefun.getMinecraftVersion() != MinecraftVersion.UNIT_TEST) {
config.save();
}
} else {
@@ -218,7 +218,7 @@ private Set loadWorldFromConfig(@Nonnull World world) {
}
private void loadItemsFromWorldConfig(@Nonnull String worldName, @Nonnull Config config, @Nonnull Set items) {
- for (SlimefunItem item : SlimefunPlugin.getRegistry().getEnabledSlimefunItems()) {
+ for (SlimefunItem item : Slimefun.getRegistry().getEnabledSlimefunItems()) {
if (item != null) {
String addon = item.getAddon().getName().toLowerCase(Locale.ROOT);
config.setDefaultValue(addon + ".enabled", true);
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 591b57c373..a9f95dc09d 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
@@ -14,9 +14,9 @@
import org.bukkit.permissions.Permissible;
import org.bukkit.permissions.Permission;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.bakedlibs.dough.config.Config;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This Service is responsible for handling the {@link Permission} of a
@@ -32,7 +32,7 @@ public class PermissionsService {
private final Map permissions = new HashMap<>();
private final Config config;
- public PermissionsService(@Nonnull SlimefunPlugin plugin) {
+ public PermissionsService(@Nonnull Slimefun plugin) {
config = new Config(plugin, "permissions.yml");
// @formatter:off
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/UpdaterService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/UpdaterService.java
index b323d3f2f1..a08e65dcfe 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/UpdaterService.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/UpdaterService.java
@@ -7,12 +7,11 @@
import org.bukkit.plugin.Plugin;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
-import io.github.thebusybiscuit.cscorelib2.updater.GitHubBuildsUpdater;
-import io.github.thebusybiscuit.cscorelib2.updater.Updater;
+import io.github.bakedlibs.dough.config.Config;
+import io.github.bakedlibs.dough.updater.GitHubBuildsUpdater;
+import io.github.bakedlibs.dough.versions.PrefixedVersion;
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This Class represents our {@link Updater} Service.
@@ -25,14 +24,14 @@
public class UpdaterService {
/**
- * Our {@link SlimefunPlugin} instance.
+ * Our {@link Slimefun} instance.
*/
- private final SlimefunPlugin plugin;
+ private final Slimefun plugin;
/**
* Our {@link Updater} implementation.
*/
- private final Updater updater;
+ private final GitHubBuildsUpdater updater;
/**
* The {@link SlimefunBranch} we are currently on.
@@ -41,7 +40,7 @@ public class UpdaterService {
private final SlimefunBranch branch;
/**
- * This will create a new {@link UpdaterService} for the given {@link SlimefunPlugin}.
+ * This will create a new {@link UpdaterService} for the given {@link Slimefun}.
* The {@link File} should be the result of the getFile() operation of that {@link Plugin}.
*
* @param plugin
@@ -51,9 +50,9 @@ public class UpdaterService {
* @param file
* The {@link File} of this {@link Plugin}
*/
- public UpdaterService(@Nonnull SlimefunPlugin plugin, @Nonnull String version, @Nonnull File file) {
+ public UpdaterService(@Nonnull Slimefun plugin, @Nonnull String version, @Nonnull File file) {
this.plugin = plugin;
- Updater autoUpdater = null;
+ GitHubBuildsUpdater autoUpdater = null;
if (version.contains("UNOFFICIAL")) {
// This Server is using a modified build that is not a public release.
@@ -62,7 +61,6 @@ public UpdaterService(@Nonnull SlimefunPlugin plugin, @Nonnull String version, @
// If we are using a development build, we want to switch to our custom
try {
autoUpdater = new GitHubBuildsUpdater(plugin, file, "TheBusyBiscuit/Slimefun4/master");
-
} catch (Exception x) {
plugin.getLogger().log(Level.SEVERE, "Failed to create AutoUpdater", x);
}
@@ -91,8 +89,7 @@ public UpdaterService(@Nonnull SlimefunPlugin plugin, @Nonnull String version, @
*
* @return The branch this build of Slimefun is on.
*/
- @Nonnull
- public SlimefunBranch getBranch() {
+ public @Nonnull SlimefunBranch getBranch() {
return branch;
}
@@ -104,8 +101,9 @@ public SlimefunBranch getBranch() {
* @return The build number of this Slimefun.
*/
public int getBuildNumber() {
- if (updater != null && PatternUtils.NUMERIC.matcher(this.updater.getLocalVersion()).matches()) {
- return Integer.parseInt(updater.getLocalVersion());
+ if (updater != null) {
+ PrefixedVersion version = updater.getCurrentVersion();
+ return version.getVersionNumber();
}
return -1;
@@ -135,7 +133,7 @@ public void start() {
* @return Whether the {@link Updater} is enabled
*/
public boolean isEnabled() {
- return SlimefunPlugin.getCfg().getBoolean("options.auto-update") && updater != null;
+ return Slimefun.getCfg().getBoolean("options.auto-update") && updater != null;
}
/**
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/ContributionsConnector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/ContributionsConnector.java
index df7a9915ca..8f1e52542d 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/ContributionsConnector.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/ContributionsConnector.java
@@ -9,7 +9,8 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
+
import kong.unirest.JsonNode;
import kong.unirest.json.JSONArray;
import kong.unirest.json.JSONObject;
@@ -94,7 +95,7 @@ public void onSuccess(@Nonnull JsonNode response) {
if (response.isArray()) {
computeContributors(response.getArray());
} else {
- SlimefunPlugin.logger().log(Level.WARNING, "Received an unusual answer from GitHub, possibly a timeout? ({0})", response);
+ Slimefun.logger().log(Level.WARNING, "Received an unusual answer from GitHub, possibly a timeout? ({0})", response);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/Contributor.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/Contributor.java
index 0ab9c5f142..03173056bd 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/Contributor.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/Contributor.java
@@ -15,8 +15,8 @@
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
-import io.github.thebusybiscuit.cscorelib2.data.TriStateOptional;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.bakedlibs.dough.data.TriStateOptional;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
/**
@@ -176,7 +176,7 @@ public Optional getUniqueId() {
*/
@Nonnull
public String getTexture() {
- return getTexture(SlimefunPlugin.getGitHubService());
+ return getTexture(Slimefun.getGitHubService());
}
/**
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubActivityConnector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubActivityConnector.java
index 33b6d23e10..b298195e7b 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubActivityConnector.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubActivityConnector.java
@@ -8,6 +8,7 @@
import javax.annotation.ParametersAreNonnullByDefault;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
+
import kong.unirest.JsonNode;
import kong.unirest.json.JSONObject;
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java
index ec05d29539..422ed31787 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubConnector.java
@@ -14,7 +14,8 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
+
import kong.unirest.HttpResponse;
import kong.unirest.JsonNode;
import kong.unirest.Unirest;
@@ -100,7 +101,7 @@ void download() {
file = new File("plugins/Slimefun/cache/github/" + getFileName() + ".json");
if (github.isLoggingEnabled()) {
- SlimefunPlugin.logger().log(Level.INFO, "Retrieving {0}.json from GitHub...", getFileName());
+ Slimefun.logger().log(Level.INFO, "Retrieving {0}.json from GitHub...", getFileName());
}
try {
@@ -116,7 +117,7 @@ void download() {
writeCacheFile(response.getBody());
} else {
if (github.isLoggingEnabled()) {
- SlimefunPlugin.logger().log(Level.WARNING, "Failed to fetch {0}: {1} - {2}", new Object[] { url, response.getStatus(), response.getBody() });
+ Slimefun.logger().log(Level.WARNING, "Failed to fetch {0}: {1} - {2}", new Object[] { url, response.getStatus(), response.getBody() });
}
// It has the cached file, let's just read that then
@@ -130,7 +131,7 @@ void download() {
}
} catch (UnirestException e) {
if (github.isLoggingEnabled()) {
- SlimefunPlugin.logger().log(Level.WARNING, "Could not connect to GitHub in time.", e);
+ Slimefun.logger().log(Level.WARNING, "Could not connect to GitHub in time.", e);
}
// It has the cached file, let's just read that then
@@ -153,7 +154,7 @@ private JsonNode readCacheFile() {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
return new JsonNode(reader.readLine());
} catch (IOException | JSONException e) {
- SlimefunPlugin.logger().log(Level.WARNING, "Failed to read Github cache file: {0} - {1}: {2}", new Object[] { file.getName(), e.getClass().getSimpleName(), e.getMessage() });
+ Slimefun.logger().log(Level.WARNING, "Failed to read Github cache file: {0} - {1}: {2}", new Object[] { file.getName(), e.getClass().getSimpleName(), e.getMessage() });
return null;
}
}
@@ -162,7 +163,7 @@ private void writeCacheFile(@Nonnull JsonNode node) {
try (FileOutputStream output = new FileOutputStream(file)) {
output.write(node.toString().getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
- SlimefunPlugin.logger().log(Level.WARNING, "Failed to populate GitHub cache: {0} - {1}", new Object[] { e.getClass().getSimpleName(), e.getMessage() });
+ Slimefun.logger().log(Level.WARNING, "Failed to populate GitHub cache: {0} - {1}", new Object[] { e.getClass().getSimpleName(), e.getMessage() });
}
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubIssuesConnector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubIssuesConnector.java
index ab539efbb2..81cd1ac5d3 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubIssuesConnector.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubIssuesConnector.java
@@ -7,7 +7,8 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
+
import kong.unirest.JsonNode;
import kong.unirest.json.JSONArray;
import kong.unirest.json.JSONObject;
@@ -42,7 +43,7 @@ public void onSuccess(@Nonnull JsonNode response) {
callback.accept(issues, pullRequests);
} else {
- SlimefunPlugin.logger().log(Level.WARNING, "Received an unusual answer from GitHub, possibly a timeout? ({0})", response);
+ Slimefun.logger().log(Level.WARNING, "Received an unusual answer from GitHub, possibly a timeout? ({0})", response);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java
index 86ee1d2a77..73c879d229 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubService.java
@@ -16,8 +16,8 @@
import org.apache.commons.lang.Validate;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.bakedlibs.dough.config.Config;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
/**
@@ -65,9 +65,9 @@ public GitHubService(@Nonnull String repository) {
* every so often to update its data.
*
* @param plugin
- * Our instance of {@link SlimefunPlugin}
+ * Our instance of {@link Slimefun}
*/
- public void start(@Nonnull SlimefunPlugin plugin) {
+ public void start(@Nonnull Slimefun plugin) {
long period = TimeUnit.HOURS.toMillis(1);
GitHubTask task = new GitHubTask(this);
@@ -92,7 +92,7 @@ private void addDefaultContributors() {
TranslatorsReader translators = new TranslatorsReader(this);
translators.load();
} catch (Exception x) {
- SlimefunPlugin.logger().log(Level.SEVERE, "Failed to read 'translators.json'", x);
+ Slimefun.logger().log(Level.SEVERE, "Failed to read 'translators.json'", x);
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubTask.java
index cfc2145387..4e43970203 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubTask.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/GitHubTask.java
@@ -1,11 +1,12 @@
package io.github.thebusybiscuit.slimefun4.core.services.github;
import java.io.File;
-import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import javax.annotation.Nonnull;
@@ -13,9 +14,9 @@
import org.bukkit.Bukkit;
-import io.github.thebusybiscuit.cscorelib2.players.MinecraftAccount;
-import io.github.thebusybiscuit.cscorelib2.players.TooManyRequestsException;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.bakedlibs.dough.skins.PlayerSkin;
+import io.github.bakedlibs.dough.skins.UUIDLookup;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This {@link GitHubTask} represents a {@link Runnable} that is run every X minutes.
@@ -38,6 +39,12 @@ class GitHubTask implements Runnable {
@Override
public void run() {
+
+ if (Bukkit.isPrimaryThread()) {
+ Slimefun.logger().log(Level.SEVERE, "The contributors task may never run on the main Thread!");
+ return;
+ }
+
connectAndCache();
grabTextures();
}
@@ -67,9 +74,9 @@ private void grabTextures() {
}
}
- if (requests >= MAX_REQUESTS_PER_MINUTE && SlimefunPlugin.instance() != null && SlimefunPlugin.instance().isEnabled()) {
+ if (requests >= MAX_REQUESTS_PER_MINUTE && Slimefun.instance() != null && Slimefun.instance().isEnabled()) {
// Slow down API requests and wait a minute after more than x requests were made
- Bukkit.getScheduler().runTaskLaterAsynchronously(SlimefunPlugin.instance(), this::grabTextures, 2 * 60 * 20L);
+ Bukkit.getScheduler().runTaskLaterAsynchronously(Slimefun.instance(), this::grabTextures, 2 * 60 * 20L);
}
for (GitHubConnector connector : gitHubService.getConnectors()) {
@@ -98,21 +105,16 @@ private int requestTexture(@Nonnull Contributor contributor, @Nonnull Map skins) throws TooManyRequestsException, IOException {
+ private @Nullable String pullTexture(@Nonnull Contributor contributor, @Nonnull Map skins) throws InterruptedException, ExecutionException {
Optional uuid = contributor.getUniqueId();
if (!uuid.isPresent()) {
- uuid = MinecraftAccount.getUUID(contributor.getMinecraftName());
+ CompletableFuture future = UUIDLookup.forUsername(Slimefun.instance(), contributor.getMinecraftName());
+ uuid = Optional.ofNullable(future.get());
uuid.ifPresent(contributor::setUniqueId);
}
if (uuid.isPresent()) {
- Optional skin = MinecraftAccount.getSkin(uuid.get());
+ CompletableFuture future = PlayerSkin.fromPlayerUUID(Slimefun.instance(), uuid.get());
+ Optional skin = Optional.of(future.get().toString());
skins.put(contributor.getMinecraftName(), skin.orElse(""));
return skin.orElse(null);
} else {
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/TranslatorsReader.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/TranslatorsReader.java
index 58a6e7c291..80da4876ec 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/TranslatorsReader.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/github/TranslatorsReader.java
@@ -15,7 +15,7 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This class reads all translators of this project.
@@ -36,7 +36,7 @@ final class TranslatorsReader {
}
public void load() {
- InputStream inputStream = SlimefunPlugin.class.getResourceAsStream("/languages/translators.json");
+ InputStream inputStream = Slimefun.class.getResourceAsStream("/languages/translators.json");
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
JsonParser parser = new JsonParser();
@@ -56,7 +56,7 @@ public void load() {
}
}
} catch (Exception e) {
- SlimefunPlugin.logger().log(Level.SEVERE, "Failed to load translators.json file", e);
+ Slimefun.logger().log(Level.SEVERE, "Failed to load translators.json file", e);
}
}
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 fe4e091b1f..6241737a54 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
@@ -24,9 +24,9 @@
import org.bukkit.plugin.Plugin;
import org.bukkit.util.Vector;
-import io.github.thebusybiscuit.cscorelib2.blocks.BlockPosition;
+import io.github.bakedlibs.dough.blocks.BlockPosition;
import io.github.thebusybiscuit.slimefun4.core.attributes.HologramOwner;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
/**
* This service is responsible for handling holograms.
@@ -264,15 +264,15 @@ private void updateHologram(@Nonnull Location loc, @Nonnull Consumer c
consumer.accept(hologram);
}
} catch (Exception | LinkageError x) {
- SlimefunPlugin.logger().log(Level.SEVERE, "Hologram located at {0}", new BlockPosition(loc));
- SlimefunPlugin.logger().log(Level.SEVERE, "Something went wrong while trying to update this hologram", x);
+ Slimefun.logger().log(Level.SEVERE, "Hologram located at {0}", new BlockPosition(loc));
+ Slimefun.logger().log(Level.SEVERE, "Something went wrong while trying to update this hologram", x);
}
};
if (Bukkit.isPrimaryThread()) {
runnable.run();
} else {
- SlimefunPlugin.runSync(runnable);
+ Slimefun.runSync(runnable);
}
}
@@ -302,8 +302,8 @@ public boolean removeHologram(@Nonnull Location loc) {
return false;
}
} catch (Exception | LinkageError x) {
- SlimefunPlugin.logger().log(Level.SEVERE, "Hologram located at {0}", new BlockPosition(loc));
- SlimefunPlugin.logger().log(Level.SEVERE, "Something went wrong while trying to remove this hologram", x);
+ Slimefun.logger().log(Level.SEVERE, "Hologram located at {0}", new BlockPosition(loc));
+ Slimefun.logger().log(Level.SEVERE, "Something went wrong while trying to remove this hologram", x);
return false;
}
} else {
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 4dc58f7472..eeaad65c76 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
@@ -16,7 +16,7 @@
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.services.LocalizationService;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
/**
@@ -51,7 +51,7 @@ public Language(@Nonnull String id, @Nonnull String hash) {
this.id = id;
this.item = SlimefunUtils.getCustomHead(hash);
- SlimefunPlugin.getItemTextureService().setTexture(item, "_UI_LANGUAGE_" + id.toUpperCase(Locale.ROOT));
+ Slimefun.getItemTextureService().setTexture(item, "_UI_LANGUAGE_" + id.toUpperCase(Locale.ROOT));
}
/**
@@ -76,7 +76,7 @@ public double getTranslationProgress() {
return 100.0;
} else {
if (progress < 0) {
- progress = SlimefunPlugin.getLocalization().calculateProgress(this);
+ progress = Slimefun.getLocalization().calculateProgress(this);
}
return progress;
@@ -116,7 +116,7 @@ public ItemStack getItem() {
*/
@Nonnull
public String getName(@Nonnull Player p) {
- return SlimefunPlugin.getLocalization().getMessage(p, "languages." + id);
+ return Slimefun.getLocalization().getMessage(p, "languages." + id);
}
/**
@@ -126,7 +126,7 @@ public String getName(@Nonnull Player p) {
* @return Whether this is the default {@link Language} of this {@link Server}
*/
public boolean isDefault() {
- return this == SlimefunPlugin.getLocalization().getDefaultLanguage();
+ return this == Slimefun.getLocalization().getDefaultLanguage();
}
@Override
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 3ab4f1cf39..c2d6c03726 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
@@ -23,14 +23,15 @@
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
-import io.github.thebusybiscuit.cscorelib2.config.Localization;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.bakedlibs.dough.common.ChatColors;
+import io.github.bakedlibs.dough.config.Config;
+import io.github.bakedlibs.dough.items.CustomItemStack;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.services.LocalizationService;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
+
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
@@ -44,10 +45,27 @@
* @see LocalizationService
*
*/
-public abstract class SlimefunLocalization extends Localization implements Keyed {
+public abstract class SlimefunLocalization implements Keyed {
+
+ private final Config defaultConfig;
+
+ protected SlimefunLocalization(@Nonnull Slimefun plugin) {
+ this.defaultConfig = new Config(plugin, "messages.yml");
+ }
- protected SlimefunLocalization(@Nonnull SlimefunPlugin plugin) {
- super(plugin);
+ protected @Nonnull Config getConfig() {
+ return defaultConfig;
+ }
+
+ /**
+ * Saves this Localization to its File
+ */
+ protected void save() {
+ defaultConfig.save();
+ }
+
+ public @Nonnull String getPrefix() {
+ return getMessage("prefix");
}
/**
@@ -118,7 +136,7 @@ protected SlimefunLocalization(@Nonnull SlimefunPlugin plugin) {
*/
protected void loadEmbeddedLanguages() {
for (LanguagePreset lang : LanguagePreset.values()) {
- if (lang.isReadyForRelease() || SlimefunPlugin.getUpdater().getBranch() != SlimefunBranch.STABLE) {
+ if (lang.isReadyForRelease() || Slimefun.getUpdater().getBranch() != SlimefunBranch.STABLE) {
addLanguage(lang.getLanguageCode(), lang.getTexture());
}
}
@@ -210,7 +228,6 @@ protected void loadEmbeddedLanguages() {
return list != null ? list : Arrays.asList("! Missing string \"" + path + '"');
}
- @Override
public @Nonnull String getMessage(@Nonnull String key) {
Validate.notNull(key, "Message key must not be null!");
@@ -232,6 +249,17 @@ protected void loadEmbeddedLanguages() {
return getString(getLanguage(p), LanguageFile.MESSAGES, key);
}
+ /**
+ * Returns the Strings referring to the specified Key
+ *
+ * @param key
+ * The Key of those Messages
+ * @return The List this key is referring to
+ */
+ public @Nonnull List getDefaultMessages(@Nonnull String key) {
+ return defaultConfig.getStringList(key);
+ }
+
public @Nonnull List getMessages(@Nonnull Player p, @Nonnull String key) {
Validate.notNull(p, "Player should not be null.");
Validate.notNull(key, "Message key cannot be null.");
@@ -286,7 +314,7 @@ protected void loadEmbeddedLanguages() {
Language language = getLanguage(p);
NamespacedKey key = recipeType.getKey();
- return new CustomItem(item, meta -> {
+ return new CustomItemStack(item, meta -> {
String displayName = getStringOrNull(language, LanguageFile.RECIPES, key.getNamespace() + "." + key.getKey() + ".name");
// Set the display name if possible, else keep the default item name.
@@ -307,7 +335,6 @@ protected void loadEmbeddedLanguages() {
});
}
- @Override
public void sendMessage(@Nonnull CommandSender recipient, @Nonnull String key, boolean addPrefix) {
Validate.notNull(recipient, "Recipient cannot be null!");
Validate.notNull(key, "Message key cannot be null!");
@@ -332,7 +359,6 @@ public void sendActionbarMessage(@Nonnull Player player, @Nonnull String key, bo
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, components);
}
- @Override
public void sendMessage(@Nonnull CommandSender recipient, @Nonnull String key) {
sendMessage(recipient, key, true);
}
@@ -342,10 +368,9 @@ public void sendMessage(CommandSender recipient, String key, UnaryOperator function) {
- if (SlimefunPlugin.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) {
+ if (Slimefun.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) {
return;
}
@@ -358,7 +383,6 @@ public void sendMessage(CommandSender recipient, String key, boolean addPrefix,
}
}
- @Override
public void sendMessages(@Nonnull CommandSender recipient, @Nonnull String key) {
String prefix = getPrefix();
@@ -368,14 +392,13 @@ public void sendMessages(@Nonnull CommandSender recipient, @Nonnull String key)
recipient.sendMessage(message);
}
} else {
- for (String translation : getMessages(key)) {
+ for (String translation : getDefaultMessages(key)) {
String message = ChatColors.color(prefix + translation);
recipient.sendMessage(ChatColor.stripColor(message));
}
}
}
- @Override
@ParametersAreNonnullByDefault
public void sendMessages(CommandSender recipient, String key, boolean addPrefix, UnaryOperator function) {
String prefix = addPrefix ? getPrefix() : "";
@@ -386,7 +409,7 @@ public void sendMessages(CommandSender recipient, String key, boolean addPrefix,
recipient.sendMessage(message);
}
} else {
- for (String translation : getMessages(key)) {
+ for (String translation : getDefaultMessages(key)) {
String message = ChatColors.color(prefix + function.apply(translation));
recipient.sendMessage(ChatColor.stripColor(message));
}
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 b5ace61f8c..d342659145 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
@@ -11,10 +11,11 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
+import io.github.bakedlibs.dough.common.ChatColors;
import io.github.thebusybiscuit.slimefun4.core.services.profiler.inspectors.PlayerPerformanceInspector;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
+
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
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 6348d0d072..1764fbffba 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
@@ -8,9 +8,9 @@
import org.bukkit.World;
import org.bukkit.block.Block;
-import io.github.thebusybiscuit.cscorelib2.blocks.BlockPosition;
+import io.github.bakedlibs.dough.blocks.BlockPosition;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
/**
* This represents an entry in our {@link SlimefunProfiler}.
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 ac8169f476..2a1292225a 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
@@ -23,10 +23,10 @@
import org.bukkit.scheduler.BukkitScheduler;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.tasks.TickerTask;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* The {@link SlimefunProfiler} works closely to the {@link TickerTask} and is
@@ -176,7 +176,7 @@ public long closeEntry(@Nonnull Location l, @Nonnull SlimefunItem item, long tim
public void stop() {
isProfiling = false;
- if (SlimefunPlugin.instance() == null || !SlimefunPlugin.instance().isEnabled()) {
+ if (Slimefun.instance() == null || !Slimefun.instance().isEnabled()) {
// Slimefun has been disabled
return;
}
@@ -210,7 +210,7 @@ private void finishReport() {
return;
}
} catch (InterruptedException e) {
- SlimefunPlugin.logger().log(Level.SEVERE, "A Profiler Thread was interrupted", e);
+ Slimefun.logger().log(Level.SEVERE, "A Profiler Thread was interrupted", e);
Thread.currentThread().interrupt();
}
}
@@ -365,7 +365,7 @@ public String getTime() {
}
public int getTickRate() {
- return SlimefunPlugin.getTickerTask().getTickRate();
+ return Slimefun.getTickerTask().getTickRate();
}
/**
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 2e0697ff48..51a44ab6c2 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
@@ -10,6 +10,7 @@
import org.bukkit.entity.Player;
import io.github.thebusybiscuit.slimefun4.core.services.profiler.PerformanceInspector;
+
import net.md_5.bungee.api.chat.TextComponent;
/**
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java
similarity index 97%
rename from src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java
rename to src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java
index 7f42cd9dc1..0522e39208 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/Slimefun.java
@@ -29,13 +29,14 @@
import org.bukkit.plugin.java.JavaPluginLoader;
import org.bukkit.scheduler.BukkitTask;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
-import io.github.thebusybiscuit.cscorelib2.protection.ProtectionManager;
+import io.github.bakedlibs.dough.config.Config;
+import io.github.bakedlibs.dough.protection.ProtectionManager;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
import io.github.thebusybiscuit.slimefun4.api.exceptions.TagMisconfigurationException;
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
import io.github.thebusybiscuit.slimefun4.api.gps.GPSNetwork;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
import io.github.thebusybiscuit.slimefun4.core.SlimefunRegistry;
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
@@ -120,7 +121,6 @@
import io.papermc.lib.PaperLib;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.MenuListener;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu;
@@ -130,13 +130,13 @@
*
* @author TheBusyBiscuit
*/
-public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
+public final class Slimefun extends JavaPlugin implements SlimefunAddon {
/**
- * Our static instance of {@link SlimefunPlugin}.
+ * Our static instance of {@link Slimefun}.
* Make sure to clean this up in {@link #onDisable()}!
*/
- private static SlimefunPlugin instance;
+ private static Slimefun instance;
/**
* Keep track of which {@link MinecraftVersion} we are on.
@@ -187,9 +187,9 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
private final SlimefunBowListener bowListener = new SlimefunBowListener();
/**
- * Our default constructor for {@link SlimefunPlugin}.
+ * Our default constructor for {@link Slimefun}.
*/
- public SlimefunPlugin() {
+ public Slimefun() {
super();
}
@@ -206,7 +206,7 @@ public SlimefunPlugin() {
* A {@link File} for this {@link Plugin}
*/
@ParametersAreNonnullByDefault
- public SlimefunPlugin(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) {
+ public Slimefun(JavaPluginLoader loader, PluginDescriptionFile description, File dataFolder, File file) {
super(loader, description, dataFolder, file);
// This is only invoked during a Unit Test
@@ -439,15 +439,15 @@ public void onDisable() {
}
/**
- * This is a private internal method to set the de-facto instance of {@link SlimefunPlugin}.
+ * This is a private internal method to set the de-facto instance of {@link Slimefun}.
* Having this as a seperate method ensures the seperation between static and non-static fields.
* It also makes sonarcloud happy :)
* Only ever use it during {@link #onEnable()} or {@link #onDisable()}.
*
* @param pluginInstance
- * Our instance of {@link SlimefunPlugin} or null
+ * Our instance of {@link Slimefun} or null
*/
- private static void setInstance(@Nullable SlimefunPlugin pluginInstance) {
+ private static void setInstance(@Nullable Slimefun pluginInstance) {
instance = pluginInstance;
}
@@ -539,7 +539,7 @@ private boolean isVersionUnsupported() {
*
* @return A {@link Collection} of all compatible minecraft versions as strings
*/
- static final @Nonnull Collection getSupportedVersions() {
+ static @Nonnull Collection getSupportedVersions() {
List list = new ArrayList<>();
for (MinecraftVersion version : MinecraftVersion.values()) {
@@ -684,12 +684,12 @@ private void loadResearches() {
}
/**
- * This returns the global instance of {@link SlimefunPlugin}.
+ * This returns the global instance of {@link Slimefun}.
* This may return null if the {@link Plugin} was disabled.
*
- * @return The {@link SlimefunPlugin} instance
+ * @return The {@link Slimefun} instance
*/
- public static @Nullable SlimefunPlugin instance() {
+ public static @Nullable Slimefun instance() {
return instance;
}
@@ -966,7 +966,7 @@ public static boolean isNewlyInstalled() {
validateInstance();
String pluginName = instance.getName();
- // @formatter:off
+ // @formatter:off - Collect any Plugin that (soft)-depends on Slimefun
return Arrays.stream(instance.getServer().getPluginManager().getPlugins()).filter(plugin -> {
PluginDescriptionFile description = plugin.getDescription();
return description.getDepend().contains(pluginName) || description.getSoftDepend().contains(pluginName);
@@ -992,6 +992,7 @@ public static boolean isNewlyInstalled() {
Validate.notNull(runnable, "Cannot run null");
Validate.isTrue(delay >= 0, "The delay cannot be negative");
+ // Run the task instantly within a Unit Test
if (getMinecraftVersion() == MinecraftVersion.UNIT_TEST) {
runnable.run();
return null;
@@ -1019,6 +1020,7 @@ public static boolean isNewlyInstalled() {
public static @Nullable BukkitTask runSync(@Nonnull Runnable runnable) {
Validate.notNull(runnable, "Cannot run null");
+ // Run the task instantly within a Unit Test
if (getMinecraftVersion() == MinecraftVersion.UNIT_TEST) {
runnable.run();
return null;
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java
index e5f34606a0..50e67e25e3 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java
@@ -15,6 +15,7 @@
import org.bukkit.potion.PotionEffectType;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineTier;
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineType;
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactivity;
@@ -23,15 +24,12 @@
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ColoredFireworkStar;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
/**
* This class holds a static references to every {@link SlimefunItemStack}
* found in Slimefun.
- *
- * @author TheBusyBiscuit
- *
*/
+@SuppressWarnings("java:S1192") // Suppress "duplicate string literal" warnings
public final class SlimefunItems {
private SlimefunItems() {}
@@ -260,7 +258,7 @@ private SlimefunItems() {}
hazmatLore.add(ChatColor.GOLD + "Full set effects:");
hazmatLore.add(ChatColor.YELLOW + "- Radiation immunity");
- if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
+ if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
hazmatLore.add(ChatColor.YELLOW + "- Bee Sting protection");
}
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/StartupWarnings.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/StartupWarnings.java
index 3cbcd9a9be..a1d2f0c5f8 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/StartupWarnings.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/StartupWarnings.java
@@ -42,7 +42,7 @@ static void invalidMinecraftVersion(Logger logger, int majorVersion, String slim
logger.log(Level.SEVERE, PREFIX);
logger.log(Level.SEVERE, PREFIX + "You are using Minecraft 1.{0}.x", majorVersion);
logger.log(Level.SEVERE, PREFIX + "but Slimefun {0} requires you to be using", slimefunVersion);
- logger.log(Level.SEVERE, PREFIX + "Minecraft {0}", String.join(" / ", SlimefunPlugin.getSupportedVersions()));
+ logger.log(Level.SEVERE, PREFIX + "Minecraft {0}", String.join(" / ", Slimefun.getSupportedVersions()));
logger.log(Level.SEVERE, BORDER);
}
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 fec6b968e9..99b15f19cb 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
@@ -1,25 +1,26 @@
package io.github.thebusybiscuit.slimefun4.implementation.guide;
-import javax.annotation.Nonnull;
-import javax.annotation.ParametersAreNonnullByDefault;
-
import java.util.LinkedList;
import java.util.List;
-import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
+import javax.annotation.Nonnull;
+import javax.annotation.ParametersAreNonnullByDefault;
+
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
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.SlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.SlimefunGuideItem;
+
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* This is an admin-variant of the {@link SurvivalSlimefunGuide} which allows a {@link Player}
@@ -39,25 +40,26 @@ public CheatSheetSlimefunGuide() {
}
/**
- * Returns a {@link List} of visible {@link Category} instances that the {@link SlimefunGuide} would display.
+ * Returns a {@link List} of visible {@link ItemGroup} instances that the {@link SlimefunGuide} would display.
*
* @param p
* The {@link Player} who opened his {@link SlimefunGuide}
* @param profile
* The {@link PlayerProfile} of the {@link Player}
- * @return a {@link List} of visible {@link Category} instances
+ *
+ * @return a {@link List} of visible {@link ItemGroup} instances
*/
@Override
- protected @Nonnull List getVisibleCategories(@Nonnull Player p, @Nonnull PlayerProfile profile) {
- List categories = new LinkedList<>();
+ protected List getVisibleItemGroups(@Nonnull Player p, @Nonnull PlayerProfile profile) {
+ List groups = new LinkedList<>();
- for (Category category : SlimefunPlugin.getRegistry().getCategories()) {
- if (!(category instanceof FlexCategory) || ((FlexCategory) category).isVisible(p, profile, getMode())) {
- categories.add(category);
+ for (ItemGroup group : Slimefun.getRegistry().getAllItemGroups()) {
+ if (!(group instanceof FlexItemGroup) || ((FlexItemGroup) group).isVisible(p, profile, getMode())) {
+ groups.add(group);
}
}
- return categories;
+ return groups;
}
@Override
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 8cec13c501..71ade62f12 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
@@ -24,15 +24,19 @@
import org.bukkit.inventory.RecipeChoice;
import org.bukkit.inventory.RecipeChoice.MaterialChoice;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatInput;
-import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
-import io.github.thebusybiscuit.cscorelib2.recipes.MinecraftRecipe;
+import io.github.bakedlibs.dough.chat.ChatInput;
+import io.github.bakedlibs.dough.items.CustomItemStack;
+import io.github.bakedlibs.dough.items.ItemUtils;
+import io.github.bakedlibs.dough.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.api.recipes.RecipeType;
+import io.github.thebusybiscuit.slimefun4.api.researches.Research;
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;
@@ -40,17 +44,14 @@
import io.github.thebusybiscuit.slimefun4.core.guide.options.SlimefunGuideSettings;
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlock;
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
-import io.github.thebusybiscuit.slimefun4.core.researching.Research;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.tasks.AsyncRecipeChoiceTask;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.itemstack.SlimefunGuideItem;
+
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.MenuClickHandler;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* The {@link SurvivalSlimefunGuide} is the standard version of our {@link SlimefunGuide}.
@@ -102,38 +103,39 @@ protected final boolean isSurvivalMode() {
}
/**
- * Returns a {@link List} of visible {@link Category} instances that the {@link SlimefunGuide} would display.
+ * Returns a {@link List} of visible {@link ItemGroup} instances that the {@link SlimefunGuide} would display.
*
* @param p
* The {@link Player} who opened his {@link SlimefunGuide}
* @param profile
* The {@link PlayerProfile} of the {@link Player}
- * @return a {@link List} of visible {@link Category} instances
+ *
+ * @return a {@link List} of visible {@link ItemGroup} instances
*/
- protected @Nonnull List getVisibleCategories(@Nonnull Player p, @Nonnull PlayerProfile profile) {
- List categories = new LinkedList<>();
+ protected @Nonnull List getVisibleItemGroups(@Nonnull Player p, @Nonnull PlayerProfile profile) {
+ List groups = new LinkedList<>();
- for (Category category : SlimefunPlugin.getRegistry().getCategories()) {
+ for (ItemGroup group : Slimefun.getRegistry().getAllItemGroups()) {
try {
- if (category instanceof FlexCategory) {
- if (((FlexCategory) category).isVisible(p, profile, getMode())) {
- categories.add(category);
+ if (group instanceof FlexItemGroup) {
+ if (((FlexItemGroup) group).isVisible(p, profile, getMode())) {
+ groups.add(group);
}
- } else if (!category.isHidden(p)) {
- categories.add(category);
+ } else if (!group.isHidden(p)) {
+ groups.add(group);
}
} catch (Exception | LinkageError x) {
- SlimefunAddon addon = category.getAddon();
+ SlimefunAddon addon = group.getAddon();
if (addon != null) {
- addon.getLogger().log(Level.SEVERE, x, () -> "Could not display Category: " + category);
+ addon.getLogger().log(Level.SEVERE, x, () -> "Could not display Category: " + group);
} else {
- SlimefunPlugin.logger().log(Level.SEVERE, x, () -> "Could not display Category: " + category);
+ Slimefun.logger().log(Level.SEVERE, x, () -> "Could not display Category: " + group);
}
}
}
- return categories;
+ return groups;
}
@Override
@@ -151,7 +153,7 @@ public void openMainMenu(PlayerProfile profile, int page) {
}
ChestMenu menu = create(p);
- List categories = getVisibleCategories(p, profile);
+ List categories = getVisibleItemGroups(p, profile);
int index = 9;
createHeader(p, profile, menu);
@@ -161,8 +163,8 @@ public void openMainMenu(PlayerProfile profile, int page) {
while (target < (categories.size() - 1) && index < CATEGORY_SIZE + 9) {
target++;
- Category category = categories.get(target);
- displayCategory(menu, p, profile, category, index);
+ ItemGroup category = categories.get(target);
+ showItemGroup(menu, p, profile, category, index);
index++;
}
@@ -194,43 +196,43 @@ public void openMainMenu(PlayerProfile profile, int page) {
menu.open(p);
}
- private void displayCategory(ChestMenu menu, Player p, PlayerProfile profile, Category category, int index) {
- if (!(category instanceof LockedCategory) || !isSurvivalMode() || ((LockedCategory) category).hasUnlocked(p, profile)) {
- menu.addItem(index, category.getItem(p));
+ private void showItemGroup(ChestMenu menu, Player p, PlayerProfile profile, ItemGroup group, int index) {
+ if (!(group instanceof LockedItemGroup) || !isSurvivalMode() || ((LockedItemGroup) group).hasUnlocked(p, profile)) {
+ menu.addItem(index, group.getItem(p));
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
- openCategory(profile, category, 1);
+ openItemGroup(profile, group, 1);
return false;
});
} else {
List lore = new ArrayList<>();
lore.add("");
- for (String line : SlimefunPlugin.getLocalization().getMessages(p, "guide.locked-category")) {
+ for (String line : Slimefun.getLocalization().getMessages(p, "guide.locked-category")) {
lore.add(ChatColor.WHITE + line);
}
lore.add("");
- for (Category parent : ((LockedCategory) category).getParents()) {
+ for (ItemGroup parent : ((LockedItemGroup) group).getParents()) {
lore.add(parent.getItem(p).getItemMeta().getDisplayName());
}
- menu.addItem(index, new CustomItem(Material.BARRIER, "&4" + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked") + " &7- &f" + category.getItem(p).getItemMeta().getDisplayName(), lore.toArray(new String[0])));
+ menu.addItem(index, new CustomItemStack(Material.BARRIER, "&4" + Slimefun.getLocalization().getMessage(p, "guide.locked") + " &7- &f" + group.getItem(p).getItemMeta().getDisplayName(), lore.toArray(new String[0])));
menu.addMenuClickHandler(index, ChestMenuUtils.getEmptyClickHandler());
}
}
@Override
@ParametersAreNonnullByDefault
- public void openCategory(PlayerProfile profile, Category category, int page) {
+ public void openItemGroup(PlayerProfile profile, ItemGroup category, int page) {
Player p = profile.getPlayer();
if (p == null) {
return;
}
- if (category instanceof FlexCategory) {
- ((FlexCategory) category).open(p, profile, getMode());
+ if (category instanceof FlexItemGroup) {
+ ((FlexItemGroup) category).open(p, profile, getMode());
return;
}
@@ -250,7 +252,7 @@ public void openCategory(PlayerProfile profile, Category category, int page) {
int next = page - 1;
if (next != page && next > 0) {
- openCategory(profile, category, next);
+ openItemGroup(profile, category, next);
}
return false;
@@ -261,7 +263,7 @@ public void openCategory(PlayerProfile profile, Category category, int page) {
int next = page + 1;
if (next != page && next <= pages) {
- openCategory(profile, category, next);
+ openItemGroup(profile, category, next);
}
return false;
@@ -288,15 +290,15 @@ public void openCategory(PlayerProfile profile, Category category, int page) {
menu.open(p);
}
- private void displaySlimefunItem(ChestMenu menu, Category category, Player p, PlayerProfile profile, SlimefunItem sfitem, int page, int index) {
+ private void displaySlimefunItem(ChestMenu menu, ItemGroup category, Player p, PlayerProfile profile, SlimefunItem sfitem, int page, int index) {
Research research = sfitem.getResearch();
if (isSurvivalMode() && !hasPermission(p, sfitem)) {
- List message = SlimefunPlugin.getPermissionsService().getLore(sfitem);
- menu.addItem(index, new CustomItem(ChestMenuUtils.getNoPermissionItem(), sfitem.getItemName(), message.toArray(new String[0])));
+ List message = Slimefun.getPermissionsService().getLore(sfitem);
+ menu.addItem(index, new CustomItemStack(ChestMenuUtils.getNoPermissionItem(), sfitem.getItemName(), message.toArray(new String[0])));
menu.addMenuClickHandler(index, ChestMenuUtils.getEmptyClickHandler());
} else if (isSurvivalMode() && research != null && !profile.hasUnlocked(research)) {
- menu.addItem(index, new CustomItem(ChestMenuUtils.getNotResearchedItem(), ChatColor.WHITE + ItemUtils.getItemName(sfitem.getItem()), "&4&l" + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked"), "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level(s)"));
+ menu.addItem(index, new CustomItemStack(ChestMenuUtils.getNotResearchedItem(), ChatColor.WHITE + ItemUtils.getItemName(sfitem.getItem()), "&4&l" + Slimefun.getLocalization().getMessage(p, "guide.locked"), "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level(s)"));
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
research.unlockFromGuide(this, p, profile, sfitem, category, page);
return false;
@@ -309,7 +311,7 @@ private void displaySlimefunItem(ChestMenu menu, Category category, Player p, Pl
displayItem(profile, sfitem, true);
} else {
if (sfitem instanceof MultiBlockMachine) {
- SlimefunPlugin.getLocalization().sendMessage(pl, "guide.cheat.no-multiblocks");
+ Slimefun.getLocalization().sendMessage(pl, "guide.cheat.no-multiblocks");
} else {
pl.getInventory().addItem(sfitem.getItem().clone());
}
@@ -332,7 +334,7 @@ public void openSearch(PlayerProfile profile, String input, boolean addToHistory
return;
}
- ChestMenu menu = new ChestMenu(SlimefunPlugin.getLocalization().getMessage(p, "guide.search.inventory").replace("%item%", ChatUtils.crop(ChatColor.WHITE, input)));
+ ChestMenu menu = new ChestMenu(Slimefun.getLocalization().getMessage(p, "guide.search.inventory").replace("%item%", ChatUtils.crop(ChatColor.WHITE, input)));
String searchTerm = input.toLowerCase(Locale.ROOT);
if (addToHistory) {
@@ -345,14 +347,14 @@ public void openSearch(PlayerProfile profile, String input, boolean addToHistory
int index = 9;
// Find items and add them
- for (SlimefunItem slimefunItem : SlimefunPlugin.getRegistry().getEnabledSlimefunItems()) {
+ for (SlimefunItem slimefunItem : Slimefun.getRegistry().getEnabledSlimefunItems()) {
if (index == 44) {
break;
}
if (!slimefunItem.isHidden() && isSearchFilterApplicable(slimefunItem, searchTerm)) {
- ItemStack itemstack = new CustomItem(slimefunItem.getItem(), meta -> {
- Category category = slimefunItem.getCategory();
+ ItemStack itemstack = new CustomItemStack(slimefunItem.getItem(), meta -> {
+ ItemGroup category = slimefunItem.getItemGroup();
meta.setLore(Arrays.asList("", ChatColor.DARK_GRAY + "\u21E8 " + ChatColor.WHITE + category.getDisplayName(p)));
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS);
});
@@ -405,7 +407,7 @@ public void displayItem(PlayerProfile profile, ItemStack item, int index, boolea
return;
}
- Recipe[] recipes = SlimefunPlugin.getMinecraftRecipeService().getRecipesFor(item);
+ Recipe[] recipes = Slimefun.getMinecraftRecipeService().getRecipesFor(item);
if (recipes.length == 0) {
return;
@@ -430,7 +432,7 @@ private void showMinecraftRecipe(Recipe[] recipes, int index, ItemStack item, Pl
recipeType = new RecipeType(optional.get());
result = recipe.getResult();
} else {
- recipeItems = new ItemStack[] { null, null, null, null, new CustomItem(Material.BARRIER, "&4We are somehow unable to show you this Recipe :/"), null, null, null, null };
+ recipeItems = new ItemStack[] { null, null, null, null, new CustomItemStack(Material.BARRIER, "&4We are somehow unable to show you this Recipe :/"), null, null, null, null };
}
ChestMenu menu = create(p);
@@ -469,7 +471,7 @@ private void showMinecraftRecipe(Recipe[] recipes, int index, ItemStack item, Pl
}
private void showRecipeChoices(T recipe, ItemStack[] recipeItems, AsyncRecipeChoiceTask task) {
- RecipeChoice[] choices = SlimefunPlugin.getMinecraftRecipeService().getRecipeShape(recipe);
+ RecipeChoice[] choices = Slimefun.getMinecraftRecipeService().getRecipeShape(recipe);
if (choices.length == 1 && choices[0] instanceof MaterialChoice) {
recipeItems[4] = new ItemStack(((MaterialChoice) choices[0]).getChoices().get(0));
@@ -503,7 +505,7 @@ public void displayItem(PlayerProfile profile, SlimefunItem item, boolean addToH
Optional wiki = item.getWikipage();
if (wiki.isPresent()) {
- menu.addItem(8, new CustomItem(Material.KNOWLEDGE_BOOK, ChatColor.WHITE + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.wiki"), "", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + SlimefunPlugin.getLocalization().getMessage(p, "guide.tooltips.open-category")));
+ menu.addItem(8, new CustomItemStack(Material.KNOWLEDGE_BOOK, ChatColor.WHITE + Slimefun.getLocalization().getMessage(p, "guide.tooltips.wiki"), "", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + Slimefun.getLocalization().getMessage(p, "guide.tooltips.open-category")));
menu.addMenuClickHandler(8, (pl, slot, itemstack, action) -> {
pl.closeInventory();
ChatUtils.sendURL(pl, wiki.get());
@@ -590,8 +592,8 @@ public void createHeader(Player p, PlayerProfile profile, ChestMenu menu) {
menu.addMenuClickHandler(7, (pl, slot, item, action) -> {
pl.closeInventory();
- SlimefunPlugin.getLocalization().sendMessage(pl, "guide.search.message");
- ChatInput.waitForPlayer(SlimefunPlugin.instance(), pl, msg -> SlimefunGuide.openSearch(profile, msg, getMode(), isSurvivalMode()));
+ Slimefun.getLocalization().sendMessage(pl, "guide.search.message");
+ ChatInput.waitForPlayer(Slimefun.instance(), pl, msg -> SlimefunGuide.openSearch(profile, msg, getMode(), isSurvivalMode()));
return false;
});
@@ -605,7 +607,7 @@ private void addBackButton(ChestMenu menu, int slot, Player p, PlayerProfile pro
GuideHistory history = profile.getGuideHistory();
if (isSurvivalMode() && history.size() > 1) {
- menu.addItem(slot, new CustomItem(ChestMenuUtils.getBackButton(p, "", "&fLeft Click: &7Go back to previous Page", "&fShift + left Click: &7Go back to Main Menu")));
+ menu.addItem(slot, new CustomItemStack(ChestMenuUtils.getBackButton(p, "", "&fLeft Click: &7Go back to previous Page", "&fShift + left Click: &7Go back to Main Menu")));
menu.addMenuClickHandler(slot, (pl, s, is, action) -> {
if (action.isShiftClicked()) {
@@ -617,7 +619,7 @@ private void addBackButton(ChestMenu menu, int slot, Player p, PlayerProfile pro
});
} else {
- menu.addItem(slot, new CustomItem(ChestMenuUtils.getBackButton(p, "", ChatColor.GRAY + SlimefunPlugin.getLocalization().getMessage(p, "guide.back.guide"))));
+ menu.addItem(slot, new CustomItemStack(ChestMenuUtils.getBackButton(p, "", ChatColor.GRAY + Slimefun.getLocalization().getMessage(p, "guide.back.guide"))));
menu.addMenuClickHandler(slot, (pl, s, is, action) -> {
openMainMenu(profile, profile.getGuideHistory().getMainMenuPage());
return false;
@@ -634,8 +636,8 @@ private void addBackButton(ChestMenu menu, int slot, Player p, PlayerProfile pro
return item;
}
- String lore = hasPermission(p, slimefunItem) ? "&fNeeds to be unlocked in " + slimefunItem.getCategory().getDisplayName(p) : "&fNo Permission";
- return slimefunItem.canUse(p, false) ? item : new CustomItem(Material.BARRIER, ItemUtils.getItemName(item), "&4&l" + SlimefunPlugin.getLocalization().getMessage(p, "guide.locked"), "", lore);
+ String lore = hasPermission(p, slimefunItem) ? "&fNeeds to be unlocked in " + slimefunItem.getItemGroup().getDisplayName(p) : "&fNo Permission";
+ return slimefunItem.canUse(p, false) ? item : new CustomItemStack(Material.BARRIER, ItemUtils.getItemName(item), "&4&l" + Slimefun.getLocalization().getMessage(p, "guide.locked"), "", lore);
} else {
return item;
}
@@ -650,7 +652,7 @@ private void displayRecipes(Player p, PlayerProfile profile, ChestMenu menu, Rec
if (page == 0) {
for (int i = 27; i < 36; i++) {
- menu.replaceExistingItem(i, new CustomItem(ChestMenuUtils.getBackground(), sfItem.getRecipeSectionLabel(p)));
+ menu.replaceExistingItem(i, new CustomItemStack(ChestMenuUtils.getBackground(), sfItem.getRecipeSectionLabel(p)));
menu.addMenuClickHandler(i, ChestMenuUtils.getEmptyClickHandler());
}
}
@@ -724,11 +726,11 @@ private void addDisplayRecipe(ChestMenu menu, PlayerProfile profile, List pl.playSound(pl.getLocation(), sound, 1, 1));
@@ -738,7 +740,7 @@ private static boolean hasPermission(Player p, SlimefunItem item) {
@ParametersAreNonnullByDefault
private void printErrorMessage(Player p, Throwable x) {
p.sendMessage(ChatColor.DARK_RED + "An internal server error has occurred. Please inform an admin, check the console for further info.");
- SlimefunPlugin.logger().log(Level.SEVERE, "An error has occurred while trying to open a SlimefunItem in the guide!", x);
+ Slimefun.logger().log(Level.SEVERE, "An error has occurred while trying to open a SlimefunItem in the guide!", x);
}
}
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 fe3549dbef..a31d718a70 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
@@ -14,9 +14,9 @@
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler;
import io.papermc.lib.PaperLib;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
/**
* This is an implementation of {@link BlockBreakHandler} which is suited for any {@link SlimefunItem}
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 19be8abad3..173fb39813 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
@@ -16,18 +16,17 @@
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
+import io.github.bakedlibs.dough.common.ChatColors;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.items.magical.staves.StormStaff;
import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder;
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-
/**
* This class represents an item with a limited number of uses.
* When the item runs out of "uses", it breaks.
@@ -41,13 +40,14 @@
*/
public abstract class LimitedUseItem extends SimpleSlimefunItem {
- private final NamespacedKey defaultUsageKey = new NamespacedKey(SlimefunPlugin.instance(), "uses_left");
+ private final NamespacedKey defaultUsageKey;
private int maxUseCount = -1;
@ParametersAreNonnullByDefault
- protected LimitedUseItem(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
- super(category, item, recipeType, recipe);
+ protected LimitedUseItem(ItemGroup group, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ super(group, item, recipeType, recipe);
+ this.defaultUsageKey = new NamespacedKey(Slimefun.instance(), "uses_left");
addItemHandler(getItemHandler());
}
@@ -66,7 +66,10 @@ public final int getMaxUseCount() {
*
* @param count
* The maximum number of times this item can be used.
+ * <<<<<<< HEAD
+ * =======
*
+ * >>>>>>> branch 'master' of https://github.com/Slimefun/Slimefun4.git
* @return The {@link LimitedUseItem} for chaining of setters
*/
public final @Nonnull LimitedUseItem setMaxUseCount(int count) {
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 c445c93aa9..95cff07bd4 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
@@ -7,14 +7,14 @@
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
+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.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.attributes.NotPlaceable;
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactive;
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactivity;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
/**
* A quick and easy implementation of {@link SlimefunItem} that also implements the
@@ -40,7 +40,7 @@ public class RadioactiveItem extends SlimefunItem implements Radioactive, NotPla
* This will create a new {@link RadioactiveItem} with the given level of {@link Radioactivity}
*
* @param category
- * The {@link Category} of this {@link SlimefunItem}
+ * The {@link ItemGroup} of this {@link SlimefunItem}
* @param radioactivity
* the level of {@link Radioactivity}
* @param item
@@ -51,7 +51,7 @@ public class RadioactiveItem extends SlimefunItem implements Radioactive, NotPla
* The recipe of how to craft this {@link SlimefunItem}
*/
@ParametersAreNonnullByDefault
- public RadioactiveItem(Category category, Radioactivity radioactivity, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ public RadioactiveItem(ItemGroup category, Radioactivity radioactivity, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
this(category, radioactivity, item, recipeType, recipe, null);
}
@@ -59,7 +59,7 @@ public RadioactiveItem(Category category, Radioactivity radioactivity, SlimefunI
* This will create a new {@link RadioactiveItem} with the given level of {@link Radioactivity}
*
* @param category
- * The {@link Category} of this {@link SlimefunItem}
+ * The {@link ItemGroup} of this {@link SlimefunItem}
* @param radioactivity
* the level of {@link Radioactivity}
* @param item
@@ -72,7 +72,7 @@ public RadioactiveItem(Category category, Radioactivity radioactivity, SlimefunI
* The recipe output
*/
@ParametersAreNonnullByDefault
- public RadioactiveItem(Category category, Radioactivity radioactivity, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, @Nullable ItemStack recipeOutput) {
+ public RadioactiveItem(ItemGroup category, Radioactivity radioactivity, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, @Nullable ItemStack recipeOutput) {
super(category, item, recipeType, recipe, recipeOutput);
this.radioactivity = 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 686761c293..839a3ce053 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
@@ -6,14 +6,13 @@
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemHandler;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemUseHandler;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
-
/**
* This is basically a quickstart class for your very first {@link SlimefunItem}.
* This class easily allows you to add one {@link ItemHandler} to your {@link SlimefunItem}.
@@ -33,13 +32,13 @@
public abstract class SimpleSlimefunItem extends SlimefunItem {
@ParametersAreNonnullByDefault
- protected SimpleSlimefunItem(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
- super(category, item, recipeType, recipe);
+ protected SimpleSlimefunItem(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ super(itemGroup, item, recipeType, recipe);
}
@ParametersAreNonnullByDefault
- protected SimpleSlimefunItem(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, @Nullable ItemStack recipeOutput) {
- super(category, item, recipeType, recipe, recipeOutput);
+ protected SimpleSlimefunItem(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, @Nullable ItemStack recipeOutput) {
+ super(itemGroup, item, recipeType, recipe, recipeOutput);
}
@Override
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/VanillaItem.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/VanillaItem.java
index 166a9b3712..20d42af888 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/VanillaItem.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/VanillaItem.java
@@ -4,10 +4,10 @@
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.ItemState;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
/**
* Represents a vanilla item that is overridden by Slimefun (like {@code ELYTRA}).
@@ -29,7 +29,7 @@ public class VanillaItem extends SlimefunItem {
/**
* Instantiates a new {@link VanillaItem} with the given arguments.
*
- * @param category
+ * @param itemGroup
* the category to bind this {@link VanillaItem} to
* @param item
* the item corresponding to this {@link VanillaItem}
@@ -41,8 +41,8 @@ public class VanillaItem extends SlimefunItem {
* the recipe to obtain this {@link VanillaItem}
*/
@ParametersAreNonnullByDefault
- public VanillaItem(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe) {
- super(category, item, id, recipeType, recipe);
+ public VanillaItem(ItemGroup itemGroup, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe) {
+ super(itemGroup, item, id, recipeType, recipe);
useableInWorkbench = true;
}
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 9c1382e317..d336486951 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
@@ -9,14 +9,14 @@
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.api.events.AncientAltarCraftEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.items.settings.IntRangeSetting;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener;
import io.github.thebusybiscuit.slimefun4.implementation.tasks.AncientAltarTask;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
/**
* The {@link AncientAltar} is a multiblock structure.
@@ -45,7 +45,7 @@ public class AncientAltar extends SlimefunItem {
private final ItemSetting stepDelay = new IntRangeSetting(this, "step-delay", 0, DEFAULT_STEP_DELAY, Integer.MAX_VALUE);
@ParametersAreNonnullByDefault
- public AncientAltar(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ public AncientAltar(ItemGroup category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
addItemSetting(stepDelay);
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 d770fb7750..e0d31023fd 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
@@ -17,21 +17,21 @@
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.util.Vector;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
-import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.bakedlibs.dough.common.ChatColors;
+import io.github.bakedlibs.dough.items.CustomItemStack;
+import io.github.bakedlibs.dough.items.ItemUtils;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSpawnReason;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockDispenseHandler;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.handlers.SimpleBlockBreakHandler;
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener;
import io.github.thebusybiscuit.slimefun4.implementation.tasks.AncientAltarTask;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
/**
* The {@link AncientPedestal} is a part of the {@link AncientAltar}.
@@ -51,7 +51,7 @@ public class AncientPedestal extends SimpleSlimefunItem {
public static final String ITEM_PREFIX = ChatColors.color("&dALTAR &3Probe - &e");
@ParametersAreNonnullByDefault
- public AncientPedestal(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) {
+ public AncientPedestal(ItemGroup category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack recipeOutput) {
super(category, item, recipeType, recipe, recipeOutput);
addItemHandler(onBreak());
@@ -68,7 +68,7 @@ public void onBlockBreak(@Nonnull Block b) {
Item stack = entity.get();
if (stack.isValid()) {
- stack.removeMetadata("no_pickup", SlimefunPlugin.instance());
+ stack.removeMetadata("no_pickup", Slimefun.instance());
b.getWorld().dropItem(b.getLocation(), getOriginalItemStack(stack));
stack.remove();
}
@@ -124,7 +124,7 @@ private boolean testItem(@Nullable Entity n) {
public void placeItem(@Nonnull Player p, @Nonnull Block b) {
ItemStack hand = p.getInventory().getItemInMainHand();
- ItemStack displayItem = new CustomItem(hand, ITEM_PREFIX + System.nanoTime());
+ ItemStack displayItem = new CustomItemStack(hand, ITEM_PREFIX + System.nanoTime());
displayItem.setAmount(1);
// Get the display name of the original Item in the Player's hand
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 a8a90354fe..3fef5f5925 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
@@ -4,7 +4,7 @@
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
+import io.github.bakedlibs.dough.items.CustomItemStack;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
/**
@@ -43,7 +43,7 @@ public enum AndroidFuelSource {
*/
@Nonnull
public ItemStack getItem() {
- return new CustomItem(HeadTexture.GENERATOR.getAsItemStack(), "&8\u21E9 &cFuel Input &8\u21E9", lore);
+ return new CustomItemStack(HeadTexture.GENERATOR.getAsItemStack(), "&8\u21E9 &cFuel Input &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 17184ad56b..f2a1fab90d 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
@@ -5,12 +5,12 @@
import org.bukkit.block.Dispenser;
import org.bukkit.inventory.ItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockDispenseHandler;
import io.github.thebusybiscuit.slimefun4.implementation.handlers.VanillaInventoryDropHandler;
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
/**
* The {@link AndroidInterface} are inventories used to interact with a {@link ProgrammableAndroid}.
@@ -24,7 +24,7 @@
public class AndroidInterface extends SimpleSlimefunItem {
@ParametersAreNonnullByDefault
- public AndroidInterface(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ public AndroidInterface(ItemGroup category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
addItemHandler(new VanillaInventoryDropHandler<>(Dispenser.class));
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java
index 77bb55601d..e14ecbc777 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ButcherAndroid.java
@@ -11,16 +11,16 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
public class ButcherAndroid extends ProgrammableAndroid {
private static final String METADATA_KEY = "android_killer";
- public ButcherAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ public ButcherAndroid(ItemGroup category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, tier, item, recipeType, recipe);
}
@@ -56,10 +56,10 @@ protected void attack(Block b, BlockFace face, Predicate predicate
if (attack) {
if (n.hasMetadata(METADATA_KEY)) {
- n.removeMetadata(METADATA_KEY, SlimefunPlugin.instance());
+ n.removeMetadata(METADATA_KEY, Slimefun.instance());
}
- n.setMetadata(METADATA_KEY, new FixedMetadataValue(SlimefunPlugin.instance(), new AndroidInstance(this, b)));
+ n.setMetadata(METADATA_KEY, new FixedMetadataValue(Slimefun.instance(), new AndroidInstance(this, b)));
((LivingEntity) n).damage(damage);
break;
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java
index f2c4987ab3..2b985ef904 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java
@@ -14,15 +14,16 @@
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.api.events.AndroidFarmEvent;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
public class FarmerAndroid extends ProgrammableAndroid {
@ParametersAreNonnullByDefault
- public FarmerAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ public FarmerAndroid(ItemGroup category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, tier, item, recipeType, recipe);
}
diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FisherAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FisherAndroid.java
index 9dd3373d75..16cd88e3cc 100644
--- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FisherAndroid.java
+++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FisherAndroid.java
@@ -9,17 +9,18 @@
import org.bukkit.block.BlockFace;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import io.github.bakedlibs.dough.collections.RandomizedSet;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
public class FisherAndroid extends ProgrammableAndroid {
private final RandomizedSet fishingLoot = new RandomizedSet<>();
- public FisherAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ public FisherAndroid(ItemGroup category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, tier, item, recipeType, recipe);
// Fish
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 9bf0df3faa..13b55f4c3b 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
@@ -20,6 +20,7 @@
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
/**
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 7399ec8e26..af3fd7d6b4 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
@@ -16,16 +16,17 @@
import org.bukkit.block.BlockFace;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
+import io.github.bakedlibs.dough.protection.Interaction;
import io.github.thebusybiscuit.slimefun4.api.events.AndroidMineEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.InfiniteBlockGenerator;
import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
+
import me.mrCookieSlime.Slimefun.api.BlockStorage;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
/**
@@ -57,7 +58,7 @@ public class MinerAndroid extends ProgrammableAndroid {
private final ItemSetting applyOptimizations = new ItemSetting<>(this, "reduced-block-updates", true);
@ParametersAreNonnullByDefault
- public MinerAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ public MinerAndroid(ItemGroup category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, tier, item, recipeType, recipe);
addItemSetting(firesEvent, applyOptimizations);
@@ -77,7 +78,7 @@ protected void dig(Block b, BlockMenu menu, Block block) {
if (!SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(block.getType()) && !drops.isEmpty()) {
OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")));
- if (SlimefunPlugin.getProtectionManager().hasPermission(owner, block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
+ if (Slimefun.getProtectionManager().hasPermission(owner, block.getLocation(), Interaction.BREAK_BLOCK)) {
AndroidMineEvent event = new AndroidMineEvent(block, new AndroidInstance(this, b));
Bukkit.getPluginManager().callEvent(event);
@@ -101,7 +102,7 @@ protected void moveAndDig(Block b, BlockMenu menu, BlockFace face, Block block)
if (!SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(block.getType()) && !drops.isEmpty()) {
OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")));
- if (SlimefunPlugin.getProtectionManager().hasPermission(owner, block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
+ if (Slimefun.getProtectionManager().hasPermission(owner, block.getLocation(), Interaction.BREAK_BLOCK)) {
AndroidMineEvent event = new AndroidMineEvent(block, new AndroidInstance(this, b));
Bukkit.getPluginManager().callEvent(event);
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 9293d46b81..c3d5299fcc 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
@@ -31,34 +31,36 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
-import io.github.thebusybiscuit.cscorelib2.chat.ChatInput;
-import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
-import io.github.thebusybiscuit.cscorelib2.skull.SkullBlock;
+import io.github.bakedlibs.dough.chat.ChatInput;
+import io.github.bakedlibs.dough.common.ChatColors;
+import io.github.bakedlibs.dough.common.CommonPatterns;
+import io.github.bakedlibs.dough.items.CustomItemStack;
+import io.github.bakedlibs.dough.items.ItemUtils;
+import io.github.bakedlibs.dough.skins.PlayerHead;
+import io.github.bakedlibs.dough.skins.PlayerSkin;
+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.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockBreakHandler;
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
-import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.papermc.lib.PaperLib;
+
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.Objects.Category;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
@@ -76,7 +78,7 @@ public class ProgrammableAndroid extends SlimefunItem implements InventoryBlock,
private final int tier;
@ParametersAreNonnullByDefault
- public ProgrammableAndroid(Category category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ public ProgrammableAndroid(ItemGroup category, int tier, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
this.tier = tier;
@@ -95,7 +97,7 @@ public boolean canOpen(Block b, Player p) {
boolean open = BlockStorage.getLocationInfo(b.getLocation(), "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.android.bypass");
if (!open) {
- SlimefunPlugin.getLocalization().sendMessage(p, "inventory.no-access", true);
+ Slimefun.getLocalization().sendMessage(p, "inventory.no-access", true);
}
return open;
@@ -103,25 +105,25 @@ public boolean canOpen(Block b, Player p) {
@Override
public void newInstance(BlockMenu menu, Block b) {
- menu.replaceExistingItem(15, new CustomItem(HeadTexture.SCRIPT_START.getAsItemStack(), "&aStart/Continue"));
+ menu.replaceExistingItem(15, new CustomItemStack(HeadTexture.SCRIPT_START.getAsItemStack(), "&aStart/Continue"));
menu.addMenuClickHandler(15, (p, slot, item, action) -> {
- SlimefunPlugin.getLocalization().sendMessage(p, "android.started", true);
+ Slimefun.getLocalization().sendMessage(p, "android.started", true);
BlockStorage.addBlockInfo(b, "paused", "false");
p.closeInventory();
return false;
});
- menu.replaceExistingItem(17, new CustomItem(HeadTexture.SCRIPT_PAUSE.getAsItemStack(), "&4Pause"));
+ menu.replaceExistingItem(17, new CustomItemStack(HeadTexture.SCRIPT_PAUSE.getAsItemStack(), "&4Pause"));
menu.addMenuClickHandler(17, (p, slot, item, action) -> {
BlockStorage.addBlockInfo(b, "paused", "true");
- SlimefunPlugin.getLocalization().sendMessage(p, "android.stopped", true);
+ Slimefun.getLocalization().sendMessage(p, "android.stopped", true);
return false;
});
- menu.replaceExistingItem(16, new CustomItem(HeadTexture.ENERGY_REGULATOR.getAsItemStack(), "&bMemory Core", "", "&8\u21E8 &7Click to open the Script Editor"));
+ menu.replaceExistingItem(16, new CustomItemStack(HeadTexture.ENERGY_REGULATOR.getAsItemStack(), "&bMemory Core", "", "&8\u21E8 &7Click to open the Script Editor"));
menu.addMenuClickHandler(16, (p, slot, item, action) -> {
BlockStorage.addBlockInfo(b, "paused", "true");
- SlimefunPlugin.getLocalization().sendMessage(p, "android.stopped", true);
+ Slimefun.getLocalization().sendMessage(p, "android.stopped", true);
openScriptEditor(p, b);
return false;
});
@@ -238,10 +240,10 @@ public boolean isSynchronized() {
@ParametersAreNonnullByDefault
public void openScript(Player p, Block b, String sourceCode) {
- ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.editor"));
+ ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + Slimefun.getLocalization().getMessage(p, "android.scripts.editor"));
menu.setEmptySlotsClickable(false);
- menu.addItem(0, new CustomItem(Instruction.START.getItem(), SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.instructions.START"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface"));
+ menu.addItem(0, new CustomItemStack(Instruction.START.getItem(), Slimefun.getLocalization().getMessage(p, "android.scripts.instructions.START"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface"));
menu.addMenuClickHandler(0, (pl, slot, item, action) -> {
BlockMenu inv = BlockStorage.getInventory(b);
// Fixes #2937
@@ -253,7 +255,7 @@ public void openScript(Player p, Block b, String sourceCode) {
return false;
});
- String[] script = PatternUtils.DASH.split(sourceCode);
+ String[] script = CommonPatterns.DASH.split(sourceCode);
for (int i = 1; i < script.length; i++) {
int index = i;
@@ -262,7 +264,7 @@ public void openScript(Player p, Block b, String sourceCode) {
boolean hasFreeSlot = script.length < 54;
if (hasFreeSlot) {
- menu.addItem(i, new CustomItem(HeadTexture.SCRIPT_NEW.getAsItemStack(), "&7> Add new Command"));
+ menu.addItem(i, new CustomItemStack(HeadTexture.SCRIPT_NEW.getAsItemStack(), "&7> Add new Command"));
menu.addMenuClickHandler(i, (pl, slot, item, action) -> {
editInstruction(pl, b, script, index);
return false;
@@ -270,7 +272,7 @@ public void openScript(Player p, Block b, String sourceCode) {
}
int slot = i + (hasFreeSlot ? 1 : 0);
- menu.addItem(slot, new CustomItem(Instruction.REPEAT.getItem(), SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.instructions.REPEAT"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface"));
+ menu.addItem(slot, new CustomItemStack(Instruction.REPEAT.getItem(), Slimefun.getLocalization().getMessage(p, "android.scripts.instructions.REPEAT"), "", "&7\u21E8 &eLeft Click &7to return to the Android's interface"));
menu.addMenuClickHandler(slot, (pl, s, item, action) -> {
BlockMenu inv = BlockStorage.getInventory(b);
// Fixes #2937
@@ -285,12 +287,12 @@ public void openScript(Player p, Block b, String sourceCode) {
Instruction instruction = Instruction.getInstruction(script[i]);
if (instruction == null) {
- SlimefunPlugin.instance().getLogger().log(Level.WARNING, "Failed to parse Android instruction: {0}, maybe your server is out of date?", script[i]);
+ Slimefun.instance().getLogger().log(Level.WARNING, "Failed to parse Android instruction: {0}, maybe your server is out of date?", script[i]);
return;
}
ItemStack stack = instruction.getItem();
- menu.addItem(i, new CustomItem(stack, SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.instructions." + instruction.name()), "", "&7\u21E8 &eLeft Click &7to edit", "&7\u21E8 &eRight Click &7to delete", "&7\u21E8 &eShift + Right Click &7to duplicate"));
+ menu.addItem(i, new CustomItemStack(stack, Slimefun.getLocalization().getMessage(p, "android.scripts.instructions." + instruction.name()), "", "&7\u21E8 &eLeft Click &7to edit", "&7\u21E8 &eRight Click &7to delete", "&7\u21E8 &eShift + Right Click &7to duplicate"));
menu.addMenuClickHandler(i, (pl, slot, item, action) -> {
if (action.isRightClicked() && action.isShiftClicked()) {
if (script.length == 54) {
@@ -397,7 +399,7 @@ protected void openScriptDownloader(Player p, Block b, int page) {
return false;
});
- menu.addItem(48, new CustomItem(HeadTexture.SCRIPT_UP.getAsItemStack(), "&eUpload a Script", "", "&6Click &7to upload your Android's Script", "&7to the Server's database"));
+ menu.addItem(48, new CustomItemStack(HeadTexture.SCRIPT_UP.getAsItemStack(), "&eUpload a Script", "", "&6Click &7to upload your Android's Script", "&7to the Server's database"));
menu.addMenuClickHandler(48, (pl, slot, item, action) -> {
uploadScript(pl, b, page);
return false;
@@ -415,7 +417,7 @@ protected void openScriptDownloader(Player p, Block b, int page) {
return false;
});
- menu.addItem(53, new CustomItem(HeadTexture.SCRIPT_LEFT.getAsItemStack(), "&6> Back", "", "&7Return to the Android's interface"));
+ menu.addItem(53, new CustomItemStack(HeadTexture.SCRIPT_LEFT.getAsItemStack(), "&6> Back", "", "&7Return to the Android's interface"));
menu.addMenuClickHandler(53, (pl, slot, item, action) -> {
openScriptEditor(pl, b);
return false;
@@ -435,12 +437,12 @@ protected void openScriptDownloader(Player p, Block b, int page) {
try {
if (action.isShiftClicked()) {
if (script.isAuthor(player)) {
- SlimefunPlugin.getLocalization().sendMessage(player, "android.scripts.rating.own", true);
+ Slimefun.getLocalization().sendMessage(player, "android.scripts.rating.own", true);
} else if (script.canRate(player)) {
script.rate(player, !action.isRightClicked());
openScriptDownloader(player, b, page);
} else {
- SlimefunPlugin.getLocalization().sendMessage(player, "android.scripts.rating.already", true);
+ Slimefun.getLocalization().sendMessage(player, "android.scripts.rating.already", true);
}
} else if (!action.isRightClicked()) {
script.download();
@@ -448,7 +450,7 @@ protected void openScriptDownloader(Player p, Block b, int page) {
openScriptEditor(player, b);
}
} catch (Exception x) {
- SlimefunPlugin.logger().log(Level.SEVERE, "An Exception was thrown when a User tried to download a Script!", x);
+ Slimefun.logger().log(Level.SEVERE, "An Exception was thrown when a User tried to download a Script!", x);
}
return false;
@@ -472,36 +474,36 @@ private void uploadScript(Player p, Block b, int page) {
}
if (script.getSourceCode().equals(code)) {
- SlimefunPlugin.getLocalization().sendMessage(p, "android.scripts.already-uploaded", true);
+ Slimefun.getLocalization().sendMessage(p, "android.scripts.already-uploaded", true);
return;
}
}
p.closeInventory();
- SlimefunPlugin.getLocalization().sendMessages(p, "android.scripts.enter-name");
+ Slimefun.getLocalization().sendMessages(p, "android.scripts.enter-name");
int id = nextId;
- ChatInput.waitForPlayer(SlimefunPlugin.instance(), p, msg -> {
+ ChatInput.waitForPlayer(Slimefun.instance(), p, msg -> {
Script.upload(p, getAndroidType(), id, msg, code);
- SlimefunPlugin.getLocalization().sendMessages(p, "android.scripts.uploaded");
+ Slimefun.getLocalization().sendMessages(p, "android.scripts.uploaded");
openScriptDownloader(p, b, page);
});
}
public void openScriptEditor(Player p, Block b) {
- ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.editor"));
+ ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + Slimefun.getLocalization().getMessage(p, "android.scripts.editor"));
menu.setEmptySlotsClickable(false);
- menu.addItem(1, new CustomItem(HeadTexture.SCRIPT_FORWARD.getAsItemStack(), "&2> Edit Script", "", "&aEdits your current Script"));
+ menu.addItem(1, new CustomItemStack(HeadTexture.SCRIPT_FORWARD.getAsItemStack(), "&2> Edit Script", "", "&aEdits your current Script"));
menu.addMenuClickHandler(1, (pl, slot, item, action) -> {
String script = BlockStorage.getLocationInfo(b.getLocation()).getString("script");
// Fixes #2937
if (script != null) {
- if (PatternUtils.DASH.split(script).length <= MAX_SCRIPT_LENGTH) {
+ if (CommonPatterns.DASH.split(script).length <= MAX_SCRIPT_LENGTH) {
openScript(pl, b, getScript(b.getLocation()));
} else {
pl.closeInventory();
- SlimefunPlugin.getLocalization().sendMessage(pl, "android.scripts.too-long");
+ Slimefun.getLocalization().sendMessage(pl, "android.scripts.too-long");
}
} else {
pl.closeInventory();
@@ -509,19 +511,19 @@ public void openScriptEditor(Player p, Block b) {
return false;
});
- menu.addItem(3, new CustomItem(HeadTexture.SCRIPT_NEW.getAsItemStack(), "&4> Create new Script", "", "&cDeletes your current Script", "&cand creates a blank one"));
+ menu.addItem(3, new CustomItemStack(HeadTexture.SCRIPT_NEW.getAsItemStack(), "&4> Create new Script", "", "&cDeletes your current Script", "&cand creates a blank one"));
menu.addMenuClickHandler(3, (pl, slot, item, action) -> {
openScript(pl, b, DEFAULT_SCRIPT);
return false;
});
- menu.addItem(5, new CustomItem(HeadTexture.SCRIPT_DOWN.getAsItemStack(), "&6> Download a Script", "", "&eDownload a Script from the Server", "&eYou can edit or simply use it"));
+ menu.addItem(5, new CustomItemStack(HeadTexture.SCRIPT_DOWN.getAsItemStack(), "&6> Download a Script", "", "&eDownload a Script from the Server", "&eYou can edit or simply use it"));
menu.addMenuClickHandler(5, (pl, slot, item, action) -> {
openScriptDownloader(pl, b, 1);
return false;
});
- menu.addItem(8, new CustomItem(HeadTexture.SCRIPT_LEFT.getAsItemStack(), "&6> Back", "", "&7Return to the Android's interface"));
+ menu.addItem(8, new CustomItemStack(HeadTexture.SCRIPT_LEFT.getAsItemStack(), "&6> Back", "", "&7Return to the Android's interface"));
menu.addMenuClickHandler(8, (pl, slot, item, action) -> {
BlockMenu inv = BlockStorage.getInventory(b);
// Fixes #2937
@@ -554,11 +556,11 @@ protected List getValidScriptInstructions() {
}
protected void editInstruction(Player p, Block b, String[] script, int index) {
- ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.editor"));
+ ChestMenu menu = new ChestMenu(ChatColor.DARK_AQUA + Slimefun.getLocalization().getMessage(p, "android.scripts.editor"));
ChestMenuUtils.drawBackground(menu, 0, 1, 2, 3, 4, 5, 6, 7, 8);
menu.setEmptySlotsClickable(false);
- menu.addItem(9, new CustomItem(HeadTexture.SCRIPT_PAUSE.getAsItemStack(), "&fDo nothing"), (pl, slot, item, action) -> {
+ menu.addItem(9, new CustomItemStack(HeadTexture.SCRIPT_PAUSE.getAsItemStack(), "&fDo nothing"), (pl, slot, item, action) -> {
String code = deleteInstruction(script, index);
setScript(b.getLocation(), code);
openScript(p, b, code);
@@ -567,7 +569,7 @@ protected void editInstruction(Player p, Block b, String[] script, int index) {
int i = 10;
for (Instruction instruction : getValidScriptInstructions()) {
- menu.addItem(i, new CustomItem(instruction.getItem(), SlimefunPlugin.getLocalization().getMessage(p, "android.scripts.instructions." + instruction.name())), (pl, slot, item, action) -> {
+ menu.addItem(i, new CustomItemStack(instruction.getItem(), Slimefun.getLocalization().getMessage(p, "android.scripts.instructions." + instruction.name())), (pl, slot, item, action) -> {
String code = addInstruction(script, index, instruction);
setScript(b.getLocation(), code);
openScript(p, b, code);
@@ -592,7 +594,7 @@ public void setScript(@Nonnull Location l, @Nonnull String script) {
Validate.notNull(script, "No script given");
Validate.isTrue(script.startsWith(Instruction.START.name() + '-'), "A script must begin with a 'START' token.");
Validate.isTrue(script.endsWith('-' + Instruction.REPEAT.name()), "A script must end with a 'REPEAT' token.");
- Validate.isTrue(PatternUtils.DASH.split(script).length <= MAX_SCRIPT_LENGTH, "Scripts may not have more than " + MAX_SCRIPT_LENGTH + " segments");
+ Validate.isTrue(CommonPatterns.DASH.split(script).length <= MAX_SCRIPT_LENGTH, "Scripts may not have more than " + MAX_SCRIPT_LENGTH + " segments");
BlockStorage.addBlockInfo(l, "script", script);
}
@@ -692,7 +694,7 @@ protected void tick(Block b, Config data) {
consumeFuel(b, menu);
} else {
String code = data.getString("script");
- String[] script = PatternUtils.DASH.split(code == null ? DEFAULT_SCRIPT : code);
+ String[] script = CommonPatterns.DASH.split(code == null ? DEFAULT_SCRIPT : code);
String indexData = data.getString("index");
int index = (indexData == null ? 0 : Integer.parseInt(indexData)) + 1;
@@ -705,7 +707,7 @@ protected void tick(Block b, Config data) {
Instruction instruction = Instruction.getInstruction(script[index]);
if (instruction == null) {
- SlimefunPlugin.instance().getLogger().log(Level.WARNING, "Failed to parse Android instruction: {0}, maybe your server is out of date?", script[index]);
+ Slimefun.instance().getLogger().log(Level.WARNING, "Failed to parse Android instruction: {0}, maybe your server is out of date?", script[index]);
return;
}
@@ -819,7 +821,7 @@ private boolean insertFuel(BlockMenu menu, Inventory dispenser, int slot, ItemSt
if (rest > 0) {
int amount = newFuel.getAmount() > rest ? rest : newFuel.getAmount();
- menu.replaceExistingItem(43, new CustomItem(newFuel, currentFuel.getAmount() + amount));
+ menu.replaceExistingItem(43, new CustomItemStack(newFuel, currentFuel.getAmount() + amount));
ItemUtils.consumeItem(newFuel, amount, false);
}
@@ -901,7 +903,11 @@ protected void move(Block b, BlockFace face, Block block) {
});
block.setBlockData(blockData);
- SlimefunPlugin.runSync(() -> SkullBlock.setFromBase64(block, texture));
+
+ Slimefun.runSync(() -> {
+ PlayerSkin skin = PlayerSkin.fromBase64(texture);
+ PlayerHead.setSkin(block, skin, true);
+ });
b.setType(Material.AIR);
BlockStorage.moveBlockInfo(b.getLocation(), block.getLocation());
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 4d77461dad..652a75f9ba 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
@@ -19,9 +19,9 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import io.github.thebusybiscuit.cscorelib2.config.Config;
-import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.bakedlibs.dough.config.Config;
+import io.github.bakedlibs.dough.items.CustomItemStack;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
@@ -145,7 +145,7 @@ ItemStack getAsItemStack(@Nonnull ProgrammableAndroid android, @Nonnull Player p
lore.add("&eShift + Right Click &fto leave a negative Rating");
}
- return new CustomItem(android.getItem(), "&b" + getName(), lore.toArray(new String[0]));
+ return new CustomItemStack(android.getItem(), "&b" + getName(), lore.toArray(new String[0]));
}
@Nonnull
@@ -244,7 +244,7 @@ private static void loadScripts(@Nonnull List