From 0228b76f0b489faf856d7d2ae432b7bdf31f139c Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Fri, 6 Mar 2020 16:39:07 +0100 Subject: [PATCH] Cleaned up some old stuff and added new bStats charts --- CHANGELOG.md | 2 + .../core/commands/SlimefunCommand.java | 8 ++ .../core/services/metrics/AddonsChart.java | 27 +++++ .../core/services/metrics/CommandChart.java | 25 ++++ .../services/metrics/GuideLayoutChart.java | 17 +++ .../core/services/metrics/MetricsService.java | 4 + .../metrics/ResearchesEnabledChart.java | 16 +++ .../guide/ChestSlimefunGuide.java | 1 + .../items/cargo/AdvancedCargoOutputNode.java | 1 - .../items/cargo/CargoOutputNode.java | 1 - .../implementation/items/food/Juice.java | 1 - .../setup/SlimefunItemSetup.java | 14 ++- .../Slimefun/Objects/Category.java | 29 ----- .../SlimefunItem/SlimefunBackpack.java | 21 ---- .../Objects/SlimefunItem/SlimefunItem.java | 113 +----------------- .../Slimefun/Setup/SlimefunManager.java | 25 ---- .../Slimefun/SlimefunPlugin.java | 7 +- 17 files changed, 115 insertions(+), 197 deletions(-) create mode 100644 src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/AddonsChart.java create mode 100644 src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/CommandChart.java create mode 100644 src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/GuideLayoutChart.java create mode 100644 src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/ResearchesEnabledChart.java delete mode 100644 src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunBackpack.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 162966cb5..dcc318dd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,8 +37,10 @@ ## Release Candidate 8 (TBD) ### Additions +* Added some new charts to bStats ### Changes +* Removed some deprecated parts of the API ### Fixes 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 3d7ac502e..c93654721 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 @@ -1,7 +1,9 @@ package io.github.thebusybiscuit.slimefun4.core.commands; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import org.bukkit.ChatColor; @@ -26,6 +28,7 @@ public class SlimefunCommand implements CommandExecutor, Listener { private final SlimefunPlugin plugin; private final List commands = new LinkedList<>(); + private final Map commandUsage = new HashMap<>(); public SlimefunCommand(SlimefunPlugin plugin) { plugin.getServer().getPluginManager().registerEvents(this, plugin); @@ -41,6 +44,10 @@ public class SlimefunCommand implements CommandExecutor, Listener { return plugin; } + public Map getCommandUsage() { + return commandUsage; + } + @Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (args.length > 0) { @@ -78,6 +85,7 @@ public class SlimefunCommand implements CommandExecutor, Listener { else { for (SubCommand command : commands) { if (args[0].equalsIgnoreCase(command.getName())) { + commandUsage.merge(command, 1, Integer::sum); command.onExecute(sender, args); return true; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/AddonsChart.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/AddonsChart.java new file mode 100644 index 000000000..911badfc2 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/AddonsChart.java @@ -0,0 +1,27 @@ +package io.github.thebusybiscuit.slimefun4.core.services.metrics; + +import java.util.HashMap; +import java.util.Map; + +import org.bstats.bukkit.Metrics.AdvancedPie; +import org.bukkit.plugin.Plugin; + +import me.mrCookieSlime.Slimefun.SlimefunPlugin; + +class AddonsChart extends AdvancedPie { + + public AddonsChart() { + super("installed_addons", () -> { + Map addons = new HashMap<>(); + + for (Plugin plugin : SlimefunPlugin.getInstalledAddons()) { + if (plugin.isEnabled()) { + addons.put(plugin.getName(), 1); + } + } + + return addons; + }); + } + +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/CommandChart.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/CommandChart.java new file mode 100644 index 000000000..e3b09a734 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/CommandChart.java @@ -0,0 +1,25 @@ +package io.github.thebusybiscuit.slimefun4.core.services.metrics; + +import java.util.HashMap; +import java.util.Map; + +import org.bstats.bukkit.Metrics.AdvancedPie; + +import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand; +import me.mrCookieSlime.Slimefun.SlimefunPlugin; + +class CommandChart extends AdvancedPie { + + public CommandChart() { + super("commands_ran", () -> { + Map commands = new HashMap<>(); + + for (Map.Entry entry : SlimefunPlugin.getCommand().getCommandUsage().entrySet()) { + commands.put("/sf " + entry.getKey().getName(), entry.getValue()); + } + + return commands; + }); + } + +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/GuideLayoutChart.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/GuideLayoutChart.java new file mode 100644 index 000000000..af9980c3f --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/GuideLayoutChart.java @@ -0,0 +1,17 @@ +package io.github.thebusybiscuit.slimefun4.core.services.metrics; + +import org.bstats.bukkit.Metrics.SimplePie; + +import me.mrCookieSlime.Slimefun.SlimefunPlugin; + +class GuideLayoutChart extends SimplePie { + + public GuideLayoutChart() { + super("guide_layout", () -> { + boolean book = SlimefunPlugin.getCfg().getBoolean("guide.default-view-book"); + + return book ? "Book" : "Chest GUI"; + }); + } + +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/MetricsService.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/MetricsService.java index 525c7ce43..68afbf4be 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/MetricsService.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/MetricsService.java @@ -34,6 +34,10 @@ public class MetricsService { metrics.addCustomChart(new BranchChart()); metrics.addCustomChart(new ServerLanguageChart()); metrics.addCustomChart(new PlayerLanguageChart()); + metrics.addCustomChart(new ResearchesEnabledChart()); + metrics.addCustomChart(new GuideLayoutChart()); + metrics.addCustomChart(new AddonsChart()); + metrics.addCustomChart(new CommandChart()); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/ResearchesEnabledChart.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/ResearchesEnabledChart.java new file mode 100644 index 000000000..c943d97f9 --- /dev/null +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/metrics/ResearchesEnabledChart.java @@ -0,0 +1,16 @@ +package io.github.thebusybiscuit.slimefun4.core.services.metrics; + +import org.bstats.bukkit.Metrics.SimplePie; + +import me.mrCookieSlime.Slimefun.SlimefunPlugin; + +class ResearchesEnabledChart extends SimplePie { + + public ResearchesEnabledChart() { + super("servers_with_researches_enabled", () -> { + boolean enabled = SlimefunPlugin.getSettings().researchesEnabled; + return enabled ? "enabled" : "disabled"; + }); + } + +} diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java index 0a437aa1a..1b2861772 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/ChestSlimefunGuide.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import org.bukkit.ChatColor; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AdvancedCargoOutputNode.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AdvancedCargoOutputNode.java index 1d1828c18..21a984a1a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AdvancedCargoOutputNode.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/AdvancedCargoOutputNode.java @@ -22,7 +22,6 @@ 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.CargoNet; import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow; public class AdvancedCargoOutputNode extends SlimefunItem { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/CargoOutputNode.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/CargoOutputNode.java index ad61175c2..5799acb07 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/CargoOutputNode.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/cargo/CargoOutputNode.java @@ -20,7 +20,6 @@ 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.CargoNet; import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow; public class CargoOutputNode extends SlimefunItem { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/Juice.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/Juice.java index f9b7188cc..27454d15b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/Juice.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/Juice.java @@ -2,7 +2,6 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.food; import org.bukkit.inventory.ItemStack; -import io.github.thebusybiscuit.slimefun4.implementation.items.food.Cooler; import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener; import me.mrCookieSlime.Slimefun.Lists.RecipeType; import me.mrCookieSlime.Slimefun.Objects.Category; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java index 5e432e800..96dd127c4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java @@ -973,10 +973,10 @@ public final class SlimefunItemSetup { new ItemStack[] {null, new ItemStack(Material.WITHER_SKELETON_SKULL), null, null, new ItemStack(Material.WITHER_SKELETON_SKULL), null, null, new ItemStack(Material.BLAZE_ROD), null}) .register(plugin); - new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.DIGITAL_MINER, "DIGITAL_MINER", + SlimefunMachine miner = new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.DIGITAL_MINER, "DIGITAL_MINER", new ItemStack[] {SlimefunItems.SOLAR_PANEL, new ItemStack(Material.CHEST), SlimefunItems.SOLAR_PANEL, new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.DISPENSER), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.HOPPER), new ItemStack(Material.IRON_BLOCK)}, - new ItemStack[0], BlockFace.SELF) - .register(true, new MultiBlockInteractionHandler() { + new ItemStack[0], BlockFace.SELF); + miner.addItemHandler(new MultiBlockInteractionHandler() { @Override public boolean onInteract(Player p, MultiBlock mb, Block b) { @@ -1031,11 +1031,12 @@ public final class SlimefunItemSetup { else return false; } }); + miner.register(plugin); - new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.ADVANCED_DIGITAL_MINER, "ADVANCED_DIGITAL_MINER", + SlimefunMachine advancedMiner = new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.ADVANCED_DIGITAL_MINER, "ADVANCED_DIGITAL_MINER", new ItemStack[] {SlimefunItems.SOLAR_PANEL, new ItemStack(Material.CHEST), SlimefunItems.SOLAR_PANEL, SlimefunItems.GOLD_24K_BLOCK, new ItemStack(Material.DISPENSER), SlimefunItems.GOLD_24K_BLOCK, SlimefunItems.GOLD_24K_BLOCK, new ItemStack(Material.HOPPER), SlimefunItems.GOLD_24K_BLOCK}, - new ItemStack[0], BlockFace.SELF) - .register(true, new MultiBlockInteractionHandler() { + new ItemStack[0], BlockFace.SELF); + advancedMiner.addItemHandler(new MultiBlockInteractionHandler() { // Determines the drops an Advanced Digital Miner will get private final ItemStack effectivePickaxe = new ItemStack(Material.DIAMOND_PICKAXE); @@ -1106,6 +1107,7 @@ public final class SlimefunItemSetup { else return false; } }); + advancedMiner.register(plugin); new SlimefunItem(Categories.MISC, (SlimefunItemStack) SlimefunItems.GOLD_24K_BLOCK, RecipeType.ENHANCED_CRAFTING_TABLE, new ItemStack[] {SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K}) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java index df8544583..4c7c9facd 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/Category.java @@ -39,19 +39,6 @@ public class Category implements Keyed { protected final List items; protected final int tier; - /** - * Constructs a Category with the given display item. - * The tier is set to a default value of {@code 3}. - * - * @param item - * the display item for this category - * @deprecated Use the alternative with a {@link NamespacedKey} instead - */ - @Deprecated - public Category(ItemStack item) { - this(item, 3); - } - /** * Constructs a new {@link Category} with the given {@link NamespacedKey} as an identifier * and the given {@link ItemStack} as its display item. @@ -66,22 +53,6 @@ public class Category implements Keyed { this(key, item, 3); } - /** - * Constructs a Category with the given display item and the provided tier. - *
- * A lower tier results in this category being displayed first. - * - * @param item - * the display item for this category - * @param tier - * the tier for this category - * @deprecated Use the alternative with a {@link NamespacedKey} instead - */ - @Deprecated - public Category(ItemStack item, int tier) { - this(new NamespacedKey(SlimefunPlugin.instance, "invalid_category"), item, tier); - } - /** * Constructs a new {@link Category} with the given {@link NamespacedKey} as an identifier * and the given {@link ItemStack} as its display item. diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunBackpack.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunBackpack.java deleted file mode 100644 index 628ce8e9e..000000000 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunBackpack.java +++ /dev/null @@ -1,21 +0,0 @@ -package me.mrCookieSlime.Slimefun.Objects.SlimefunItem; - -import org.bukkit.inventory.ItemStack; - -import me.mrCookieSlime.Slimefun.Lists.RecipeType; -import me.mrCookieSlime.Slimefun.Objects.Category; -import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; - -/** - * - * @deprecated Moved to {@code io.github.thebusybiscuit.slimefun4.implementation.items.tools.SlimefunBackpack} - * - */ -@Deprecated -public class SlimefunBackpack extends io.github.thebusybiscuit.slimefun4.implementation.items.tools.SlimefunBackpack { - - public SlimefunBackpack(int size, Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { - super(size, category, item, recipeType, recipe); - } - -} diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java index 389feab4d..8ddb3181c 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/SlimefunItem.java @@ -497,62 +497,6 @@ public class SlimefunItem implements Placeable { } } - /** - * This method is deprecated. - * - * @deprecated Use {@link SlimefunItem#register(SlimefunAddon)} instead. - * @param vanilla - * deprecated. - * @param handlers - * deprecated. - */ - @Deprecated - public void register(boolean vanilla, ItemHandler... handlers) { - addItemHandler(handlers); - register(vanilla); - } - - /** - * This method is deprecated. - * - * @deprecated Use {@link SlimefunItem#register(SlimefunAddon)} instead. - * @param handlers - * deprecated. - */ - @Deprecated - public void register(ItemHandler... handlers) { - addItemHandler(handlers); - register(false); - } - - /** - * This method is deprecated. - * - * @deprecated Use {@link SlimefunItem#register(SlimefunAddon)} instead. - * @param vanilla - * deprecated. - * @param handler - * deprecated. - */ - @Deprecated - public void register(boolean vanilla, SlimefunBlockHandler handler) { - SlimefunPlugin.getRegistry().getBlockHandlers().put(getID(), handler); - register(vanilla); - } - - /** - * This method is deprecated. - * - * @deprecated Use {@link SlimefunItem#register(SlimefunAddon)} instead. - * @param handler - * deprecated. - */ - @Deprecated - public void register(SlimefunBlockHandler handler) { - SlimefunPlugin.getRegistry().getBlockHandlers().put(getID(), handler); - register(false); - } - public static Set getHandlers(Class identifier) { return SlimefunPlugin.getRegistry().getItemHandlers().computeIfAbsent(identifier, c -> new HashSet<>()); } @@ -569,66 +513,11 @@ public class SlimefunItem implements Placeable { */ @Deprecated public void registerChargeableBlock(int capacity) { - registerChargeableBlock(false, capacity); - } - - /** - * @deprecated Please implement the {@link EnergyNetComponent} interface instead. - * @param slimefun - * Whether this is from Slimefun or from an Addon. - * @param capacity - * The capacity of this Block - */ - @Deprecated - public void registerEnergyGenerator(boolean slimefun, int capacity) { - register(slimefun); - SlimefunPlugin.getRegistry().getEnergyCapacities().put(id, capacity); - } - - /** - * @deprecated Please implement the {@link EnergyNetComponent} interface instead. - * @param slimefun - * Whether this is from Slimefun or from an Addon. - * @param capacity - * The capacity of this Block - */ - @Deprecated - public void registerChargeableBlock(boolean slimefun, int capacity) { - register(slimefun); + register(); SlimefunPlugin.getRegistry().getEnergyCapacities().put(id, capacity); EnergyNet.registerComponent(id, EnergyNetComponentType.CONSUMER); } - /** - * @deprecated Please implement the {@link EnergyNetComponent} interface instead. - * @param slimefun - * Whether this is from Slimefun or from an Addon. - * @param capacity - * The capacity of this Block - */ - @Deprecated - public void registerCapacitor(boolean slimefun, int capacity) { - register(slimefun); - SlimefunPlugin.getRegistry().getEnergyCapacities().put(id, capacity); - SlimefunPlugin.getRegistry().getEnergyCapacitors().add(id); - EnergyNet.registerComponent(id, EnergyNetComponentType.CAPACITOR); - } - - /** - * @deprecated Please implement the {@link EnergyNetComponent} interface instead. - * @param slimefun - * Whether this is from Slimefun or from an Addon. - * @param capacity - * The capacity of this Block - * @param handlers - * Your Item Handlers - */ - @Deprecated - public void registerChargeableBlock(boolean vanilla, int capacity, ItemHandler... handlers) { - addItemHandler(handlers); - registerChargeableBlock(vanilla, capacity); - } - public void preRegister() { // Override this method to execute code before the Item has been registered // Useful for calls to addItemHandler(...) diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Setup/SlimefunManager.java b/src/main/java/me/mrCookieSlime/Slimefun/Setup/SlimefunManager.java index 92fd0f28d..5fc6bc097 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Setup/SlimefunManager.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Setup/SlimefunManager.java @@ -72,31 +72,6 @@ public final class SlimefunManager { } } - /** - * - * @deprecated Use the version with {@link SlimefunAddon} instead. - * - */ - @Deprecated - public static void registerArmorSet(ItemStack baseComponent, ItemStack[] items, String idSyntax, boolean slimefun, boolean vanilla) { - String[] components = new String[] { "_HELMET", "_CHESTPLATE", "_LEGGINGS", "_BOOTS" }; - Category cat = Categories.ARMOR; - List recipes = new ArrayList<>(); - recipes.add(new ItemStack[] { baseComponent, baseComponent, baseComponent, baseComponent, null, baseComponent, null, null, null }); - recipes.add(new ItemStack[] { baseComponent, null, baseComponent, baseComponent, baseComponent, baseComponent, baseComponent, baseComponent, baseComponent }); - recipes.add(new ItemStack[] { baseComponent, baseComponent, baseComponent, baseComponent, null, baseComponent, baseComponent, null, baseComponent }); - recipes.add(new ItemStack[] { null, null, null, baseComponent, null, baseComponent, baseComponent, null, baseComponent }); - - for (int i = 0; i < 4; i++) { - if (vanilla) { - new VanillaItem(cat, items[i], idSyntax + components[i], RecipeType.ARMOR_FORGE, recipes.get(i)).register(slimefun); - } - else { - new SlimefunItem(cat, new SlimefunItemStack(idSyntax + components[i], items[i]), RecipeType.ARMOR_FORGE, recipes.get(i)).register(slimefun); - } - } - } - public static boolean isItemSimilar(ItemStack item, ItemStack sfitem, boolean checkLore) { if (item == null) return sfitem == null; if (sfitem == null) return false; diff --git a/src/main/java/me/mrCookieSlime/Slimefun/SlimefunPlugin.java b/src/main/java/me/mrCookieSlime/Slimefun/SlimefunPlugin.java index 961aad4e8..3fb61256a 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/SlimefunPlugin.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/SlimefunPlugin.java @@ -115,6 +115,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { private ProtectionManager protections; private ConfigCache settings; private SlimefunHooks hooks; + private SlimefunCommand command; // Supported Versions of Minecraft, to ensure people dont use it on the wrong version. private final String[] supportedMinecraftVersions = { "v1_14_", "v1_15_" }; @@ -278,7 +279,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { }, 0); // Setting up the command /sf and all subcommands - new SlimefunCommand(this); + command = new SlimefunCommand(this); // Armor Update Task if (config.getBoolean("options.enable-armor-effects")) { @@ -541,6 +542,10 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { return Arrays.stream(instance.getServer().getPluginManager().getPlugins()).filter(plugin -> plugin.getDescription().getDepend().contains(instance.getName()) || plugin.getDescription().getSoftDepend().contains(instance.getName())).collect(Collectors.toSet()); } + public static SlimefunCommand getCommand() { + return instance.command; + } + @Override public JavaPlugin getJavaPlugin() { return this;