Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
* Updated Addon Upstream
- DynaTech: da1fb30
- FluffyMachines: 612aaa9
- SFCalc: 2e010b3
- SlimefunTranslation: e6da231

* Changes
- Fix bug on categories command on SlimeCustomizer addon
- Fix populateMenu method on SCCommand from SlimeCustomizer addon
- Fixed typo from "reloadPlugin" to "reloadAddon" method in MainCommand
- Integrate new addon naming system on MainCommand
  • Loading branch information
ARVIN3108 committed Apr 15, 2024
1 parent b155309 commit 8b50123
Show file tree
Hide file tree
Showing 10 changed files with 426 additions and 244 deletions.
2 changes: 1 addition & 1 deletion Addons/DynaTech
2 changes: 1 addition & 1 deletion Addons/SFCalc
2 changes: 1 addition & 1 deletion Addons/SlimefunTranslation
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import id.universenetwork.sfa_loader.AddonsLoader;
import id.universenetwork.sfa_loader.libraries.guizhanlib.slimefun.addon.AbstractAddon;
import id.universenetwork.sfa_loader.libraries.guizhanlib.slimefun.addon.AddonConfig;
import id.universenetwork.sfa_loader.objects.Addon;
import id.universenetwork.sfa_loader.objects.SpecialCommandSender;
import id.universenetwork.sfa_loader.template.AddonTemplate;
import id.universenetwork.sfa_loader.utils.LogUtils;
Expand Down Expand Up @@ -56,8 +57,8 @@ public void cmdReloadPlugin(final SpecialCommandSender sender) {

@Command("slimefunaddon-loader|sfa-loader|sfal|sfa reload-config addons [addon]")
@Permission("sfaloader.command.reload.addons")
public void cmdReloadPlugin(final SpecialCommandSender sender,
final @Argument(value = "addon", suggestions = "enabledAddonsList") @Default("all") String addonName) {
public void cmdReloadAddon(final SpecialCommandSender sender,
final @Argument(value = "addon", suggestions = "enabledAddonsList") @Default("all") String addonName) {
final Set<AddonTemplate> loadedAddon = AddonsLoader.getLoadedAddons();
if (addonName.equals("all")) {
LogUtils.info("&eReloading all addons configuration files...");
Expand All @@ -70,32 +71,28 @@ public void cmdReloadPlugin(final SpecialCommandSender sender,
LogUtils.info("&aAll addons configuration files have been reloaded!");
} else if (AddonsLoader.isAddonLoaded(addonName)) {
Set<AddonTemplate> filtered = loadedAddon.stream().filter(addon ->
addon.getClass().getSimpleName().equalsIgnoreCase(addonName))
new Addon(addon.getClass()).getName().equalsIgnoreCase(addonName))
.collect(Collectors.toSet());
for (AddonTemplate addon : filtered) {
final String name = new Addon(addon.getClass()).getName();
final AddonConfig cfg = addon.getConfig();
if (cfg == null) {
TextUtils.send(sender, "%p% &d" + addon.getClass().getSimpleName() +
" &caddon has no configuration file!");
TextUtils.send(sender, "%p% &d" + name + " &caddon has no configuration file!");
return;
}
LogUtils.info("&eReloading the &d" + addon.getClass().getSimpleName() +
" &eaddon configuration file...");
LogUtils.info("&eReloading the &d" + name + " &eaddon configuration file...");
cfg.reload();
if (sender.isPlayer()) TextUtils.send(sender, "%p% &d" + addon.getClass()
.getSimpleName() + " &aaddon configuration file have been reloaded!");
LogUtils.info("&d" + addon.getClass().getSimpleName() +
" &aaddon configuration file have been reloaded!");
if (sender.isPlayer())
TextUtils.send(sender, "%p% &d" + name + " &aaddon configuration file have been reloaded!");
LogUtils.info("&d" + name + " &aaddon configuration file have been reloaded!");
}
} else TextUtils.send(sender, "%p% &cPlease provide a valid addon name!");
}

@Suggestions("enabledAddonsList")
public List<String> enabledAddonsList(CommandContext<SpecialCommandSender> sender, String context) {
final List<String> list = new ArrayList<>();
for (AddonTemplate addon : AddonsLoader.getLoadedAddons())
if (addon.getConfig() != null) list.add(addon.getClass().getSimpleName());
return list;
return AddonsLoader.getLoadedAddons().stream().filter(a -> a.getConfig() != null)
.map(a -> new Addon(a.getClass()).getName()).collect(Collectors.toList());
}

@ExceptionHandler(NoPermissionException.class)
Expand Down
173 changes: 161 additions & 12 deletions patches/DynaTech.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
From cf07e5d13abd582e6ab5fc5db217714684384656 Mon Sep 17 00:00:00 2001
From d28943a2e16a3d3f6c2262598e752ea24a859f5e Mon Sep 17 00:00:00 2001
From: ARVIN3108 <[email protected]>
Date: Mon, 4 Mar 2024 14:13:26 +0700
Date: Mon, 15 Apr 2024 06:55:12 +0700
Subject: [PATCH] DynaTech

---
Expand Down Expand Up @@ -40,6 +40,7 @@ Subject: [PATCH] DynaTech
.../growthchambers/GrowthChamberNether.java | 89 +--
.../GrowthChamberNetherMK2.java | 70 +-
.../growthchambers/GrowthChamberOcean.java | 89 +--
.../growthchambers/GrowthChamberOcean.java~ | 143 ++++
.../growthchambers/GrowthChamberOceanMK2.java | 73 +-
.../electric/machines/MineralizedApiary.java | 147 ++--
.../items/electric/machines/Orechid.java | 71 +-
Expand Down Expand Up @@ -69,12 +70,12 @@ Subject: [PATCH] DynaTech
.../listeners/PicnicBasketListener.java | 80 +-
.../dynatech/setup/DynaTechItemsSetup.java | 743 +++++++++---------
.../addons}/dynatech/tasks/ItemBandTask.java | 134 ++--
.../me/profelements/dynatech/DynaTech.java | 147 ----
.../me/profelements/dynatech/DynaTech.java | 145 ----
.../dynatech/items/misc/WitherGolem.java | 33 -
.../addons-config/DynaTech/config.yml | 1 +
src/main/resources/config.yml | 3 -
src/main/resources/plugin.yml | 24 -
70 files changed, 2610 insertions(+), 3286 deletions(-)
71 files changed, 2753 insertions(+), 3284 deletions(-)
create mode 100644 src/main/java/id/universenetwork/sfa_loader/addons/dynatech/DynaTech.java
rename src/main/java/{me/profelements => id/universenetwork/sfa_loader/addons}/dynatech/DynaTechItems.java (91%)
rename src/main/java/{me/profelements => id/universenetwork/sfa_loader/addons}/dynatech/attributes/LiquidStorage.java (77%)
Expand Down Expand Up @@ -110,6 +111,7 @@ Subject: [PATCH] DynaTech
rename src/main/java/{me/profelements => id/universenetwork/sfa_loader/addons}/dynatech/items/electric/growthchambers/GrowthChamberNether.java (61%)
rename src/main/java/{me/profelements => id/universenetwork/sfa_loader/addons}/dynatech/items/electric/growthchambers/GrowthChamberNetherMK2.java (63%)
rename src/main/java/{me/profelements => id/universenetwork/sfa_loader/addons}/dynatech/items/electric/growthchambers/GrowthChamberOcean.java (80%)
create mode 100644 src/main/java/id/universenetwork/sfa_loader/addons/dynatech/items/electric/growthchambers/GrowthChamberOcean.java~
rename src/main/java/{me/profelements => id/universenetwork/sfa_loader/addons}/dynatech/items/electric/growthchambers/GrowthChamberOceanMK2.java (82%)
rename src/main/java/{me/profelements => id/universenetwork/sfa_loader/addons}/dynatech/items/electric/machines/MineralizedApiary.java (53%)
rename src/main/java/{me/profelements => id/universenetwork/sfa_loader/addons}/dynatech/items/electric/machines/Orechid.java (77%)
Expand Down Expand Up @@ -5359,6 +5361,155 @@ index 83e87a6..4a22bfe 100644
-
-
}
diff --git a/src/main/java/id/universenetwork/sfa_loader/addons/dynatech/items/electric/growthchambers/GrowthChamberOcean.java~ b/src/main/java/id/universenetwork/sfa_loader/addons/dynatech/items/electric/growthchambers/GrowthChamberOcean.java~
new file mode 100644
index 0000000..4a22bfe
--- /dev/null
+++ b/src/main/java/id/universenetwork/sfa_loader/addons/dynatech/items/electric/growthchambers/GrowthChamberOcean.java~
@@ -0,0 +1,143 @@
+package id.universenetwork.sfa_loader.addons.dynatech.items.electric.growthchambers;
+
+import id.universenetwork.sfa_loader.addons.dynatech.items.abstracts.AbstractElectricMachine;
+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.libraries.dough.items.CustomItemStack;
+import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
+import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
+import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GrowthChamberOcean extends AbstractElectricMachine {
+ private static final int[] INPUT_SLOTS = new int[]{19, 20};
+ private static final int[] OUTPUT_SLOTS = new int[]{24, 25};
+
+ private static final int[] INPUT_BORDER_SLOTS = new int[]{9, 10, 11, 12, 18, 21, 27, 28, 29, 30};
+ private static final int[] OUTPUT_BORDER_SLOTS = new int[]{14, 15, 16, 17, 23, 26, 32, 33, 34, 35};
+ private static final int[] BACKGROUND_SLOTS = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 31, 36, 37, 38, 39, 40, 41, 42, 43, 44};
+
+ private static final ItemStack PROGRESS_ITEM = new ItemStack(Material.CONDUIT);
+
+ public GrowthChamberOcean(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ super(itemGroup, item, recipeType, recipe);
+ }
+
+ @Override
+ public void postRegister() {
+ registerDefaultRecipes();
+ }
+
+ protected void registerDefaultRecipes() {
+
+ registerRecipe(9, new ItemStack(Material.LILY_PAD), new ItemStack(Material.LILY_PAD, 3));
+ registerRecipe(9, new ItemStack(Material.SEA_PICKLE), new ItemStack(Material.SEA_PICKLE, 3));
+ registerRecipe(12, new ItemStack(Material.SEAGRASS), new ItemStack(Material.SEAGRASS, 4));
+ registerRecipe(9, new ItemStack(Material.KELP), new ItemStack(Material.KELP, 3));
+ // Coral blocks
+ // Brings dead coral blocks back to life!
+ registerRecipe(9, new ItemStack(Material.DEAD_TUBE_CORAL_BLOCK), new ItemStack(Material.TUBE_CORAL_BLOCK, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_BRAIN_CORAL_BLOCK), new ItemStack(Material.BRAIN_CORAL_BLOCK, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_BUBBLE_CORAL_BLOCK), new ItemStack(Material.BUBBLE_CORAL_BLOCK, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_FIRE_CORAL_BLOCK), new ItemStack(Material.FIRE_CORAL_BLOCK, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_HORN_CORAL_BLOCK), new ItemStack(Material.HORN_CORAL_BLOCK, 1));
+ // Block duplication
+ registerRecipe(12, new ItemStack(Material.TUBE_CORAL_BLOCK), new ItemStack(Material.TUBE_CORAL_BLOCK, 2));
+ registerRecipe(12, new ItemStack(Material.BRAIN_CORAL_BLOCK), new ItemStack(Material.BRAIN_CORAL_BLOCK, 2));
+ registerRecipe(12, new ItemStack(Material.BUBBLE_CORAL_BLOCK), new ItemStack(Material.BUBBLE_CORAL_BLOCK, 2));
+ registerRecipe(12, new ItemStack(Material.FIRE_CORAL_BLOCK), new ItemStack(Material.FIRE_CORAL_BLOCK, 2));
+ registerRecipe(12, new ItemStack(Material.HORN_CORAL_BLOCK), new ItemStack(Material.HORN_CORAL_BLOCK, 2));
+
+ // Coral
+ // Revive for coral
+ registerRecipe(9, new ItemStack(Material.DEAD_TUBE_CORAL), new ItemStack(Material.TUBE_CORAL, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_BRAIN_CORAL), new ItemStack(Material.BRAIN_CORAL, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_BUBBLE_CORAL), new ItemStack(Material.BUBBLE_CORAL, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_FIRE_CORAL), new ItemStack(Material.FIRE_CORAL, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_HORN_CORAL), new ItemStack(Material.HORN_CORAL, 1));
+ // Coral duplication
+ registerRecipe(12, new ItemStack(Material.TUBE_CORAL), new ItemStack(Material.TUBE_CORAL, 2));
+ registerRecipe(12, new ItemStack(Material.BRAIN_CORAL), new ItemStack(Material.BRAIN_CORAL, 2));
+ registerRecipe(12, new ItemStack(Material.BUBBLE_CORAL), new ItemStack(Material.BUBBLE_CORAL, 2));
+ registerRecipe(12, new ItemStack(Material.FIRE_CORAL), new ItemStack(Material.FIRE_CORAL, 2));
+ registerRecipe(12, new ItemStack(Material.HORN_CORAL), new ItemStack(Material.HORN_CORAL, 2));
+
+ // Coral fans
+ // Medical attention for the fans
+ registerRecipe(9, new ItemStack(Material.DEAD_TUBE_CORAL_FAN), new ItemStack(Material.TUBE_CORAL_FAN, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_BRAIN_CORAL_FAN), new ItemStack(Material.BRAIN_CORAL_FAN, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_BUBBLE_CORAL_FAN), new ItemStack(Material.BUBBLE_CORAL_FAN, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_FIRE_CORAL_FAN), new ItemStack(Material.FIRE_CORAL_FAN, 1));
+ registerRecipe(9, new ItemStack(Material.DEAD_HORN_CORAL_FAN), new ItemStack(Material.HORN_CORAL_FAN, 1));
+ // Fan duplication
+ registerRecipe(12, new ItemStack(Material.TUBE_CORAL_FAN), new ItemStack(Material.TUBE_CORAL_FAN, 2));
+ registerRecipe(12, new ItemStack(Material.BRAIN_CORAL_FAN), new ItemStack(Material.BRAIN_CORAL_FAN, 2));
+ registerRecipe(12, new ItemStack(Material.BUBBLE_CORAL_FAN), new ItemStack(Material.BUBBLE_CORAL_FAN, 2));
+ registerRecipe(12, new ItemStack(Material.FIRE_CORAL_FAN), new ItemStack(Material.FIRE_CORAL_FAN, 2));
+ registerRecipe(12, new ItemStack(Material.HORN_CORAL_FAN), new ItemStack(Material.HORN_CORAL_FAN, 2));
+
+ }
+
+
+ @Override
+ public List<ItemStack> getDisplayRecipes() {
+ List<ItemStack> display = new ArrayList<>();
+ for (MachineRecipe recipe : recipes) {
+ display.add(recipe.getInput()[0]);
+ if (recipe.getOutput().length > 1) display.add(recipe.getOutput()[1]);
+ else display.add(recipe.getOutput()[0]);
+ }
+ return display;
+ }
+
+ @Override
+ protected void setupMenu(BlockMenuPreset preset) {
+ for (int slot : BACKGROUND_SLOTS)
+ preset.addItem(slot, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
+
+ for (int slot : INPUT_BORDER_SLOTS)
+ preset.addItem(slot, ChestMenuUtils.getInputSlotTexture(), ChestMenuUtils.getEmptyClickHandler());
+
+ for (int slot : OUTPUT_BORDER_SLOTS)
+ preset.addItem(slot, ChestMenuUtils.getOutputSlotTexture(), ChestMenuUtils.getEmptyClickHandler());
+
+ preset.addItem(getProgressSlot(), new CustomItemStack(Material.BLACK_STAINED_GLASS_PANE, " "), ChestMenuUtils.getEmptyClickHandler());
+
+ for (int slot : getOutputSlots())
+ preset.addMenuClickHandler(slot, new ChestMenu.AdvancedMenuClickHandler() {
+ @Override
+ public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) {
+ return cursor.getType().isAir();
+ }
+
+ @Override
+ public boolean onClick(Player p, int slot, ItemStack item, ClickAction action) {
+ return false;
+ }
+ });
+ }
+
+ @Override
+ protected int[] getInputSlots() {
+ return INPUT_SLOTS;
+ }
+
+ @Override
+ protected int[] getOutputSlots() {
+ return OUTPUT_SLOTS;
+ }
+
+ @Override
+ public ItemStack getProgressBar() {
+ return PROGRESS_ITEM;
+ }
+}
diff --git a/src/main/java/me/profelements/dynatech/items/electric/growthchambers/GrowthChamberOceanMK2.java b/src/main/java/id/universenetwork/sfa_loader/addons/dynatech/items/electric/growthchambers/GrowthChamberOceanMK2.java
similarity index 82%
rename from src/main/java/me/profelements/dynatech/items/electric/growthchambers/GrowthChamberOceanMK2.java
Expand Down Expand Up @@ -9917,10 +10068,10 @@ index db69aee..a420e84 100644
+}
diff --git a/src/main/java/me/profelements/dynatech/DynaTech.java b/src/main/java/me/profelements/dynatech/DynaTech.java
deleted file mode 100644
index 5465a9f..0000000
index 2106eec..0000000
--- a/src/main/java/me/profelements/dynatech/DynaTech.java
+++ /dev/null
@@ -1,147 +0,0 @@
@@ -1,145 +0,0 @@
-package me.profelements.dynatech;
-
-import io.github.bakedlibs.dough.updater.BlobBuildUpdater;
Expand Down Expand Up @@ -9987,25 +10138,23 @@ index 5465a9f..0000000
-
- }
-
-
- try {
- Class.forName("io.github.thebusybiscuit.exoticgarden.items.CustomFood");
- new ExoticGardenIntegrationListener(this);
- } catch (ClassNotFoundException ex) {
- }
-
-
- //Tasks
- // Tasks
- getServer().getScheduler().runTaskTimerAsynchronously(DynaTech.getInstance(), new ItemBandTask(), 0L, 5 * 20L);
- getServer().getScheduler().runTaskTimer(DynaTech.getInstance(), () -> this.tickInterval++, 0, TICK_TIME);
-
- if (getConfig().getBoolean("options.auto-update", true) && getDescription().getVersion().startsWith("DEV - ")) {
- if (getConfig().getBoolean("options.auto-update", true) && getDescription().getVersion().startsWith("Main")) {
- new BlobBuildUpdater(this, getFile(), "DynaTech", "Main").start();
- }
-
- if (!Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_19)) {
- getLogger().warning("DynaTech only support 1.19+, disabling.");
- getServer().getPluginManager().disablePlugin(this);
- getLogger().warning("DynaTech only support 1.19+, disabling.");
- getServer().getPluginManager().disablePlugin(this);
- }
- }
-
Expand Down
Loading

0 comments on commit 8b50123

Please sign in to comment.