Fixing more breaks from the static abuse removal

This commit is contained in:
nossr50 2019-09-25 14:21:11 -07:00
parent 297ce64a24
commit 8ad08298d0
8 changed files with 24 additions and 20 deletions

View File

@ -16,7 +16,7 @@ public class ConfigHardcoreDeathPenalty {
HARDCORE_SKILL_TOGGLE_MAP_DEFAULT = new HashMap<>(); HARDCORE_SKILL_TOGGLE_MAP_DEFAULT = new HashMap<>();
for(PrimarySkillType primarySkillType : PrimarySkillType.values()) { for(PrimarySkillType primarySkillType : PrimarySkillType.values()) {
if(primarySkillType.isChildSkill()) if(primarySkillType == PrimarySkillType.SALVAGE || primarySkillType == PrimarySkillType.SMELTING)
continue; continue;
HARDCORE_SKILL_TOGGLE_MAP_DEFAULT.put(primarySkillType, false); HARDCORE_SKILL_TOGGLE_MAP_DEFAULT.put(primarySkillType, false);

View File

@ -16,7 +16,8 @@ public class ConfigVampirism {
HARDCORE_SKILL_TOGGLE_MAP_DEFAULT = new HashMap<>(); HARDCORE_SKILL_TOGGLE_MAP_DEFAULT = new HashMap<>();
for(PrimarySkillType primarySkillType : PrimarySkillType.values()) { for(PrimarySkillType primarySkillType : PrimarySkillType.values()) {
if(primarySkillType.isChildSkill()) //TODO: Hacky fix to avoid the main class reference
if(primarySkillType == PrimarySkillType.SALVAGE || primarySkillType == PrimarySkillType.SMELTING)
continue; continue;
HARDCORE_SKILL_TOGGLE_MAP_DEFAULT.put(primarySkillType, false); HARDCORE_SKILL_TOGGLE_MAP_DEFAULT.put(primarySkillType, false);

View File

@ -19,8 +19,8 @@ public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable
* @Deprecated Skills will be using a new system stemming from the AbstractSubSkill class so make sure you check for both events, this event will be removed eventually. * @Deprecated Skills will be using a new system stemming from the AbstractSubSkill class so make sure you check for both events, this event will be removed eventually.
*/ */
@Deprecated @Deprecated
public SubSkillEvent(Player player, SubSkillType subSkillType) { public SubSkillEvent(Player player, SubSkillType subSkillType, PrimarySkillType primarySkillType) {
super(player, PrimarySkillType.getPrimarySkillBySubSkill(subSkillType)); super(player, primarySkillType);
this.subSkillType = subSkillType; this.subSkillType = subSkillType;
} }

View File

@ -165,8 +165,8 @@ public class EventManager {
* Others * Others
*/ */
public McMMOPlayerAbilityActivateEvent callPlayerAbilityActivateEvent(Player player, PrimarySkillType skill) { public McMMOPlayerAbilityActivateEvent callPlayerAbilityActivateEvent(Player player, PrimarySkillType primarySkillType, SuperAbilityType superAbilityType) {
McMMOPlayerAbilityActivateEvent event = new McMMOPlayerAbilityActivateEvent(player, skill); McMMOPlayerAbilityActivateEvent event = new McMMOPlayerAbilityActivateEvent(player, primarySkillType, superAbilityType);
pluginRef.getServer().getPluginManager().callEvent(event); pluginRef.getServer().getPluginManager().callEvent(event);
return event; return event;
@ -180,8 +180,8 @@ public class EventManager {
* @return the event after it has been fired * @return the event after it has been fired
*/ */
@Deprecated @Deprecated
public SubSkillEvent callSubSkillEvent(Player player, SubSkillType subSkillType) { public SubSkillEvent callSubSkillEvent(Player player, SubSkillType subSkillType, PrimarySkillType primarySkillType) {
SubSkillEvent event = new SubSkillEvent(player, subSkillType); SubSkillEvent event = new SubSkillEvent(player, subSkillType, primarySkillType);
pluginRef.getServer().getPluginManager().callEvent(event); pluginRef.getServer().getPluginManager().callEvent(event);
return event; return event;
@ -412,7 +412,7 @@ public class EventManager {
} }
public void callAbilityDeactivateEvent(Player player, SuperAbilityType superAbilityType) { public void callAbilityDeactivateEvent(Player player, SuperAbilityType superAbilityType) {
McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, pluginRef.getSkillTools().getPrimarySkillBySuperAbility(superAbilityType)); McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, pluginRef.getSkillTools().getPrimarySkillBySuperAbility(superAbilityType), superAbilityType);
pluginRef.getServer().getPluginManager().callEvent(event); pluginRef.getServer().getPluginManager().callEvent(event);
} }

View File

@ -159,7 +159,7 @@ public final class CommandRegistrationManager {
command.setPermission(null); //No perm required to save support headaches command.setPermission(null); //No perm required to save support headaches
command.setPermissionMessage(permissionsMessage); command.setPermissionMessage(permissionsMessage);
command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mmodebug")); command.setUsage(pluginRef.getLocaleManager().getString("Commands.Usage.0", "mmodebug"));
command.setExecutor(new PlayerDebugCommand()); command.setExecutor(new PlayerDebugCommand(pluginRef));
} }
private void registerMcChatSpyCommand() { private void registerMcChatSpyCommand() {

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.util.nbt; package com.gmail.nossr50.util.nbt;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import net.minecraft.server.v1_13_R2.NBTBase; import net.minecraft.server.v1_14_R1.NBTBase;
/** /**
* A simple class that acts as a container for raw NBT data * A simple class that acts as a container for raw NBT data

View File

@ -43,7 +43,7 @@ public class RandomChanceTools {
case RANDOM_STATIC_CHANCE: case RANDOM_STATIC_CHANCE:
return checkRandomStaticChanceExecutionSuccess(player, subSkillType); return checkRandomStaticChanceExecutionSuccess(player, subSkillType);
case ALWAYS_FIRES: case ALWAYS_FIRES:
SubSkillEvent event = pluginRef.getEventManager().callSubSkillEvent(player, subSkillType); SubSkillEvent event = pluginRef.getEventManager().callSubSkillEvent(player, subSkillType, pluginRef.getSkillTools().getPrimarySkillBySubSkill(subSkillType));
return !event.isCancelled(); return !event.isCancelled();
default: default:
return false; return false;

View File

@ -57,13 +57,13 @@ public class ScoreboardStrings {
LABEL_ABILITY_COOLDOWN = pluginRef.getLocaleManager().getString("Scoreboard.Misc.Cooldown"); LABEL_ABILITY_COOLDOWN = pluginRef.getLocaleManager().getString("Scoreboard.Misc.Cooldown");
LABEL_OVERALL = pluginRef.getLocaleManager().getString("Scoreboard.Misc.Overall"); LABEL_OVERALL = pluginRef.getLocaleManager().getString("Scoreboard.Misc.Overall");
init(pluginRef); init();
} }
/* /*
* Initializes the properties of this class * Initializes the properties of this class
*/ */
private void init(mcMMO pluginRef) { private void init() {
/* /*
* We need immutable objects for our ConfigScoreboard's labels * We need immutable objects for our ConfigScoreboard's labels
*/ */
@ -101,10 +101,10 @@ public class ScoreboardStrings {
skillLabelBuilder.put(primarySkillType, getShortenedName(colors.get(i) + pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType), false)); skillLabelBuilder.put(primarySkillType, getShortenedName(colors.get(i) + pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType), false));
if (pluginRef.getSkillTools().getSuperAbility(primarySkillType) != null) { if (pluginRef.getSkillTools().getSuperAbility(primarySkillType) != null) {
abilityLabelBuilder.put(pluginRef.getSkillTools().getSuperAbility(primarySkillType), getShortenedName(colors.get(i) + pluginRef.getSkillTools().getSuperAbility(primarySkillType).getPrettySuperAbilityName())); abilityLabelBuilder.put(pluginRef.getSkillTools().getSuperAbility(primarySkillType), getShortenedName(colors.get(i) + pluginRef.getSkillTools().getPrettySuperAbilityName(pluginRef.getSkillTools().getSuperAbility(primarySkillType))));
if (primarySkillType == PrimarySkillType.MINING) { if (primarySkillType == PrimarySkillType.MINING) {
abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, getShortenedName(colors.get(i) + SuperAbilityType.BLAST_MINING.getPrettySuperAbilityName())); abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, getShortenedName(colors.get(i) + pluginRef.getSkillTools().getPrettySuperAbilityName(SuperAbilityType.BLAST_MINING)));
} }
} }
@ -123,17 +123,20 @@ public class ScoreboardStrings {
skillLabelBuilder.put(primarySkillType, getShortenedName(ChatColor.GREEN + pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType))); skillLabelBuilder.put(primarySkillType, getShortenedName(ChatColor.GREEN + pluginRef.getSkillTools().getLocalizedSkillName(primarySkillType)));
if (pluginRef.getSkillTools().getSuperAbility(primarySkillType) != null) { if (pluginRef.getSkillTools().getSuperAbility(primarySkillType) != null) {
abilityLabelBuilder.put(pluginRef.getSkillTools().getSuperAbility(primarySkillType), formatAbility(pluginRef.getSkillTools().getSuperAbility(primarySkillType).getPrettySuperAbilityName())); abilityLabelBuilder.put(pluginRef.getSkillTools().getSuperAbility(primarySkillType),
formatAbility(pluginRef.getSkillTools().getPrettySuperAbilityName(pluginRef.getSkillTools().getSuperAbility(primarySkillType))));
if (primarySkillType == PrimarySkillType.MINING) { if (primarySkillType == PrimarySkillType.MINING) {
abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING, formatAbility(SuperAbilityType.BLAST_MINING.getPrettySuperAbilityName())); abilityLabelBuilder.put(SuperAbilityType.BLAST_MINING,
formatAbility(pluginRef.getSkillTools().getPrettySuperAbilityName(SuperAbilityType.BLAST_MINING)));
} }
} }
} }
} }
for (SuperAbilityType type : SuperAbilityType.values()) { for (SuperAbilityType superAbilityType : SuperAbilityType.values()) {
abilityLabelSkillBuilder.put(type, formatAbility((type == SuperAbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA), type.getPrettySuperAbilityName())); abilityLabelSkillBuilder.put(superAbilityType,
formatAbility((superAbilityType == SuperAbilityType.BLAST_MINING ? ChatColor.BLUE : ChatColor.AQUA), pluginRef.getSkillTools().getPrettySuperAbilityName(superAbilityType)));
} }
skillLabels = skillLabelBuilder.build(); skillLabels = skillLabelBuilder.build();