mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Reworked the initialization of dependencies
This commit is contained in:
parent
066c0dd2b6
commit
0b43b7e91a
Binary file not shown.
@ -24,18 +24,17 @@ import com.gamingmesh.jobs.CMILib.Reflections;
|
|||||||
import com.gamingmesh.jobs.CMILib.VersionChecker;
|
import com.gamingmesh.jobs.CMILib.VersionChecker;
|
||||||
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
||||||
import com.gamingmesh.jobs.Gui.GuiManager;
|
import com.gamingmesh.jobs.Gui.GuiManager;
|
||||||
import com.gamingmesh.jobs.McMMO.McMMO1_X_listener;
|
|
||||||
import com.gamingmesh.jobs.McMMO.McMMO2_X_listener;
|
|
||||||
import com.gamingmesh.jobs.McMMO.McMMOManager;
|
|
||||||
import com.gamingmesh.jobs.MyPet.MyPetManager;
|
|
||||||
import com.gamingmesh.jobs.MythicMobs.MythicMobInterface;
|
|
||||||
import com.gamingmesh.jobs.MythicMobs.MythicMobs2;
|
|
||||||
import com.gamingmesh.jobs.MythicMobs.MythicMobs4;
|
|
||||||
import com.gamingmesh.jobs.Placeholders.NewPlaceholderAPIHook;
|
import com.gamingmesh.jobs.Placeholders.NewPlaceholderAPIHook;
|
||||||
import com.gamingmesh.jobs.Placeholders.Placeholder;
|
import com.gamingmesh.jobs.Placeholders.Placeholder;
|
||||||
import com.gamingmesh.jobs.Placeholders.PlaceholderAPIHook;
|
import com.gamingmesh.jobs.Placeholders.PlaceholderAPIHook;
|
||||||
|
import com.gamingmesh.jobs.hooks.HookManager;
|
||||||
|
import com.gamingmesh.jobs.hooks.McMMO.McMMOManager;
|
||||||
|
import com.gamingmesh.jobs.hooks.MyPet.MyPetManager;
|
||||||
|
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobInterface;
|
||||||
|
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobs2;
|
||||||
|
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobs4;
|
||||||
|
import com.gamingmesh.jobs.hooks.WorldGuard.WorldGuardManager;
|
||||||
import com.gamingmesh.jobs.Signs.SignUtil;
|
import com.gamingmesh.jobs.Signs.SignUtil;
|
||||||
import com.gamingmesh.jobs.WorldGuard.WorldGuardManager;
|
|
||||||
import com.gamingmesh.jobs.api.JobsExpGainEvent;
|
import com.gamingmesh.jobs.api.JobsExpGainEvent;
|
||||||
import com.gamingmesh.jobs.api.JobsPrePaymentEvent;
|
import com.gamingmesh.jobs.api.JobsPrePaymentEvent;
|
||||||
import com.gamingmesh.jobs.commands.JobsCommands;
|
import com.gamingmesh.jobs.commands.JobsCommands;
|
||||||
@ -63,7 +62,6 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -73,7 +71,9 @@ import java.util.Map.Entry;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class Jobs extends JavaPlugin {
|
public class Jobs extends JavaPlugin {
|
||||||
|
|
||||||
private static String version = "";
|
private static String version = "";
|
||||||
|
|
||||||
private static PlayerManager pManager = null;
|
private static PlayerManager pManager = null;
|
||||||
private static JobsCommands cManager = null;
|
private static JobsCommands cManager = null;
|
||||||
private static Language lManager = null;
|
private static Language lManager = null;
|
||||||
@ -91,14 +91,17 @@ public class Jobs extends JavaPlugin {
|
|||||||
private static ShopManager shopManager = null;
|
private static ShopManager shopManager = null;
|
||||||
private static Loging loging = null;
|
private static Loging loging = null;
|
||||||
private static BlockProtectionManager BpManager = null;
|
private static BlockProtectionManager BpManager = null;
|
||||||
|
|
||||||
private static JobsManager DBManager = null;
|
private static JobsManager DBManager = null;
|
||||||
|
|
||||||
private static PistonProtectionListener PistonProtectionListener = null;
|
private static PistonProtectionListener PistonProtectionListener = null;
|
||||||
private static McMMOManager McMMOManager = null;
|
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
private static McMMOManager McMMOManager = null;
|
||||||
|
@Deprecated
|
||||||
private static MythicMobInterface MythicManager = null;
|
private static MythicMobInterface MythicManager = null;
|
||||||
|
@Deprecated
|
||||||
private static MyPetManager myPetManager = null;
|
private static MyPetManager myPetManager = null;
|
||||||
|
@Deprecated
|
||||||
private static WorldGuardManager worldGuardManager = null;
|
private static WorldGuardManager worldGuardManager = null;
|
||||||
|
|
||||||
private static ConfigManager configManager = null;
|
private static ConfigManager configManager = null;
|
||||||
@ -136,17 +139,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
private static PointsData pointsDatabase = null;
|
private static PointsData pointsDatabase = null;
|
||||||
|
|
||||||
private void setMcMMOlistener() {
|
@Deprecated
|
||||||
try {
|
|
||||||
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
|
|
||||||
getServer().getPluginManager().registerEvents(new McMMO2_X_listener(this), this);
|
|
||||||
consoleMsg("&e[Jobs] Registered McMMO 2.x listener");
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
getServer().getPluginManager().registerEvents(new McMMO1_X_listener(this), this);
|
|
||||||
consoleMsg("&e[Jobs] Registered McMMO 1.x listener");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static McMMOManager getMcMMOManager() {
|
public static McMMOManager getMcMMOManager() {
|
||||||
if (McMMOManager == null)
|
if (McMMOManager == null)
|
||||||
McMMOManager = new McMMOManager();
|
McMMOManager = new McMMOManager();
|
||||||
@ -161,10 +154,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
return PistonProtectionListener;
|
return PistonProtectionListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMyPetManager() {
|
@Deprecated
|
||||||
myPetManager = new MyPetManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MyPetManager getMyPetManager() {
|
public static MyPetManager getMyPetManager() {
|
||||||
if (myPetManager == null && getInstance().getServer().getPluginManager().getPlugin("MyPet") != null) {
|
if (myPetManager == null && getInstance().getServer().getPluginManager().getPlugin("MyPet") != null) {
|
||||||
myPetManager = new MyPetManager();
|
myPetManager = new MyPetManager();
|
||||||
@ -206,10 +196,12 @@ public class Jobs extends JavaPlugin {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static WorldGuardManager getWorldGuardManager() {
|
public static WorldGuardManager getWorldGuardManager() {
|
||||||
return worldGuardManager;
|
return worldGuardManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void setMythicManager() {
|
public void setMythicManager() {
|
||||||
try {
|
try {
|
||||||
Class.forName("net.elseland.xikage.MythicMobs.API.MythicMobsAPI");
|
Class.forName("net.elseland.xikage.MythicMobs.API.MythicMobsAPI");
|
||||||
@ -225,16 +217,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
consoleMsg("&e[Jobs] MythicMobs detected.");
|
consoleMsg("&e[Jobs] MythicMobs detected.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setWorldGuard() {
|
@Deprecated
|
||||||
Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
|
|
||||||
if (plugin != null) {
|
|
||||||
worldGuardManager = new WorldGuardManager();
|
|
||||||
consoleMsg("&e[Jobs] WorldGuard detected.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MythicMobInterface getMythicManager() {
|
public static MythicMobInterface getMythicManager() {
|
||||||
return MythicManager;
|
return MythicManager;
|
||||||
}
|
}
|
||||||
@ -626,13 +609,8 @@ public class Jobs extends JavaPlugin {
|
|||||||
if (GconfigManager.useBlockProtection)
|
if (GconfigManager.useBlockProtection)
|
||||||
pm.registerEvents(PistonProtectionListener, instance);
|
pm.registerEvents(PistonProtectionListener, instance);
|
||||||
|
|
||||||
if (getMcMMOManager().CheckmcMMO()) {
|
if (HookManager.getMcMMOManager().CheckmcMMO()) {
|
||||||
try {
|
HookManager.setMcMMOlistener();
|
||||||
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
|
|
||||||
pm.registerEvents(new McMMO2_X_listener(instance), instance);
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
pm.registerEvents(new McMMO1_X_listener(instance), instance);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -888,17 +866,7 @@ public class Jobs extends JavaPlugin {
|
|||||||
getServer().getPluginManager().registerEvents(new JobsPayment14Listener(), this);
|
getServer().getPluginManager().registerEvents(new JobsPayment14Listener(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getMcMMOManager().CheckmcMMO())
|
HookManager.loadHooks();
|
||||||
setMcMMOlistener();
|
|
||||||
|
|
||||||
if (getServer().getPluginManager().isPluginEnabled("MyPet")) {
|
|
||||||
setMyPetManager();
|
|
||||||
}
|
|
||||||
setWorldGuard();
|
|
||||||
|
|
||||||
setMythicManager();
|
|
||||||
if (GconfigManager.MythicMobsEnabled && MythicManager != null && MythicManager.Check())
|
|
||||||
MythicManager.registerListener();
|
|
||||||
|
|
||||||
setPistonProtectionListener();
|
setPistonProtectionListener();
|
||||||
if (GconfigManager.useBlockProtection) {
|
if (GconfigManager.useBlockProtection) {
|
||||||
|
@ -1 +0,0 @@
|
|||||||
/MyPetManager.class
|
|
@ -1,6 +0,0 @@
|
|||||||
/MythicMobs2Listener.class
|
|
||||||
/MythicMobsManager.class
|
|
||||||
/MythicMobInterface.class
|
|
||||||
/MythicMobs2.class
|
|
||||||
/MythicMobs4.class
|
|
||||||
/MythicMobs4Listener.class
|
|
@ -65,6 +65,7 @@ import com.gamingmesh.jobs.dao.JobsDAO;
|
|||||||
import com.gamingmesh.jobs.dao.JobsDAOData;
|
import com.gamingmesh.jobs.dao.JobsDAOData;
|
||||||
import com.gamingmesh.jobs.economy.PaymentData;
|
import com.gamingmesh.jobs.economy.PaymentData;
|
||||||
import com.gamingmesh.jobs.economy.PointsData;
|
import com.gamingmesh.jobs.economy.PointsData;
|
||||||
|
import com.gamingmesh.jobs.hooks.HookManager;
|
||||||
import com.gamingmesh.jobs.stuff.PerformCommands;
|
import com.gamingmesh.jobs.stuff.PerformCommands;
|
||||||
import com.gamingmesh.jobs.stuff.Util;
|
import com.gamingmesh.jobs.stuff.Util;
|
||||||
|
|
||||||
@ -985,8 +986,8 @@ public class PlayerManager {
|
|||||||
if (player == null || prog == null)
|
if (player == null || prog == null)
|
||||||
return boost;
|
return boost;
|
||||||
|
|
||||||
if (Jobs.getMcMMOManager().mcMMOPresent || Jobs.getMcMMOManager().mcMMOOverHaul)
|
if (HookManager.getMcMMOManager().mcMMOPresent || HookManager.getMcMMOManager().mcMMOOverHaul)
|
||||||
boost.add(BoostOf.McMMO, new BoostMultiplier().add(Jobs.getMcMMOManager().getMultiplier(player.getPlayer())));
|
boost.add(BoostOf.McMMO, new BoostMultiplier().add(HookManager.getMcMMOManager().getMultiplier(player.getPlayer())));
|
||||||
|
|
||||||
if (ent != null && (ent instanceof Tameable)) {
|
if (ent != null && (ent instanceof Tameable)) {
|
||||||
Tameable t = (Tameable) ent;
|
Tameable t = (Tameable) ent;
|
||||||
@ -997,7 +998,7 @@ public class PlayerManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ent != null && Jobs.getMyPetManager() != null && Jobs.getMyPetManager().isMyPet(ent)) {
|
if (ent != null && HookManager.getMyPetManager() != null && HookManager.getMyPetManager().isMyPet(ent)) {
|
||||||
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay");
|
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay");
|
||||||
if (amount != null)
|
if (amount != null)
|
||||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(amount));
|
boost.add(BoostOf.PetPay, new BoostMultiplier().add(amount));
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
/MythicMobs2Listener.class
|
|
||||||
/MythicMobsManager.class
|
|
||||||
/MythicMobInterface.class
|
|
||||||
/MythicMobs2.class
|
|
||||||
/MythicMobs4.class
|
|
||||||
/MythicMobs4Listener.class
|
|
@ -14,6 +14,7 @@ import com.gamingmesh.jobs.commands.JobCommand;
|
|||||||
import com.gamingmesh.jobs.config.RestrictedAreaManager;
|
import com.gamingmesh.jobs.config.RestrictedAreaManager;
|
||||||
import com.gamingmesh.jobs.container.CuboidArea;
|
import com.gamingmesh.jobs.container.CuboidArea;
|
||||||
import com.gamingmesh.jobs.container.RestrictedArea;
|
import com.gamingmesh.jobs.container.RestrictedArea;
|
||||||
|
import com.gamingmesh.jobs.hooks.HookManager;
|
||||||
|
|
||||||
public class area implements Cmd {
|
public class area implements Cmd {
|
||||||
|
|
||||||
@ -58,8 +59,8 @@ public class area implements Cmd {
|
|||||||
"%tool%", CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getName()));
|
"%tool%", CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getName()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (wg && Jobs.getWorldGuardManager() != null) {
|
if (wg && HookManager.getWorldGuardManager() != null) {
|
||||||
name = Jobs.getWorldGuardManager().getNameByName(name);
|
name = HookManager.getWorldGuardManager().getNameByName(name);
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.wgDontExist"));
|
sender.sendMessage(Jobs.getLanguage().getMessage("command.area.output.wgDontExist"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -11,6 +11,7 @@ import com.gamingmesh.jobs.container.Boost;
|
|||||||
import com.gamingmesh.jobs.container.CurrencyType;
|
import com.gamingmesh.jobs.container.CurrencyType;
|
||||||
import com.gamingmesh.jobs.container.Job;
|
import com.gamingmesh.jobs.container.Job;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
import com.gamingmesh.jobs.hooks.HookManager;
|
||||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||||
|
|
||||||
public class bonus implements Cmd {
|
public class bonus implements Cmd {
|
||||||
@ -53,7 +54,8 @@ public class bonus implements Cmd {
|
|||||||
printBoost(sender, boost, BoostOf.NearSpawner);
|
printBoost(sender, boost, BoostOf.NearSpawner);
|
||||||
printBoost(sender, boost, BoostOf.PetPay);
|
printBoost(sender, boost, BoostOf.PetPay);
|
||||||
|
|
||||||
if (Jobs.getMcMMOManager().mcMMOPresent || Jobs.getMcMMOManager().mcMMOOverHaul && boost.get(BoostOf.McMMO, CurrencyType.EXP) != 0D)
|
if (HookManager.getMcMMOManager().mcMMOPresent ||
|
||||||
|
HookManager.getMcMMOManager().mcMMOOverHaul && boost.get(BoostOf.McMMO, CurrencyType.EXP) != 0D)
|
||||||
printBoost(sender, boost, BoostOf.McMMO);
|
printBoost(sender, boost, BoostOf.McMMO);
|
||||||
|
|
||||||
player.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
player.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||||
|
@ -18,6 +18,7 @@ import com.gamingmesh.jobs.CMILib.ConfigReader;
|
|||||||
import com.gamingmesh.jobs.container.ActionType;
|
import com.gamingmesh.jobs.container.ActionType;
|
||||||
import com.gamingmesh.jobs.container.JobInfo;
|
import com.gamingmesh.jobs.container.JobInfo;
|
||||||
import com.gamingmesh.jobs.container.NameList;
|
import com.gamingmesh.jobs.container.NameList;
|
||||||
|
import com.gamingmesh.jobs.hooks.HookManager;
|
||||||
import com.gamingmesh.jobs.stuff.Util;
|
import com.gamingmesh.jobs.stuff.Util;
|
||||||
|
|
||||||
public class NameTranslatorManager {
|
public class NameTranslatorManager {
|
||||||
@ -101,9 +102,7 @@ public class NameTranslatorManager {
|
|||||||
NameList got = ListOfMMEntities.get(materialName.toLowerCase());
|
NameList got = ListOfMMEntities.get(materialName.toLowerCase());
|
||||||
if (got != null && got.getName() != null)
|
if (got != null && got.getName() != null)
|
||||||
return got.getName();
|
return got.getName();
|
||||||
if (Jobs.getMythicManager() == null)
|
return HookManager.getMythicManager() == null ? materialName : HookManager.getMythicManager().getDisplayName(materialName);
|
||||||
return materialName;
|
|
||||||
return Jobs.getMythicManager().getDisplayName(materialName);
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import org.bukkit.entity.Player;
|
|||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.container.CuboidArea;
|
import com.gamingmesh.jobs.container.CuboidArea;
|
||||||
import com.gamingmesh.jobs.container.RestrictedArea;
|
import com.gamingmesh.jobs.container.RestrictedArea;
|
||||||
|
import com.gamingmesh.jobs.hooks.HookManager;
|
||||||
|
|
||||||
public class RestrictedAreaManager {
|
public class RestrictedAreaManager {
|
||||||
|
|
||||||
@ -110,7 +111,8 @@ public class RestrictedAreaManager {
|
|||||||
for (RestrictedArea area : getRestrictedAreasByLoc(player.getLocation())) {
|
for (RestrictedArea area : getRestrictedAreasByLoc(player.getLocation())) {
|
||||||
if (area.inRestrictedArea(player.getLocation()))
|
if (area.inRestrictedArea(player.getLocation()))
|
||||||
return area.getMultiplier();
|
return area.getMultiplier();
|
||||||
if (area.getWgName() != null && Jobs.getWorldGuardManager() != null && Jobs.getWorldGuardManager().inArea(player.getLocation(), area.getWgName()))
|
if (area.getWgName() != null && HookManager.getWorldGuardManager() != null
|
||||||
|
&& HookManager.getWorldGuardManager().inArea(player.getLocation(), area.getWgName()))
|
||||||
return area.getMultiplier();
|
return area.getMultiplier();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -124,8 +126,8 @@ public class RestrictedAreaManager {
|
|||||||
areas.add(area.getValue());
|
areas.add(area.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Jobs.getWorldGuardManager() != null)
|
if (HookManager.getWorldGuardManager() != null)
|
||||||
areas.addAll(Jobs.getWorldGuardManager().getArea(loc));
|
areas.addAll(HookManager.getWorldGuardManager().getArea(loc));
|
||||||
|
|
||||||
return areas;
|
return areas;
|
||||||
}
|
}
|
||||||
|
113
src/main/java/com/gamingmesh/jobs/hooks/HookManager.java
Normal file
113
src/main/java/com/gamingmesh/jobs/hooks/HookManager.java
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
package com.gamingmesh.jobs.hooks;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
import com.gamingmesh.jobs.hooks.McMMO.McMMO1_X_listener;
|
||||||
|
import com.gamingmesh.jobs.hooks.McMMO.McMMO2_X_listener;
|
||||||
|
import com.gamingmesh.jobs.hooks.McMMO.McMMOManager;
|
||||||
|
import com.gamingmesh.jobs.hooks.MyPet.MyPetManager;
|
||||||
|
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobInterface;
|
||||||
|
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobs2;
|
||||||
|
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobs4;
|
||||||
|
import com.gamingmesh.jobs.hooks.WorldGuard.WorldGuardManager;
|
||||||
|
|
||||||
|
public class HookManager {
|
||||||
|
|
||||||
|
private static McMMOManager McMMOManager = null;
|
||||||
|
private static MythicMobInterface MythicManager = null;
|
||||||
|
private static MyPetManager myPetManager = null;
|
||||||
|
private static WorldGuardManager worldGuardManager = null;
|
||||||
|
|
||||||
|
private static PluginManager pm = null;
|
||||||
|
|
||||||
|
public static void loadHooks() {
|
||||||
|
pm = Jobs.getInstance().getServer().getPluginManager();
|
||||||
|
|
||||||
|
if (getMcMMOManager().CheckmcMMO())
|
||||||
|
setMcMMOlistener();
|
||||||
|
|
||||||
|
setMyPetManager();
|
||||||
|
setWorldGuard();
|
||||||
|
setMythicManager();
|
||||||
|
|
||||||
|
if (Jobs.getGCManager().MythicMobsEnabled && MythicManager != null && MythicManager.Check())
|
||||||
|
MythicManager.registerListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MyPetManager getMyPetManager() {
|
||||||
|
if (myPetManager == null) {
|
||||||
|
setMyPetManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
return myPetManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WorldGuardManager getWorldGuardManager() {
|
||||||
|
if (worldGuardManager == null) {
|
||||||
|
worldGuardManager = new WorldGuardManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
return worldGuardManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static McMMOManager getMcMMOManager() {
|
||||||
|
if (McMMOManager == null)
|
||||||
|
McMMOManager = new McMMOManager();
|
||||||
|
|
||||||
|
return McMMOManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MythicMobInterface getMythicManager() {
|
||||||
|
return MythicManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean setWorldGuard() {
|
||||||
|
if (pm.getPlugin("WorldGuard") != null && pm.isPluginEnabled("WorldGuard")) {
|
||||||
|
worldGuardManager = new WorldGuardManager();
|
||||||
|
Jobs.consoleMsg("&e[Jobs] WorldGuard detected.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setMythicManager() {
|
||||||
|
try {
|
||||||
|
Class.forName("net.elseland.xikage.MythicMobs.API.MythicMobsAPI");
|
||||||
|
MythicManager = new MythicMobs2(Jobs.getInstance());
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
try {
|
||||||
|
Class.forName("io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper");
|
||||||
|
MythicManager = new MythicMobs4(Jobs.getInstance());
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MythicManager == null) {
|
||||||
|
Jobs.consoleMsg("&cYour MythicMobs version is not supported by Jobs! Supported versions: 2.4.5+, 4.6.5");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Jobs.consoleMsg("&e[Jobs] MythicMobs detected.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMcMMOlistener() {
|
||||||
|
Jobs ins = Jobs.getInstance();
|
||||||
|
try {
|
||||||
|
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
|
||||||
|
pm.registerEvents(new McMMO2_X_listener(ins), ins);
|
||||||
|
Jobs.consoleMsg("&e[Jobs] Registered McMMO 2.x listener");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
pm.registerEvents(new McMMO1_X_listener(ins), ins);
|
||||||
|
Jobs.consoleMsg("&e[Jobs] Registered McMMO 1.x listener");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setMyPetManager() {
|
||||||
|
if (pm.getPlugin("MyPet") != null && pm.isPluginEnabled("MyPet")) {
|
||||||
|
myPetManager = new MyPetManager();
|
||||||
|
Jobs.consoleMsg("&e[Jobs] MyPet detected.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package com.gamingmesh.jobs.McMMO;
|
package com.gamingmesh.jobs.hooks.McMMO;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -14,6 +13,7 @@ import com.gamingmesh.jobs.Jobs;
|
|||||||
import com.gamingmesh.jobs.actions.ItemActionInfo;
|
import com.gamingmesh.jobs.actions.ItemActionInfo;
|
||||||
import com.gamingmesh.jobs.container.ActionType;
|
import com.gamingmesh.jobs.container.ActionType;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
import com.gamingmesh.jobs.hooks.HookManager;
|
||||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent;
|
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent;
|
||||||
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
|
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
|
||||||
@ -28,17 +28,16 @@ public class McMMO1_X_listener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void OnItemrepair(McMMOPlayerRepairCheckEvent event) {
|
public void OnItemrepair(McMMOPlayerRepairCheckEvent event) {
|
||||||
//disabling plugin in world
|
|
||||||
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
|
||||||
return;
|
|
||||||
// make sure plugin is enabled
|
// make sure plugin is enabled
|
||||||
if (!plugin.isEnabled())
|
if (!plugin.isEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
//disabling plugin in world
|
||||||
|
if (player == null || !Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
||||||
|
return;
|
||||||
|
|
||||||
ItemStack resultStack = event.getRepairedObject();
|
ItemStack resultStack = event.getRepairedObject();
|
||||||
|
|
||||||
if (resultStack == null)
|
if (resultStack == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -58,10 +57,10 @@ public class McMMO1_X_listener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void OnAbilityOn(McMMOPlayerAbilityActivateEvent event) {
|
public void OnAbilityOn(McMMOPlayerAbilityActivateEvent event) {
|
||||||
HashMap<String, Long> InfoMap = Jobs.getMcMMOManager().getMap().get(event.getPlayer().getUniqueId());
|
HashMap<String, Long> InfoMap = HookManager.getMcMMOManager().getMap().get(event.getPlayer().getUniqueId());
|
||||||
if (InfoMap == null) {
|
if (InfoMap == null) {
|
||||||
InfoMap = new HashMap<>();
|
InfoMap = new HashMap<>();
|
||||||
Jobs.getMcMMOManager().getMap().put(event.getPlayer().getUniqueId(), InfoMap);
|
HookManager.getMcMMOManager().getMap().put(event.getPlayer().getUniqueId(), InfoMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -69,7 +68,7 @@ public class McMMO1_X_listener implements Listener {
|
|||||||
// Lets use fixed timer as this tend to return 0
|
// Lets use fixed timer as this tend to return 0
|
||||||
// int maxLenght = (int) ab.getClass().getMethod("getMaxLength").invoke(ab);
|
// int maxLenght = (int) ab.getClass().getMethod("getMaxLength").invoke(ab);
|
||||||
InfoMap.put(String.valueOf(ab), System.currentTimeMillis() + (30 * 1000));
|
InfoMap.put(String.valueOf(ab), System.currentTimeMillis() + (30 * 1000));
|
||||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,14 +76,14 @@ public class McMMO1_X_listener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void OnAbilityOff(McMMOPlayerAbilityDeactivateEvent event) {
|
public void OnAbilityOff(McMMOPlayerAbilityDeactivateEvent event) {
|
||||||
HashMap<String, Long> InfoMap = Jobs.getMcMMOManager().getMap().get(event.getPlayer().getUniqueId());
|
HashMap<String, Long> InfoMap = HookManager.getMcMMOManager().getMap().get(event.getPlayer().getUniqueId());
|
||||||
if (InfoMap != null) {
|
if (InfoMap != null) {
|
||||||
try {
|
try {
|
||||||
Object ab = event.getClass().getMethod("getAbility").invoke(event);
|
Object ab = event.getClass().getMethod("getAbility").invoke(event);
|
||||||
InfoMap.remove(String.valueOf(ab));
|
InfoMap.remove(String.valueOf(ab));
|
||||||
if (InfoMap.isEmpty())
|
if (InfoMap.isEmpty())
|
||||||
Jobs.getMcMMOManager().getMap().remove(event.getPlayer().getUniqueId());
|
HookManager.getMcMMOManager().getMap().remove(event.getPlayer().getUniqueId());
|
||||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.gamingmesh.jobs.McMMO;
|
package com.gamingmesh.jobs.hooks.McMMO;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@ -13,6 +13,7 @@ import com.gamingmesh.jobs.Jobs;
|
|||||||
import com.gamingmesh.jobs.actions.ItemActionInfo;
|
import com.gamingmesh.jobs.actions.ItemActionInfo;
|
||||||
import com.gamingmesh.jobs.container.ActionType;
|
import com.gamingmesh.jobs.container.ActionType;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
import com.gamingmesh.jobs.hooks.HookManager;
|
||||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent;
|
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent;
|
||||||
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
|
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
|
||||||
@ -27,17 +28,16 @@ public class McMMO2_X_listener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void OnItemrepair(McMMOPlayerRepairCheckEvent event) {
|
public void OnItemrepair(McMMOPlayerRepairCheckEvent event) {
|
||||||
//disabling plugin in world
|
|
||||||
if (event.getPlayer() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
|
||||||
return;
|
|
||||||
// make sure plugin is enabled
|
// make sure plugin is enabled
|
||||||
if (!plugin.isEnabled())
|
if (!plugin.isEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
// disabling plugin in world
|
||||||
|
if (player == null || !Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
||||||
|
return;
|
||||||
|
|
||||||
ItemStack resultStack = event.getRepairedObject();
|
ItemStack resultStack = event.getRepairedObject();
|
||||||
|
|
||||||
if (resultStack == null)
|
if (resultStack == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -57,22 +57,22 @@ public class McMMO2_X_listener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void OnAbilityOn(McMMOPlayerAbilityActivateEvent event) {
|
public void OnAbilityOn(McMMOPlayerAbilityActivateEvent event) {
|
||||||
HashMap<String, Long> InfoMap = Jobs.getMcMMOManager().getMap().get(event.getPlayer().getUniqueId());
|
HashMap<String, Long> InfoMap = HookManager.getMcMMOManager().getMap().get(event.getPlayer().getUniqueId());
|
||||||
if (InfoMap == null) {
|
if (InfoMap == null) {
|
||||||
InfoMap = new HashMap<>();
|
InfoMap = new HashMap<>();
|
||||||
Jobs.getMcMMOManager().getMap().put(event.getPlayer().getUniqueId(), InfoMap);
|
HookManager.getMcMMOManager().getMap().put(event.getPlayer().getUniqueId(), InfoMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoMap.put(event.getAbility().toString(), System.currentTimeMillis() + (30 * 1000));
|
InfoMap.put(event.getAbility().toString(), System.currentTimeMillis() + (30 * 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void OnAbilityOff(McMMOPlayerAbilityDeactivateEvent event) {
|
public void OnAbilityOff(McMMOPlayerAbilityDeactivateEvent event) {
|
||||||
HashMap<String, Long> InfoMap = Jobs.getMcMMOManager().getMap().get(event.getPlayer().getUniqueId());
|
HashMap<String, Long> InfoMap = HookManager.getMcMMOManager().getMap().get(event.getPlayer().getUniqueId());
|
||||||
if (InfoMap != null) {
|
if (InfoMap != null) {
|
||||||
InfoMap.remove(event.getAbility().toString());
|
InfoMap.remove(event.getAbility().toString());
|
||||||
if (InfoMap.isEmpty())
|
if (InfoMap.isEmpty())
|
||||||
Jobs.getMcMMOManager().getMap().remove(event.getPlayer().getUniqueId());
|
HookManager.getMcMMOManager().getMap().remove(event.getPlayer().getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.gamingmesh.jobs.McMMO;
|
package com.gamingmesh.jobs.hooks.McMMO;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -17,6 +17,14 @@ public class McMMOManager {
|
|||||||
|
|
||||||
private HashMap<UUID, HashMap<String, Long>> map = new HashMap<>();
|
private HashMap<UUID, HashMap<String, Long>> map = new HashMap<>();
|
||||||
|
|
||||||
|
public HashMap<UUID, HashMap<String, Long>> getMap() {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMap(HashMap<UUID, HashMap<String, Long>> map) {
|
||||||
|
this.map = map;
|
||||||
|
}
|
||||||
|
|
||||||
public double getMultiplier(Player player) {
|
public double getMultiplier(Player player) {
|
||||||
if (player == null)
|
if (player == null)
|
||||||
return 0D;
|
return 0D;
|
||||||
@ -24,6 +32,7 @@ public class McMMOManager {
|
|||||||
HashMap<String, Long> InfoMap = map.get(player.getUniqueId());
|
HashMap<String, Long> InfoMap = map.get(player.getUniqueId());
|
||||||
if (InfoMap == null)
|
if (InfoMap == null)
|
||||||
return 0D;
|
return 0D;
|
||||||
|
|
||||||
if (mcMMOOverHaul) {
|
if (mcMMOOverHaul) {
|
||||||
Long t = InfoMap.get(SuperAbilityType.TREE_FELLER.toString());
|
Long t = InfoMap.get(SuperAbilityType.TREE_FELLER.toString());
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
@ -81,6 +90,7 @@ public class McMMOManager {
|
|||||||
// Disabling skill API check;
|
// Disabling skill API check;
|
||||||
mcMMOOverHaul = false;
|
mcMMOOverHaul = false;
|
||||||
Jobs.consoleMsg("&e[Jobs] &6mcMMO was found - &cBut your McMMO version is outdated, please update for full support.");
|
Jobs.consoleMsg("&e[Jobs] &6mcMMO was found - &cBut your McMMO version is outdated, please update for full support.");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Class.forName("com.gmail.nossr50.api.AbilityAPI");
|
Class.forName("com.gmail.nossr50.api.AbilityAPI");
|
||||||
mcMMOPresent = true;
|
mcMMOPresent = true;
|
||||||
@ -91,6 +101,7 @@ public class McMMOManager {
|
|||||||
// Still enabling event listener for repair
|
// Still enabling event listener for repair
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Still enabling event listener for repair
|
// Still enabling event listener for repair
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -98,14 +109,7 @@ public class McMMOManager {
|
|||||||
Jobs.consoleMsg("&e[Jobs] &6mcMMO" + McMMO.getDescription().getVersion() + " was found - Enabling capabilities.");
|
Jobs.consoleMsg("&e[Jobs] &6mcMMO" + McMMO.getDescription().getVersion() + " was found - Enabling capabilities.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<UUID, HashMap<String, Long>> getMap() {
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMap(HashMap<UUID, HashMap<String, Long>> map) {
|
|
||||||
this.map = map;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,12 +1,7 @@
|
|||||||
package com.gamingmesh.jobs.MyPet;
|
package com.gamingmesh.jobs.hooks.MyPet;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
|
||||||
|
|
||||||
import de.Keyle.MyPet.MyPetApi;
|
import de.Keyle.MyPet.MyPetApi;
|
||||||
import de.Keyle.MyPet.api.entity.MyPet;
|
import de.Keyle.MyPet.api.entity.MyPet;
|
||||||
import de.Keyle.MyPet.api.entity.MyPetBukkitEntity;
|
import de.Keyle.MyPet.api.entity.MyPetBukkitEntity;
|
||||||
@ -19,7 +14,9 @@ public class MyPetManager {
|
|||||||
private boolean enabled = false;
|
private boolean enabled = false;
|
||||||
|
|
||||||
public MyPetManager() {
|
public MyPetManager() {
|
||||||
setup();
|
mp = MyPetApi.getPlayerManager();
|
||||||
|
mppm = MyPetApi.getMyPetManager();
|
||||||
|
enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMyPet(Object ent) {
|
public boolean isMyPet(Object ent) {
|
||||||
@ -46,16 +43,4 @@ public class MyPetManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setup() {
|
|
||||||
Plugin pl = Bukkit.getPluginManager().getPlugin("MyPet");
|
|
||||||
if (pl == null || !Bukkit.getPluginManager().isPluginEnabled("MyPet"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
mp = MyPetApi.getPlayerManager();
|
|
||||||
mppm = MyPetApi.getMyPetManager();
|
|
||||||
enabled = true;
|
|
||||||
Jobs.consoleMsg("&e[Jobs] &6MyPet detected");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.gamingmesh.jobs.MythicMobs;
|
package com.gamingmesh.jobs.hooks.MythicMobs;
|
||||||
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
|
||||||
@ -11,7 +11,4 @@ public interface MythicMobInterface {
|
|||||||
void registerListener();
|
void registerListener();
|
||||||
|
|
||||||
String getDisplayName(String id);
|
String getDisplayName(String id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.gamingmesh.jobs.MythicMobs;
|
package com.gamingmesh.jobs.hooks.MythicMobs;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -18,7 +18,6 @@ public class MythicMobs2 implements MythicMobInterface {
|
|||||||
|
|
||||||
public MythicMobs2(Jobs plugin) {
|
public MythicMobs2(Jobs plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -30,8 +29,10 @@ public class MythicMobs2 implements MythicMobInterface {
|
|||||||
public boolean isMythicMob(LivingEntity lVictim) {
|
public boolean isMythicMob(LivingEntity lVictim) {
|
||||||
if (MMAPI == null || lVictim == null)
|
if (MMAPI == null || lVictim == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (MMAPI.getMobAPI().isMythicMob(lVictim))
|
if (MMAPI.getMobAPI().isMythicMob(lVictim))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +55,6 @@ public class MythicMobs2 implements MythicMobInterface {
|
|||||||
MMAPI = ((MythicMobs) mm).getAPI();
|
MMAPI = ((MythicMobs) mm).getAPI();
|
||||||
Jobs.consoleMsg("&e[Jobs] &6MythicMobs2 was found - Enabling capabilities.");
|
Jobs.consoleMsg("&e[Jobs] &6MythicMobs2 was found - Enabling capabilities.");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,6 +66,7 @@ public class MythicMobs2 implements MythicMobInterface {
|
|||||||
} catch (InvalidMobTypeException e) {
|
} catch (InvalidMobTypeException e) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.gamingmesh.jobs.MythicMobs;
|
package com.gamingmesh.jobs.hooks.MythicMobs;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -24,17 +24,17 @@ public class MythicMobs2Listener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void OnMythicMobDeath(MythicMobDeathEvent event) {
|
public void OnMythicMobDeath(MythicMobDeathEvent event) {
|
||||||
|
// make sure plugin is enabled
|
||||||
|
if (!plugin.isEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
//disabling plugin in world
|
//disabling plugin in world
|
||||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Entity that died must be living
|
// Entity that died must be living
|
||||||
if (!(event.getEntity() instanceof LivingEntity))
|
if (!(event.getEntity() instanceof LivingEntity))
|
||||||
return;
|
return;
|
||||||
MythicMob lVictim = event.getMobType();
|
|
||||||
|
|
||||||
// make sure plugin is enabled
|
|
||||||
if (!plugin.isEnabled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player pDamager = null;
|
Player pDamager = null;
|
||||||
|
|
||||||
@ -50,6 +50,7 @@ public class MythicMobs2Listener implements Listener {
|
|||||||
|
|
||||||
if (pDamager == null)
|
if (pDamager == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check if in creative
|
// check if in creative
|
||||||
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative") && !Jobs.getGCManager().payInCreative())
|
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative") && !Jobs.getGCManager().payInCreative())
|
||||||
return;
|
return;
|
||||||
@ -59,10 +60,14 @@ public class MythicMobs2Listener implements Listener {
|
|||||||
|
|
||||||
// pay
|
// pay
|
||||||
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(pDamager);
|
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(pDamager);
|
||||||
|
|
||||||
if (jDamager == null)
|
if (jDamager == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
MythicMob lVictim = event.getMobType();
|
||||||
|
if (lVictim == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent);
|
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.gamingmesh.jobs.MythicMobs;
|
package com.gamingmesh.jobs.hooks.MythicMobs;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -17,7 +17,6 @@ public class MythicMobs4 implements MythicMobInterface {
|
|||||||
|
|
||||||
public MythicMobs4(Jobs plugin) {
|
public MythicMobs4(Jobs plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -29,8 +28,10 @@ public class MythicMobs4 implements MythicMobInterface {
|
|||||||
public boolean isMythicMob(LivingEntity lVictim) {
|
public boolean isMythicMob(LivingEntity lVictim) {
|
||||||
if (MMAPI == null || lVictim == null)
|
if (MMAPI == null || lVictim == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (MMAPI.isMythicMob(lVictim))
|
if (MMAPI.isMythicMob(lVictim))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +55,6 @@ public class MythicMobs4 implements MythicMobInterface {
|
|||||||
MMAPI = ((MythicMobs) mm).getAPIHelper();
|
MMAPI = ((MythicMobs) mm).getAPIHelper();
|
||||||
Jobs.consoleMsg("&e[Jobs] &6MythicMobs4 was found - Enabling capabilities.");
|
Jobs.consoleMsg("&e[Jobs] &6MythicMobs4 was found - Enabling capabilities.");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean failed = false;
|
static boolean failed = false;
|
||||||
@ -63,6 +63,7 @@ public class MythicMobs4 implements MythicMobInterface {
|
|||||||
public String getDisplayName(String id) {
|
public String getDisplayName(String id) {
|
||||||
if (failed)
|
if (failed)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
MythicMob mm = MMAPI.getMythicMob(id);
|
MythicMob mm = MMAPI.getMythicMob(id);
|
||||||
try {
|
try {
|
||||||
if (mm != null)
|
if (mm != null)
|
||||||
@ -74,6 +75,7 @@ public class MythicMobs4 implements MythicMobInterface {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.gamingmesh.jobs.MythicMobs;
|
package com.gamingmesh.jobs.hooks.MythicMobs;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -25,17 +25,17 @@ public class MythicMobs4Listener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void OnMythicMobDeath(MythicMobDeathEvent event) {
|
public void OnMythicMobDeath(MythicMobDeathEvent event) {
|
||||||
|
// make sure plugin is enabled
|
||||||
|
if (!plugin.isEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
//disabling plugin in world
|
//disabling plugin in world
|
||||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Entity that died must be living
|
// Entity that died must be living
|
||||||
if (!(event.getEntity() instanceof LivingEntity))
|
if (!(event.getEntity() instanceof LivingEntity))
|
||||||
return;
|
return;
|
||||||
MythicMob lVictim = event.getMobType();
|
|
||||||
|
|
||||||
// make sure plugin is enabled
|
|
||||||
if (!plugin.isEnabled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player pDamager = null;
|
Player pDamager = null;
|
||||||
|
|
||||||
@ -51,6 +51,7 @@ public class MythicMobs4Listener implements Listener {
|
|||||||
|
|
||||||
if (pDamager == null)
|
if (pDamager == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check if in creative
|
// check if in creative
|
||||||
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative") && !Jobs.getGCManager().payInCreative())
|
if (pDamager.getGameMode().equals(GameMode.CREATIVE) && !pDamager.hasPermission("jobs.paycreative") && !Jobs.getGCManager().payInCreative())
|
||||||
return;
|
return;
|
||||||
@ -60,10 +61,14 @@ public class MythicMobs4Listener implements Listener {
|
|||||||
|
|
||||||
// pay
|
// pay
|
||||||
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(pDamager);
|
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(pDamager);
|
||||||
|
|
||||||
if (jDamager == null)
|
if (jDamager == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
MythicMob lVictim = event.getMobType();
|
||||||
|
if (lVictim == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent);
|
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.gamingmesh.jobs.WorldGuard;
|
package com.gamingmesh.jobs.hooks.WorldGuard;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -55,6 +55,7 @@ public class WorldGuardManager {
|
|||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ArrayList<RestrictedArea>();
|
return new ArrayList<RestrictedArea>();
|
||||||
}
|
}
|
||||||
|
|
@ -26,6 +26,7 @@ import com.gamingmesh.jobs.Jobs;
|
|||||||
import com.gamingmesh.jobs.actions.*;
|
import com.gamingmesh.jobs.actions.*;
|
||||||
import com.gamingmesh.jobs.api.JobsChunkChangeEvent;
|
import com.gamingmesh.jobs.api.JobsChunkChangeEvent;
|
||||||
import com.gamingmesh.jobs.container.*;
|
import com.gamingmesh.jobs.container.*;
|
||||||
|
import com.gamingmesh.jobs.hooks.HookManager;
|
||||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
||||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling.ownershipFeedback;
|
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling.ownershipFeedback;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
@ -1123,8 +1124,8 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (e.getDamager().hasMetadata("NPC"))
|
if (e.getDamager().hasMetadata("NPC"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Jobs.getGCManager().MythicMobsEnabled && Jobs.getMythicManager() != null) {
|
if (Jobs.getGCManager().MythicMobsEnabled && HookManager.getMythicManager() != null
|
||||||
if (Jobs.getMythicManager().isMythicMob(lVictim))
|
&& HookManager.getMythicManager().isMythicMob(lVictim)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1144,8 +1145,8 @@ public class JobsPaymentListener implements Listener {
|
|||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player) {
|
||||||
pDamager = (Player) e.getDamager();
|
pDamager = (Player) e.getDamager();
|
||||||
// Checking if killer is MyPet animal
|
// Checking if killer is MyPet animal
|
||||||
} else if (Jobs.getMyPetManager() != null && Jobs.getMyPetManager().isMyPet(e.getDamager())) {
|
} else if (HookManager.getMyPetManager() != null && HookManager.getMyPetManager().isMyPet(e.getDamager())) {
|
||||||
UUID uuid = Jobs.getMyPetManager().getOwnerOfPet(e.getDamager());
|
UUID uuid = HookManager.getMyPetManager().getOwnerOfPet(e.getDamager());
|
||||||
if (uuid != null)
|
if (uuid != null)
|
||||||
pDamager = Bukkit.getPlayer(uuid);
|
pDamager = Bukkit.getPlayer(uuid);
|
||||||
// Checking if killer is tamed animal
|
// Checking if killer is tamed animal
|
||||||
|
Loading…
Reference in New Issue
Block a user