1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-30 21:07:48 +01:00

Add compatibility with PyroFishingPro

This commit is contained in:
flo0s 2024-04-28 20:19:04 +02:00
parent 0a46298b7d
commit 34d6283317
11 changed files with 93 additions and 12 deletions

Binary file not shown.

View File

@ -226,6 +226,14 @@
<!-- Temporary solution for replacing repository --> <!-- Temporary solution for replacing repository -->
<systemPath>${basedir}/libs/mypet-3.11-20210318.180552-1.jar</systemPath> <systemPath>${basedir}/libs/mypet-3.11-20210318.180552-1.jar</systemPath>
</dependency> </dependency>
<!-- PyroFishingPro -->
<dependency>
<groupId>me.arsmagica</groupId>
<artifactId>pyrofishingpro</artifactId>
<version>4.9.1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/PyroFishingPro-4.9.1.jar</systemPath>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
<!-- MythicMobs --> <!-- MythicMobs -->

View File

@ -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;
}
}

View File

@ -381,6 +381,9 @@ public class ConfigManager {
cfg.addComment(pt + ".Fish.legacy_raw_fish", "If you are using below version 1.13"); cfg.addComment(pt + ".Fish.legacy_raw_fish", "If you are using below version 1.13");
generate(cfg, pt + ".Fish.legacy_raw_fish"); 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"); cfg.addComment(pt + ".Repair", "Repairing items");
generate(cfg, pt + ".Repair.wood_sword"); generate(cfg, pt + ".Repair.wood_sword");
generate(cfg, pt + ".Repair.iron_sword"); generate(cfg, pt + ".Repair.iron_sword");
@ -588,6 +591,7 @@ public class ConfigManager {
case KILL: case KILL:
case MILK: case MILK:
case MMKILL: case MMKILL:
case PYROFISHINGPRO:
case BREED: case BREED:
case TAME: case TAME:
case SHEAR: case SHEAR:
@ -788,7 +792,7 @@ public class ConfigManager {
type = cmiEnchant != null ? cmiEnchant.getKeyName() : myKey; type = cmiEnchant != null ? cmiEnchant.getKeyName() : myKey;
} else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.COLLECT || actionType == ActionType.MMKILL } 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; type = myKey;
} else if (actionType == ActionType.EXPLORE) { } else if (actionType == ActionType.EXPLORE) {
type = myKey; type = myKey;

View File

@ -28,6 +28,7 @@ public enum ActionType {
KILL(), KILL(),
MMKILL("MMKill"), MMKILL("MMKill"),
FISH(), FISH(),
PYROFISHINGPRO("PyroFishingPro"),
CRAFT(), CRAFT(),
VTRADE("VTrade"), VTRADE("VTrade"),
SMELT(), SMELT(),

View File

@ -1,5 +1,6 @@
package com.gamingmesh.jobs.hooks; package com.gamingmesh.jobs.hooks;
import com.gamingmesh.jobs.hooks.pyroFishingPro.PyroFishingProManager;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -25,6 +26,7 @@ public class HookManager {
private static WorldGuardManager worldGuardManager; private static WorldGuardManager worldGuardManager;
private static StackMobHandler stackMobHandler; private static StackMobHandler stackMobHandler;
private static WildStackerHandler wildStackerHandler; private static WildStackerHandler wildStackerHandler;
private static PyroFishingProManager pyroFishingProManager;
private static final Jobs PLUGIN = JavaPlugin.getPlugin(Jobs.class); private static final Jobs PLUGIN = JavaPlugin.getPlugin(Jobs.class);
@ -38,6 +40,7 @@ public class HookManager {
setMythicManager(); setMythicManager();
setStackMobHandler(); setStackMobHandler();
setWildStackerHandler(); setWildStackerHandler();
setPyroFishingProManager();
} }
public static StackMobHandler getStackMobHandler() { public static StackMobHandler getStackMobHandler() {
@ -83,6 +86,13 @@ public class HookManager {
return MythicManager; return MythicManager;
} }
public static PyroFishingProManager getPyroFishingProManager() {
if(pyroFishingProManager == null)
pyroFishingProManager = new PyroFishingProManager();
return pyroFishingProManager;
}
public static boolean checkMythicMobs() { public static boolean checkMythicMobs() {
return Jobs.getGCManager().MythicMobsEnabled && MythicManager != null && MythicManager.check(); return Jobs.getGCManager().MythicMobsEnabled && MythicManager != null && MythicManager.check();
} }
@ -145,4 +155,10 @@ public class HookManager {
wildStackerHandler = new WildStackerHandler(); wildStackerHandler = new WildStackerHandler();
} }
} }
private static void setPyroFishingProManager() {
if (JobsHook.PyroFishingPro.isEnabled()) {
pyroFishingProManager = new PyroFishingProManager();
}
}
} }

View File

@ -10,7 +10,8 @@ public enum JobsHook {
WildStacker, WildStacker,
WorldGuard, WorldGuard,
MythicMobs, MythicMobs,
mcMMO; mcMMO,
PyroFishingPro;
private Boolean enabled; private Boolean enabled;
private Boolean present; private Boolean present;

View File

@ -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();
}
}

View File

@ -26,6 +26,8 @@ import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import com.gamingmesh.jobs.actions.*;
import com.gamingmesh.jobs.hooks.pyroFishingPro.PyroFishingProManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
@ -92,15 +94,6 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
import com.bgsoftware.wildstacker.api.enums.StackSplit; import com.bgsoftware.wildstacker.api.enums.StackSplit;
import com.gamingmesh.jobs.ItemBoostManager; import com.gamingmesh.jobs.ItemBoostManager;
import com.gamingmesh.jobs.Jobs; 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.api.JobsChunkChangeEvent;
import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.ExploreRespond; 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()); Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new ItemActionInfo(((Item) event.getCaught()).getItemStack(), ActionType.FISH), event.getCaught());
} }
} }

View File

@ -440,6 +440,12 @@ exampleJob:
legacy_raw_fish: legacy_raw_fish:
income: 20.0 income: 20.0
experience: 25.0 experience: 25.0
# Catching CUSTOM fish of the PyroFishingPro plugin
PyroFishingPro:
CustomTier:
income: 1.0
points: 1.0
experience: 1.0
# Repairing items # Repairing items
Repair: Repair:
wood_sword: wood_sword:

View File

@ -8,7 +8,7 @@ website: https://www.spigotmc.org/resources/4216/
authors: [Zrips] authors: [Zrips]
contributors: [montlikadani] contributors: [montlikadani]
depend: [CMILib] depend: [CMILib]
softdepend: [Vault, Essentials, MythicMobs, WorldGuard, MyPet, PlaceholderAPI, EcoEnchants, WildStacker, StackMob] softdepend: [Vault, Essentials, MythicMobs, WorldGuard, MyPet, PlaceholderAPI, EcoEnchants, WildStacker, StackMob, PyroFishingPro]
commands: commands:
jobs: jobs:
description: Jobs description: Jobs