mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-10 00:05:27 +02:00
Crimes were commited today.
PrimarySkillType was a mess... SkillTools is not much better though.
This commit is contained in:
@@ -44,6 +44,6 @@ public class AddLevelsCommand extends ExperienceCommand {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.1", value, skill.getName()));
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.1", value, skill.getLocalizedSkillName()));
|
||||
}
|
||||
}
|
||||
|
@@ -46,6 +46,6 @@ public class AddXPCommand extends ExperienceCommand {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addxp.AwardSkill", value, skill.getName()));
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.addxp.AwardSkill", value, skill.getLocalizedSkillName()));
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
if (skill == null) {
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
} else {
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.2", skill.getLocalizedSkillName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = PrimarySkillType.getSkill(args[0]);
|
||||
skill = PrimarySkillType.matchSkill(args[0]);
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
@@ -82,7 +82,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = PrimarySkillType.getSkill(args[1]);
|
||||
skill = PrimarySkillType.matchSkill(args[1]);
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
@@ -153,7 +153,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
|
||||
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||
if (skill == null) {
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
for (PrimarySkillType primarySkillType : pluginRef.getSkillTools().NON_CHILD_SKILLS) {
|
||||
handleCommand(player, profile, primarySkillType, value);
|
||||
}
|
||||
|
||||
|
@@ -49,6 +49,6 @@ public class SkillEditCommand extends ExperienceCommand {
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.mmoedit.Modified.1", skill.getName(), value));
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.mmoedit.Modified.1", skill.getLocalizedSkillName(), value));
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ public class SkillResetCommand implements TabExecutor {
|
||||
if (skill == null) {
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
} else {
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.addlevels.AwardSkill.2", skill.getLocalizedSkillName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SkillResetCommand implements TabExecutor {
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
} else {
|
||||
skill = PrimarySkillType.getSkill(args[1]);
|
||||
skill = PrimarySkillType.matchSkill(args[1]);
|
||||
}
|
||||
|
||||
editValues((Player) sender, pluginRef.getUserManager().getPlayer(sender.getName()).getProfile(), skill);
|
||||
@@ -78,7 +78,7 @@ public class SkillResetCommand implements TabExecutor {
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
} else {
|
||||
skill = PrimarySkillType.getSkill(args[1]);
|
||||
skill = PrimarySkillType.matchSkill(args[1]);
|
||||
}
|
||||
|
||||
String playerName = pluginRef.getCommandTools().getMatchedPlayerName(args[0]);
|
||||
@@ -150,7 +150,7 @@ public class SkillResetCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected void handlePlayerMessageSkill(Player player, PrimarySkillType skill) {
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Reset.Single", skill.getName()));
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.Reset.Single", skill.getLocalizedSkillName()));
|
||||
}
|
||||
|
||||
private boolean validateArguments(CommandSender sender, String skillName) {
|
||||
@@ -159,7 +159,7 @@ public class SkillResetCommand implements TabExecutor {
|
||||
|
||||
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
for (PrimarySkillType primarySkillType : pluginRef.getSkillTools().NON_CHILD_SKILLS) {
|
||||
handleCommand(player, profile, primarySkillType);
|
||||
}
|
||||
|
||||
|
@@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -72,9 +73,9 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (isUnlockedFeature(party, partyFeature)) {
|
||||
unlockedPartyFeatures.add(partyFeature.getLocaleString());
|
||||
unlockedPartyFeatures.add(getPartyFeatureLocaleString(partyFeature));
|
||||
} else {
|
||||
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
|
||||
lockedPartyFeatures.add(getFeatureLockedLocaleString(partyFeature));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +86,17 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
public String getPartyFeatureLocaleString(PartyFeature partyFeature) {
|
||||
return pluginRef.getLocaleManager().getString("Party.Feature." + StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", ""));
|
||||
}
|
||||
|
||||
public String getFeatureLockedLocaleString(PartyFeature partyFeature) {
|
||||
return pluginRef.getLocaleManager().getString("Ability.Generic.Template.Lock",
|
||||
pluginRef.getLocaleManager().getString("Party.Feature.Locked."
|
||||
+ StringUtils.getPrettyPartyFeatureString(partyFeature).replace(" ", ""),
|
||||
pluginRef.getPartyManager().getPartyFeatureUnlockLevel(partyFeature)));
|
||||
}
|
||||
|
||||
private boolean isUnlockedFeature(Party party, PartyFeature partyFeature) {
|
||||
return party.getLevel() >= pluginRef.getPartyManager().getPartyFeatureUnlockLevel(partyFeature);
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party.teleport;
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -38,7 +37,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), pluginRef.getConfigManager().getConfigParty().getPTP().getPtpRequestTimeout())) {
|
||||
if (pluginRef.getSkillTools().cooldownExpired(ptpRecord.getTimeout(), pluginRef.getConfigManager().getConfigParty().getPTP().getPtpRequestTimeout())) {
|
||||
ptpRecord.removeRequest();
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Commands.ptp.RequestExpired"));
|
||||
return true;
|
||||
|
@@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -91,7 +90,7 @@ public class PtpCommand implements TabExecutor {
|
||||
int hurtCooldown = pluginRef.getConfigManager().getConfigParty().getPTP().getPtpRecentlyHurtCooldown();
|
||||
|
||||
if (hurtCooldown > 0) {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
||||
int timeRemaining = pluginRef.getSkillTools().calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Item.Injured.Wait", timeRemaining));
|
||||
@@ -112,7 +111,7 @@ public class PtpCommand implements TabExecutor {
|
||||
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
|
||||
|
||||
if (ptpCooldown > 0) {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(ptpLastUse * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player);
|
||||
int timeRemaining = pluginRef.getSkillTools().calculateTimeLeft(ptpLastUse * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
player.sendMessage(pluginRef.getLocaleManager().getString("Item.Generic.Wait", timeRemaining));
|
||||
|
@@ -128,7 +128,7 @@ public class LeaderboardCommand implements TabExecutor {
|
||||
return null;
|
||||
}
|
||||
|
||||
PrimarySkillType skill = PrimarySkillType.getSkill(skillName);
|
||||
PrimarySkillType skill = PrimarySkillType.matchSkill(skillName);
|
||||
|
||||
if (pluginRef.getCommandTools().isChildSkill(sender, skill)) {
|
||||
return null;
|
||||
|
@@ -10,7 +10,6 @@ import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
@@ -36,7 +35,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
public SkillCommand(PrimarySkillType skill, mcMMO pluginRef) {
|
||||
this.pluginRef = pluginRef;
|
||||
this.skill = skill;
|
||||
skillName = skill.getName();
|
||||
skillName = skill.getLocalizedSkillName();
|
||||
skillGuideCommand = new SkillGuideCommand(skill, pluginRef);
|
||||
}
|
||||
|
||||
@@ -70,7 +69,7 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
McMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getPlayer(player);
|
||||
|
||||
boolean isLucky = Permissions.lucky(player, skill);
|
||||
boolean hasEndurance = SkillUtils.getEnduranceLength(player) > 0;
|
||||
boolean hasEndurance = pluginRef.getSkillTools().getEnduranceLength(player) > 0;
|
||||
double skillValue = mcMMOPlayer.getSkillLevel(skill);
|
||||
|
||||
//Send the players a few blank lines to make finding the top of the skill command easier
|
||||
@@ -174,10 +173,10 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
|
||||
for (int i = 0; i < parentList.size(); i++) {
|
||||
if (i + 1 < parentList.size()) {
|
||||
parentMessage.append(pluginRef.getLocaleManager().getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||
parentMessage.append(pluginRef.getLocaleManager().getString("Effects.Child.ParentList", parentList.get(i).getLocalizedSkillName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||
parentMessage.append(ChatColor.GRAY + ", ");
|
||||
} else {
|
||||
parentMessage.append(pluginRef.getLocaleManager().getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||
parentMessage.append(pluginRef.getLocaleManager().getString("Effects.Child.ParentList", parentList.get(i).getLocalizedSkillName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,9 +210,9 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
|
||||
protected String[] formatLengthDisplayValues(Player player, double skillValue) {
|
||||
|
||||
int length = SkillUtils.calculateAbilityLength(pluginRef.getUserManager().getPlayer(player), skill, skill.getSuperAbility());
|
||||
int length = pluginRef.getSkillTools().calculateAbilityLength(pluginRef.getUserManager().getPlayer(player), skill, skill.getSuperAbility());
|
||||
|
||||
int enduranceLength = SkillUtils.calculateAbilityLengthPerks(pluginRef.getUserManager().getPlayer(player), skill, skill.getSuperAbility());
|
||||
int enduranceLength = pluginRef.getSkillTools().calculateAbilityLengthPerks(pluginRef.getUserManager().getPlayer(player), skill, skill.getSuperAbility());
|
||||
|
||||
return new String[]{String.valueOf(length), String.valueOf(enduranceLength)};
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
||||
private final mcMMO pluginRef;
|
||||
|
||||
public SkillGuideCommand(PrimarySkillType skill, mcMMO pluginRef) {
|
||||
header = pluginRef.getLocaleManager().getString("Guides.Header", skill.getName());
|
||||
header = pluginRef.getLocaleManager().getString("Guides.Header", skill.getLocalizedSkillName());
|
||||
guide = getGuide(skill);
|
||||
invalidPage = pluginRef.getLocaleManager().getString("Guides.Page.Invalid");
|
||||
this.pluginRef = pluginRef;
|
||||
|
Reference in New Issue
Block a user