More work on migrating commands to new API

This commit is contained in:
nossr50
2020-12-23 15:29:39 -08:00
parent 537b120ffc
commit 9b9ffbb982
46 changed files with 352 additions and 341 deletions

View File

@@ -27,7 +27,7 @@ public class RankUtils {
*/
public static void executeSkillUnlockNotifications(@NotNull Plugin plugin, @NotNull OnlineMMOPlayer mmoPlayer, @NotNull PrimarySkillType primarySkillType, int newLevel)
{
for(SubSkillType subSkillType : primarySkillType.getSkillAbilities())
for(SubSkillType subSkillType : mcMMO.p.getSkillRegister().getSkillAbilities())
{
int playerRankInSkill = getRank(mmoPlayer, subSkillType);

View File

@@ -135,7 +135,7 @@ public final class SkillUtils {
* @return true if this is a valid skill, false otherwise
*/
public static boolean isSkill(@NotNull String skillName) {
return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? PrimarySkillType.getSkill(skillName) != null : isLocalizedSkill(skillName);
return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? mcMMO.p.getSkillRegister().getSkill(skillName) != null : isLocalizedSkill(skillName);
}
public static void sendSkillMessage(@NotNull Player player, @NotNull NotificationType notificationType, @NotNull String key) {

View File

@@ -4,6 +4,8 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.RankConfig;
import com.gmail.nossr50.datatypes.json.McMMOUrl;
import com.gmail.nossr50.datatypes.json.McMMOWebLinks;
import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.util.Misc;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
@@ -13,6 +15,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils;
import com.neetgames.mcmmo.skill.RootSkill;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity;
@@ -485,6 +488,10 @@ public class TextComponentFactory {
componentBuilder.append(Component.newline());
}
public static void getSubSkillTextComponents(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull List<Component> textComponents, @NotNull RootSkill rootSkill) {
return getSubSkillTextComponents(mmoPlayer, textComponents, CoreSkills.getSkill(rootSkill));
}
public static void getSubSkillTextComponents(@NotNull OnlineMMOPlayer mmoPlayer, @NotNull List<Component> textComponents, @NotNull PrimarySkillType parentSkill) {
for(SubSkillType subSkillType : SubSkillType.values())
{