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

Lets fix last PR double class check and throw error

- Fix not showing color in the chat when used chat-format option.
This commit is contained in:
montlikadani 2019-03-08 09:30:57 +01:00
parent 21049eb274
commit 5c3c064cb5
5 changed files with 56 additions and 28 deletions

View File

@ -13,7 +13,6 @@ import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
public class McMMOManager {
public boolean mcMMOPresent = false;
public boolean mcMMOOverHaul = false;
private HashMap<UUID, HashMap<String, Long>> map = new HashMap<>();
@ -26,28 +25,49 @@ public class McMMOManager {
HashMap<String, Long> InfoMap = map.get(player.getUniqueId());
if (InfoMap == null)
return 0D;
if (mcMMOOverHaul = true) {
Long t = InfoMap.get(SuperAbilityType.TREE_FELLER);
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().TreeFellerMultiplier);
InfoMap.remove(SuperAbilityType.TREE_FELLER);
}
t = InfoMap.get(SuperAbilityType.GIGA_DRILL_BREAKER);
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().gigaDrillMultiplier);
InfoMap.remove(SuperAbilityType.GIGA_DRILL_BREAKER);
}
if (mcMMOOverHaul) {
Long t = InfoMap.get(SuperAbilityType.TREE_FELLER);
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().TreeFellerMultiplier);
InfoMap.remove(SuperAbilityType.TREE_FELLER);
}
t = InfoMap.get(SuperAbilityType.SUPER_BREAKER);
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().superBreakerMultiplier);
InfoMap.remove(SuperAbilityType.SUPER_BREAKER);
}
t = InfoMap.get(SuperAbilityType.GIGA_DRILL_BREAKER);
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().gigaDrillMultiplier);
InfoMap.remove(SuperAbilityType.GIGA_DRILL_BREAKER);
}
t = InfoMap.get(SuperAbilityType.SUPER_BREAKER);
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().superBreakerMultiplier);
InfoMap.remove(SuperAbilityType.SUPER_BREAKER);
}
} 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");
}
t = InfoMap.get("GIGA_DRILL_BREAKER");
if (t != null) {
if (t < System.currentTimeMillis())
return -(1 - Jobs.getGCManager().gigaDrillMultiplier);
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");
}
}
return 0D;
@ -57,12 +77,20 @@ public class McMMOManager {
Plugin McMMO = Bukkit.getPluginManager().getPlugin("mcMMO");
if (McMMO != null) {
try {
Class.forName("com.gmail.nossr50.api.AbilityAPI");
Class.forName("com.gmail.nossr50.datatypes.skills.SuperAbilityType");
} catch (ClassNotFoundException e) {
} catch (ClassNotFoundException c) {
// Disabling skill API check;
mcMMOPresent = false;
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");
} 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;
}
// Still enabling event listener for repair
return true;
}

View File

@ -847,7 +847,7 @@ public class PlayerManager {
if (player == null || prog == null)
return boost;
if (Jobs.getMcMMOlistener().mcMMOPresent)
if (Jobs.getMcMMOlistener().mcMMOPresent || Jobs.getMcMMOlistener().mcMMOOverHaul)
boost.add(BoostOf.McMMO, new BoostMultiplier().add(Jobs.getMcMMOlistener().getMultiplier(player.getPlayer())));
if (ent != null && (ent instanceof Tameable)) {

View File

@ -56,7 +56,7 @@ public class bonus implements Cmd {
printBoost(sender, boost, BoostOf.NearSpawner);
printBoost(sender, boost, BoostOf.PetPay);
if (Jobs.getMcMMOlistener().mcMMOPresent && boost.get(BoostOf.McMMO, CurrencyType.EXP) != 0D)
if (Jobs.getMcMMOlistener().mcMMOPresent || Jobs.getMcMMOlistener().mcMMOOverHaul && boost.get(BoostOf.McMMO, CurrencyType.EXP) != 0D)
printBoost(sender, boost, BoostOf.McMMO);
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));

View File

@ -33,7 +33,6 @@ import org.bukkit.inventory.ItemStack;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.resources.jfep.Parser;
import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.Debug;
public class Job {
// job info

View File

@ -690,7 +690,8 @@ public class JobsPlayer {
honorific = builder.toString().trim();
if (honorific.length() > 0)
honorific = Jobs.getGCManager().getModifyChatPrefix() + honorific + Jobs.getGCManager().getModifyChatSuffix();
honorific = org.bukkit.ChatColor.translateAlternateColorCodes('&',
Jobs.getGCManager().getModifyChatPrefix() + honorific + Jobs.getGCManager().getModifyChatSuffix());
}