1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 05:55:27 +01:00

Merge pull request #1748 from flo0s/PyroFishingPro

Add compatibility with PyroFishingPro
This commit is contained in:
Zrips 2024-05-08 16:11:34 +03:00 committed by GitHub
commit 18caa14582
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 98 additions and 17 deletions

Binary file not shown.

View File

@ -176,6 +176,14 @@
<!-- Temporary solution for replacing repository -->
<systemPath>${basedir}/libs/mypet-3.12.jar</systemPath>
</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>
<repositories>
<repository>

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");
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;

View File

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

View File

@ -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);
@ -37,6 +39,7 @@ public class HookManager {
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();
}
}
}

View File

@ -10,7 +10,8 @@ public enum JobsHook {
WildStacker,
WorldGuard,
MythicMobs,
mcMMO;
mcMMO,
PyroFishingPro;
private Boolean enabled;
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.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());
}
}

View File

@ -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:

View File

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