1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

Lets use the enum constant name not only the constant

This commit is contained in:
montlikadani 2019-04-18 17:54:42 +02:00
parent 23b834a7e0
commit f9ebb0bec3
3 changed files with 14 additions and 18 deletions

View File

@ -1882,7 +1882,7 @@ public class ItemManager {
return CMIMaterial.NONE;
Integer ids = null;
Integer data = null;
id = id.replace("_", "").replace(" ", "").toLowerCase();
id = id.replace("_", "").replace(" ", "").replace("minecraft:", "").toLowerCase();
try {
ids = Integer.parseInt(id);
} catch (Throwable e) {

View File

@ -27,46 +27,46 @@ public class McMMOManager {
return 0D;
if (mcMMOOverHaul) {
Long t = InfoMap.get(SuperAbilityType.TREE_FELLER);
Long t = InfoMap.get(SuperAbilityType.TREE_FELLER.getName());
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().TreeFellerMultiplier);
InfoMap.remove(SuperAbilityType.TREE_FELLER);
InfoMap.remove(SuperAbilityType.TREE_FELLER.getName());
}
t = InfoMap.get(SuperAbilityType.GIGA_DRILL_BREAKER);
t = InfoMap.get(SuperAbilityType.GIGA_DRILL_BREAKER.getName());
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().gigaDrillMultiplier);
InfoMap.remove(SuperAbilityType.GIGA_DRILL_BREAKER);
InfoMap.remove(SuperAbilityType.GIGA_DRILL_BREAKER.getName());
}
t = InfoMap.get(SuperAbilityType.SUPER_BREAKER);
t = InfoMap.get(SuperAbilityType.SUPER_BREAKER.getName());
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().superBreakerMultiplier);
InfoMap.remove(SuperAbilityType.SUPER_BREAKER);
InfoMap.remove(SuperAbilityType.SUPER_BREAKER.getName());
}
} else if (mcMMOPresent) {
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");
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");
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().superBreakerMultiplier);
InfoMap.remove("SUPER_BREAKER");
InfoMap.remove("SUPER_BREAKER");
}
}
@ -78,12 +78,14 @@ public class McMMOManager {
if (McMMO != null) {
try {
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
mcMMOOverHaul = true;
} 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");
mcMMOPresent = true;
} catch (ClassNotFoundException e) {
// Disabling skill API check;
mcMMOPresent = false;
@ -95,8 +97,6 @@ public class McMMOManager {
return true;
}
mcMMOPresent = true;
mcMMOOverHaul = true;
Jobs.consoleMsg("&e[Jobs] &6mcMMO" + McMMO.getDescription().getVersion() + " was found - Enabling capabilities.");
return true;
}

View File

@ -111,12 +111,8 @@ public class JobsListener implements Listener {
if (msg == null)
return;
Bukkit.getServer().getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
player.performCommand(msg + event.getMessage());
}
});
Bukkit.getServer().getScheduler().runTask(plugin, () ->
player.performCommand(msg + event.getMessage()));
event.setCancelled(true);
}