1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-02-27 09:43:22 +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; return CMIMaterial.NONE;
Integer ids = null; Integer ids = null;
Integer data = null; Integer data = null;
id = id.replace("_", "").replace(" ", "").toLowerCase(); id = id.replace("_", "").replace(" ", "").replace("minecraft:", "").toLowerCase();
try { try {
ids = Integer.parseInt(id); ids = Integer.parseInt(id);
} catch (Throwable e) { } catch (Throwable e) {

View File

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

View File

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