mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-20 07:01:22 +01:00
Fixing McMMO skill issue
This commit is contained in:
parent
d30a02242d
commit
0a21c1308c
@ -66,8 +66,8 @@ public class McMMO1_X_listener implements Listener {
|
||||
try {
|
||||
Object ab = event.getClass().getMethod("getAbility").invoke(event);
|
||||
// Lets use fixed timer as this tend to return 0
|
||||
// int maxLenght = (int) ab.getClass().getMethod("getMaxLength").invoke(ab);
|
||||
InfoMap.put(String.valueOf(ab), System.currentTimeMillis() + (30 * 1000));
|
||||
// int maxLenght = (int) ab.getClass().getMethod("getMaxLength").invoke(ab);
|
||||
InfoMap.put(String.valueOf(ab).toLowerCase(), System.currentTimeMillis() + (30 * 1000));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -80,7 +80,7 @@ public class McMMO1_X_listener implements Listener {
|
||||
if (InfoMap != null) {
|
||||
try {
|
||||
Object ab = event.getClass().getMethod("getAbility").invoke(event);
|
||||
InfoMap.remove(String.valueOf(ab));
|
||||
InfoMap.remove(String.valueOf(ab).toLowerCase());
|
||||
if (InfoMap.isEmpty())
|
||||
HookManager.getMcMMOManager().getMap().remove(event.getPlayer().getUniqueId());
|
||||
} catch (Exception e) {
|
||||
|
@ -63,14 +63,14 @@ public class McMMO2_X_listener implements Listener {
|
||||
HookManager.getMcMMOManager().getMap().put(event.getPlayer().getUniqueId(), InfoMap);
|
||||
}
|
||||
|
||||
InfoMap.put(event.getAbility().toString(), System.currentTimeMillis() + (30 * 1000));
|
||||
InfoMap.put(event.getAbility().toString().toLowerCase(), System.currentTimeMillis() + (30 * 1000));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void OnAbilityOff(McMMOPlayerAbilityDeactivateEvent event) {
|
||||
HashMap<String, Long> InfoMap = HookManager.getMcMMOManager().getMap().get(event.getPlayer().getUniqueId());
|
||||
if (InfoMap != null) {
|
||||
InfoMap.remove(event.getAbility().toString());
|
||||
InfoMap.remove(event.getAbility().toString().toLowerCase());
|
||||
if (InfoMap.isEmpty())
|
||||
HookManager.getMcMMOManager().getMap().remove(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
@ -34,46 +34,48 @@ public class McMMOManager {
|
||||
return 0D;
|
||||
|
||||
if (mcMMOOverHaul) {
|
||||
Long t = InfoMap.get(SuperAbilityType.TREE_FELLER.toString());
|
||||
// Skill names should be in lower case
|
||||
Long t = InfoMap.get(SuperAbilityType.TREE_FELLER.toString().toLowerCase());
|
||||
if (t != null) {
|
||||
if (t > System.currentTimeMillis())
|
||||
return -(1 - Jobs.getGCManager().TreeFellerMultiplier);
|
||||
InfoMap.remove(SuperAbilityType.TREE_FELLER.toString());
|
||||
InfoMap.remove(SuperAbilityType.TREE_FELLER.toString().toLowerCase());
|
||||
}
|
||||
|
||||
t = InfoMap.get(SuperAbilityType.GIGA_DRILL_BREAKER.toString());
|
||||
t = InfoMap.get(SuperAbilityType.GIGA_DRILL_BREAKER.toString().toLowerCase());
|
||||
if (t != null) {
|
||||
if (t > System.currentTimeMillis())
|
||||
return -(1 - Jobs.getGCManager().gigaDrillMultiplier);
|
||||
InfoMap.remove(SuperAbilityType.GIGA_DRILL_BREAKER.toString());
|
||||
InfoMap.remove(SuperAbilityType.GIGA_DRILL_BREAKER.toString().toLowerCase());
|
||||
}
|
||||
|
||||
t = InfoMap.get(SuperAbilityType.SUPER_BREAKER.toString());
|
||||
t = InfoMap.get(SuperAbilityType.SUPER_BREAKER.toString().toLowerCase());
|
||||
if (t != null) {
|
||||
if (t > System.currentTimeMillis())
|
||||
return -(1 - Jobs.getGCManager().superBreakerMultiplier);
|
||||
InfoMap.remove(SuperAbilityType.SUPER_BREAKER.toString());
|
||||
InfoMap.remove(SuperAbilityType.SUPER_BREAKER.toString().toLowerCase());
|
||||
}
|
||||
} else if (mcMMOPresent) {
|
||||
Long t = InfoMap.get("TREE_FELLER");
|
||||
// Skill names should be in lower case
|
||||
Long t = InfoMap.get("tree_feller");
|
||||
if (t != null) {
|
||||
if (t > System.currentTimeMillis())
|
||||
return -(1 - Jobs.getGCManager().TreeFellerMultiplier);
|
||||
InfoMap.remove("TREE_FELLER");
|
||||
InfoMap.remove("tree_feller");
|
||||
}
|
||||
|
||||
t = InfoMap.get("GIGA_DRILL_BREAKER");
|
||||
t = InfoMap.get("giga_drill_breaker");
|
||||
if (t != null) {
|
||||
if (t > System.currentTimeMillis())
|
||||
return -(1 - Jobs.getGCManager().gigaDrillMultiplier);
|
||||
InfoMap.remove("GIGA_DRILL_BREAKER");
|
||||
InfoMap.remove("giga_drill_breaker");
|
||||
}
|
||||
|
||||
t = InfoMap.get("SUPER_BREAKER");
|
||||
t = InfoMap.get("super_breaker");
|
||||
if (t != null) {
|
||||
if (t > System.currentTimeMillis())
|
||||
return -(1 - Jobs.getGCManager().superBreakerMultiplier);
|
||||
InfoMap.remove("SUPER_BREAKER");
|
||||
InfoMap.remove("super_breaker");
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +91,6 @@ public class McMMOManager {
|
||||
} catch (ClassNotFoundException c) {
|
||||
// Disabling skill API check;
|
||||
mcMMOOverHaul = false;
|
||||
Jobs.consoleMsg("&e[Jobs] &6mcMMO was found - &cBut your McMMO version is outdated, please update for full support.");
|
||||
|
||||
try {
|
||||
Class.forName("com.gmail.nossr50.api.AbilityAPI");
|
||||
@ -97,10 +98,9 @@ public class McMMOManager {
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Disabling skill API check;
|
||||
mcMMOPresent = false;
|
||||
Jobs.consoleMsg("&e[Jobs] &6mcMMO was found - &cBut your McMMO version is outdated, please update for full support.");
|
||||
// Still enabling event listener for repair
|
||||
return true;
|
||||
}
|
||||
if (!mcMMOPresent)
|
||||
Jobs.consoleMsg("&e[Jobs] &6mcMMO was found - &cBut your McMMO version is outdated, please update for full support.");
|
||||
|
||||
// Still enabling event listener for repair
|
||||
return true;
|
||||
|
@ -5,7 +5,7 @@ version: ${project.version}
|
||||
api-version: 1.13
|
||||
website: https://www.spigotmc.org/resources/4216/
|
||||
authors: [phrstbrn, Zrips, montlikadani]
|
||||
softdepend: [Vault, Essentials, MythicMobs, McMMO, WorldGuard, MyPet, PlaceholderAPI]
|
||||
softdepend: [Vault, Essentials, MythicMobs, McMMO, mcMMO, WorldGuard, MyPet, PlaceholderAPI]
|
||||
commands:
|
||||
jobs:
|
||||
description: Jobs
|
||||
|
Loading…
Reference in New Issue
Block a user