From 34d6283317d539b3a6df8c4a84ae1dcd9d8f317c Mon Sep 17 00:00:00 2001 From: flo0s Date: Sun, 28 Apr 2024 20:19:04 +0200 Subject: [PATCH] Add compatibility with PyroFishingPro --- libs/PyroFishingPro-4.9.1.jar | Bin 0 -> 1424 bytes pom.xml | 8 ++++++ .../jobs/actions/PyroFishingProInfo.java | 23 ++++++++++++++++++ .../gamingmesh/jobs/config/ConfigManager.java | 6 ++++- .../gamingmesh/jobs/container/ActionType.java | 1 + .../gamingmesh/jobs/hooks/HookManager.java | 16 ++++++++++++ .../com/gamingmesh/jobs/hooks/JobsHook.java | 3 ++- .../pyroFishingPro/PyroFishingProManager.java | 22 +++++++++++++++++ .../jobs/listeners/JobsPaymentListener.java | 18 +++++++------- src/main/resources/jobs/_EXAMPLE.yml | 6 +++++ src/main/resources/plugin.yml | 2 +- 11 files changed, 93 insertions(+), 12 deletions(-) create mode 100644 libs/PyroFishingPro-4.9.1.jar create mode 100644 src/main/java/com/gamingmesh/jobs/actions/PyroFishingProInfo.java create mode 100644 src/main/java/com/gamingmesh/jobs/hooks/pyroFishingPro/PyroFishingProManager.java diff --git a/libs/PyroFishingPro-4.9.1.jar b/libs/PyroFishingPro-4.9.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..3c7b4518c31c0dcf9dd931b087ee3cac80e0295f GIT binary patch literal 1424 zcmWIWW@Zs#;Nak3Xo#B?!GHuf8CV#6T|*poJ^kGD|D9rBU}gyLX6FE@V1g)K`@#EUWkIkqT<}d^vvW$B&8*2N(IrCItF-xl|zE=s$>mH&}m{-URjjy zmRX$PoLG{a;aZlOSE84klUQ8b8kFrV?I>cqxN?TX)_w7-kGbDgi3*S2e^u-VJ6lsn zSHS+Eyvdwdt1P~qE4*m8@9SP>(U^BuyNY(!E62`l5t#Ae&#c(IxLD0x@6T8Bo>#G| z$roL_Z*AV!u%LI!nVajZ^Um5`-B*;oex}Cdt}R?|o5DnAXx^dN7!+xoJ zk$orgcIr2OKh|g7{8^SIcd}xCsfuPa-(7cQ>gq4ijrU^y#T@u0uGlHqc%;nZL;}y@ z%$_8hW=Ec-7n(gA&)#`F)i!5c#YB654o|7Rvse>gXOM# z2G?WTlJ`%)G5PwwH5O4}Hyd&FOkrSsY&+dL(6{=|v6147*a_O@vum4PXXQES_DVukzim#2*ryG*P(w<9+G$Cl!^i3=i`vyGy(AO)ET>Gr{oa zA7LKn1J812R(^i{zwcss`HUY;EB*IyB*MQz|J);%MB zELk^&d$q1k=?~)&2KnxfJ4M`9n0To!HkHfLTWo&iPM*1;Sk^iz-_sdE7PkXubKIY+ zR5UAV+1$uikvDjxD{ihUSIzmTIdALht%u|qZlwFv_LOXM`2RJ+y5|McS+|AKUpUv4H|n`^-&j;Hs%Q648kBoQF0if4 z1ZLmcETF8z$Rxsmn)zWl8}^%1}p$b@S}DhNO(a53P{xd;;u z0GZ%?jL?8BCnGdGglIs{*9fiHayCLM4 ${basedir}/libs/mypet-3.11-20210318.180552-1.jar + + + me.arsmagica + pyrofishingpro + 4.9.1 + system + ${basedir}/libs/PyroFishingPro-4.9.1.jar + diff --git a/src/main/java/com/gamingmesh/jobs/actions/PyroFishingProInfo.java b/src/main/java/com/gamingmesh/jobs/actions/PyroFishingProInfo.java new file mode 100644 index 00000000..65e4e575 --- /dev/null +++ b/src/main/java/com/gamingmesh/jobs/actions/PyroFishingProInfo.java @@ -0,0 +1,23 @@ +package com.gamingmesh.jobs.actions; + +import com.gamingmesh.jobs.container.ActionType; +import com.gamingmesh.jobs.container.BaseActionInfo; + +public class PyroFishingProInfo extends BaseActionInfo { + private String name; + + public PyroFishingProInfo(String name, ActionType type) { + super(type); + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public String getNameWithSub() { + return name; + } +} \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index 3e67d48b..6b52c895 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -381,6 +381,9 @@ public class ConfigManager { cfg.addComment(pt + ".Fish.legacy_raw_fish", "If you are using below version 1.13"); generate(cfg, pt + ".Fish.legacy_raw_fish"); + cfg.addComment(pt + ".PyroFishingPro", "Catching CUSTOM fish of the PyroFishingPro plugin"); + generate(cfg, pt + ".PyroFishingPro.CustomTier"); + cfg.addComment(pt + ".Repair", "Repairing items"); generate(cfg, pt + ".Repair.wood_sword"); generate(cfg, pt + ".Repair.iron_sword"); @@ -588,6 +591,7 @@ public class ConfigManager { case KILL: case MILK: case MMKILL: + case PYROFISHINGPRO: case BREED: case TAME: case SHEAR: @@ -788,7 +792,7 @@ public class ConfigManager { type = cmiEnchant != null ? cmiEnchant.getKeyName() : myKey; } else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.COLLECT || actionType == ActionType.MMKILL - || actionType == ActionType.BAKE || actionType == ActionType.SMELT) { + || actionType == ActionType.BAKE || actionType == ActionType.SMELT || actionType == ActionType.PYROFISHINGPRO) { type = myKey; } else if (actionType == ActionType.EXPLORE) { type = myKey; diff --git a/src/main/java/com/gamingmesh/jobs/container/ActionType.java b/src/main/java/com/gamingmesh/jobs/container/ActionType.java index a5ccd3ef..453a37a9 100644 --- a/src/main/java/com/gamingmesh/jobs/container/ActionType.java +++ b/src/main/java/com/gamingmesh/jobs/container/ActionType.java @@ -28,6 +28,7 @@ public enum ActionType { KILL(), MMKILL("MMKill"), FISH(), + PYROFISHINGPRO("PyroFishingPro"), CRAFT(), VTRADE("VTrade"), SMELT(), diff --git a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java index 7f5c65c1..6c1ba7a6 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/HookManager.java @@ -1,5 +1,6 @@ package com.gamingmesh.jobs.hooks; +import com.gamingmesh.jobs.hooks.pyroFishingPro.PyroFishingProManager; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; @@ -25,6 +26,7 @@ public class HookManager { private static WorldGuardManager worldGuardManager; private static StackMobHandler stackMobHandler; private static WildStackerHandler wildStackerHandler; + private static PyroFishingProManager pyroFishingProManager; private static final Jobs PLUGIN = JavaPlugin.getPlugin(Jobs.class); @@ -38,6 +40,7 @@ public class HookManager { setMythicManager(); setStackMobHandler(); setWildStackerHandler(); + setPyroFishingProManager(); } public static StackMobHandler getStackMobHandler() { @@ -83,6 +86,13 @@ public class HookManager { return MythicManager; } + public static PyroFishingProManager getPyroFishingProManager() { + if(pyroFishingProManager == null) + pyroFishingProManager = new PyroFishingProManager(); + + return pyroFishingProManager; + } + public static boolean checkMythicMobs() { return Jobs.getGCManager().MythicMobsEnabled && MythicManager != null && MythicManager.check(); } @@ -145,4 +155,10 @@ public class HookManager { wildStackerHandler = new WildStackerHandler(); } } + + private static void setPyroFishingProManager() { + if (JobsHook.PyroFishingPro.isEnabled()) { + pyroFishingProManager = new PyroFishingProManager(); + } + } } diff --git a/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java b/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java index 11640804..17d76a21 100644 --- a/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java +++ b/src/main/java/com/gamingmesh/jobs/hooks/JobsHook.java @@ -10,7 +10,8 @@ public enum JobsHook { WildStacker, WorldGuard, MythicMobs, - mcMMO; + mcMMO, + PyroFishingPro; private Boolean enabled; private Boolean present; diff --git a/src/main/java/com/gamingmesh/jobs/hooks/pyroFishingPro/PyroFishingProManager.java b/src/main/java/com/gamingmesh/jobs/hooks/pyroFishingPro/PyroFishingProManager.java new file mode 100644 index 00000000..63309b8e --- /dev/null +++ b/src/main/java/com/gamingmesh/jobs/hooks/pyroFishingPro/PyroFishingProManager.java @@ -0,0 +1,22 @@ +package com.gamingmesh.jobs.hooks.pyroFishingPro; + +import com.gamingmesh.jobs.Jobs; +import me.arsmagica.API.PyroFishCatchEvent; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; + +public class PyroFishingProManager implements Listener { + public static String lastFish; + private final Jobs jobs; + + public PyroFishingProManager() { + this.jobs = Jobs.getInstance(); + jobs.getServer().getPluginManager().registerEvents(this, jobs); + } + + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + public void onPyroFishCatch(PyroFishCatchEvent event) { + lastFish = event.getTier(); + } +} \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index b71b0f9d..e79923d8 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -26,6 +26,8 @@ import java.util.Map.Entry; import java.util.UUID; import java.util.concurrent.TimeUnit; +import com.gamingmesh.jobs.actions.*; +import com.gamingmesh.jobs.hooks.pyroFishingPro.PyroFishingProManager; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; @@ -92,15 +94,6 @@ import org.bukkit.permissions.PermissionAttachmentInfo; import com.bgsoftware.wildstacker.api.enums.StackSplit; import com.gamingmesh.jobs.ItemBoostManager; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.actions.BlockActionInfo; -import com.gamingmesh.jobs.actions.BlockCollectInfo; -import com.gamingmesh.jobs.actions.CustomKillInfo; -import com.gamingmesh.jobs.actions.EnchantActionInfo; -import com.gamingmesh.jobs.actions.EntityActionInfo; -import com.gamingmesh.jobs.actions.ExploreActionInfo; -import com.gamingmesh.jobs.actions.ItemActionInfo; -import com.gamingmesh.jobs.actions.ItemNameActionInfo; -import com.gamingmesh.jobs.actions.PotionItemActionInfo; import com.gamingmesh.jobs.api.JobsChunkChangeEvent; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.ExploreRespond; @@ -551,6 +544,13 @@ public final class JobsPaymentListener implements Listener { } } + if (JobsHook.PyroFishingPro.isEnabled()) { + if(PyroFishingProManager.lastFish != null) { + Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new PyroFishingProInfo(PyroFishingProManager.lastFish, ActionType.PYROFISHINGPRO)); + } + return; + } + Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new ItemActionInfo(((Item) event.getCaught()).getItemStack(), ActionType.FISH), event.getCaught()); } } diff --git a/src/main/resources/jobs/_EXAMPLE.yml b/src/main/resources/jobs/_EXAMPLE.yml index e7164aed..a9b7f485 100644 --- a/src/main/resources/jobs/_EXAMPLE.yml +++ b/src/main/resources/jobs/_EXAMPLE.yml @@ -440,6 +440,12 @@ exampleJob: legacy_raw_fish: income: 20.0 experience: 25.0 + # Catching CUSTOM fish of the PyroFishingPro plugin + PyroFishingPro: + CustomTier: + income: 1.0 + points: 1.0 + experience: 1.0 # Repairing items Repair: wood_sword: diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 4c90794d..352cccee 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -8,7 +8,7 @@ website: https://www.spigotmc.org/resources/4216/ authors: [Zrips] contributors: [montlikadani] depend: [CMILib] -softdepend: [Vault, Essentials, MythicMobs, WorldGuard, MyPet, PlaceholderAPI, EcoEnchants, WildStacker, StackMob] +softdepend: [Vault, Essentials, MythicMobs, WorldGuard, MyPet, PlaceholderAPI, EcoEnchants, WildStacker, StackMob, PyroFishingPro] commands: jobs: description: Jobs