diff --git a/libs/PyroFishingPro-4.9.1.jar b/libs/PyroFishingPro-4.9.1.jar new file mode 100644 index 00000000..3c7b4518 Binary files /dev/null and b/libs/PyroFishingPro-4.9.1.jar differ diff --git a/pom.xml b/pom.xml index 4e6c24f6..38bd1c21 100644 --- a/pom.xml +++ b/pom.xml @@ -176,6 +176,14 @@ ${basedir}/libs/mypet-3.12.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 d724a2a5..36df65de 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; @@ -24,6 +25,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); @@ -32,11 +34,12 @@ public class HookManager { public static void loadHooks() { pm = PLUGIN.getServer().getPluginManager(); - setMyPetManager(); - setWorldGuard(); - setMythicManager(); - setStackMobHandler(); - setWildStackerHandler(); + setMyPetManager(); + setWorldGuard(); + setMythicManager(); + setStackMobHandler(); + setWildStackerHandler(); + setPyroFishingProManager(); } public static StackMobHandler getStackMobHandler() { @@ -82,6 +85,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(); } @@ -138,4 +148,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 78c085c6..06ab0c62 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