Updating command classes to new API

This commit is contained in:
nossr50 2020-12-23 14:58:32 -08:00
parent 25f7dd223d
commit 537b120ffc
69 changed files with 206 additions and 184 deletions

View File

@ -5,6 +5,8 @@ Version 2.2.000
(API) Added skill register (API) Added skill register
(API) Skill hierarchy is now defined by Skill in mcMMO-API, and mcMMO needs a skill to be registered to be aware of it (API) Skill hierarchy is now defined by Skill in mcMMO-API, and mcMMO needs a skill to be registered to be aware of it
(API) A lot of changes to the API, I'll be including a document with the release of this update to explain the finer details (API) A lot of changes to the API, I'll be including a document with the release of this update to explain the finer details
When using commands that require typing a skill name, locale names are now always checked
When using commands that require typing a skill name, it is now legal to provide the skills fully qualified identifier
Codebase Stuff Codebase Stuff
Many places that passed type Player now passes type McMMOPlayer instead Many places that passed type Player now passes type McMMOPlayer instead

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -7,11 +7,10 @@ import com.gmail.nossr50.commands.chat.AdminChatCommand;
import com.gmail.nossr50.commands.chat.PartyChatCommand; import com.gmail.nossr50.commands.chat.PartyChatCommand;
import com.gmail.nossr50.config.ChatConfig; import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.player.UserManager; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.permissions.Permissible; import org.bukkit.permissions.Permissible;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -3,9 +3,9 @@ package com.gmail.nossr50.commands;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.database.FlatFileDatabaseManager; import com.gmail.nossr50.database.FlatFileDatabaseManager;
import com.gmail.nossr50.database.SQLDatabaseManager; import com.gmail.nossr50.database.SQLDatabaseManager;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,10 +1,10 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,12 +1,11 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50.commands.admin; package com.gmail.nossr50.commands.admin;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -7,9 +7,9 @@ import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Default; import co.aikar.commands.annotation.Default;
import com.gmail.nossr50.commands.CommandManager; import com.gmail.nossr50.commands.CommandManager;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@CommandAlias("ac|a|adminchat|achat") //Kept for historical reasons @CommandAlias("ac|a|adminchat|achat") //Kept for historical reasons

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50.commands.chat; package com.gmail.nossr50.commands.chat;
import com.gmail.nossr50.commands.ToggleCommand; import com.gmail.nossr50.commands.ToggleCommand;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -7,12 +7,12 @@ import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Default; import co.aikar.commands.annotation.Default;
import com.gmail.nossr50.commands.CommandManager; import com.gmail.nossr50.commands.CommandManager;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,10 +1,10 @@
package com.gmail.nossr50.commands.experience; package com.gmail.nossr50.commands.experience;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -20,7 +20,7 @@ public class AddlevelsCommand extends ExperienceCommand {
} }
@Override @Override
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) {
float xpRemoved = profile.getSkillXpLevelRaw(skill); float xpRemoved = profile.getSkillXpLevelRaw(skill);
profile.addLevels(skill, value); profile.addLevels(skill, value);
@ -41,7 +41,7 @@ public class AddlevelsCommand extends ExperienceCommand {
} }
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) { protected void handlePlayerMessageSkill(Player player, int value, RootSkill rootSkill, boolean isSilent) {
if(isSilent) if(isSilent)
return; return;

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50.commands.experience; package com.gmail.nossr50.commands.experience;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -19,7 +19,7 @@ public class AddxpCommand extends ExperienceCommand {
} }
@Override @Override
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) {
if (player != null) { if (player != null) {
//Check if player profile is loaded //Check if player profile is loaded
if(mcMMO.getUserManager().getPlayer(player) == null) if(mcMMO.getUserManager().getPlayer(player) == null)
@ -42,7 +42,7 @@ public class AddxpCommand extends ExperienceCommand {
} }
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) { protected void handlePlayerMessageSkill(Player player, int value, RootSkill rootSkill, boolean isSilent) {
if(isSilent) if(isSilent)
return; return;

View File

@ -1,12 +1,13 @@
package com.gmail.nossr50.commands.experience; package com.gmail.nossr50.commands.experience;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.MMOPlayer;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -14,6 +15,7 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil; import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -22,7 +24,7 @@ import java.util.UUID;
public abstract class ExperienceCommand implements TabExecutor { public abstract class ExperienceCommand implements TabExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill; RootSkill rootSkill;
if(args.length < 2) { if(args.length < 2) {
return false; return false;
@ -56,14 +58,15 @@ public abstract class ExperienceCommand implements TabExecutor {
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().getPlayer(sender.getName()) == null) Player player = (Player) sender;
{ OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
if(mmoPlayer == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad")); sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true; return true;
} }
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]), isSilent(args)); editValues(mmoPlayer, skill, Integer.parseInt(args[1]), isSilent(args));
return true; return true;
} else if((args.length == 3 && !isSilent(args)) } else if((args.length == 3 && !isSilent(args))
|| (args.length == 4 && isSilent(args))) { || (args.length == 4 && isSilent(args))) {
@ -145,15 +148,15 @@ public abstract class ExperienceCommand implements TabExecutor {
protected abstract boolean permissionsCheckSelf(CommandSender sender); protected abstract boolean permissionsCheckSelf(CommandSender sender);
protected abstract boolean permissionsCheckOthers(CommandSender sender); protected abstract boolean permissionsCheckOthers(CommandSender sender);
protected abstract void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value); protected abstract void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value);
protected abstract void handlePlayerMessageAll(Player player, int value, boolean isSilent); protected abstract void handlePlayerMessageAll(Player player, int value, boolean isSilent);
protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent); protected abstract void handlePlayerMessageSkill(Player player, int value, RootSkill rootSkill, boolean isSilent);
private boolean validateArguments(CommandSender sender, String skillName, String value) { private boolean validateArguments(CommandSender sender, String skillName, String value) {
return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName))); return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName)));
} }
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) { protected static void handleSenderMessage(CommandSender sender, String playerName, RootSkill rootSkill) {
if (skill == null) { if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName)); sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
} }
@ -162,10 +165,10 @@ public abstract class ExperienceCommand implements TabExecutor {
} }
} }
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill, int value, boolean isSilent) { protected void editValues(@NotNull MMOPlayer mmoPlayer, @Nullable RootSkill rootSkill, int value, boolean isSilent) {
if (skill == null) { if (primarySkillType == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { for (PrimarySkillType type : PrimarySkillType.NON_CHILD_SKILLS) {
handleCommand(player, profile, primarySkillType, value); handleCommand(player, profile, type, value);
} }
if (player != null) { if (player != null) {
@ -173,10 +176,10 @@ public abstract class ExperienceCommand implements TabExecutor {
} }
} }
else { else {
handleCommand(player, profile, skill, value); handleCommand(player, profile, primarySkillType, value);
if (player != null) { if (player != null) {
handlePlayerMessageSkill(player, value, skill, isSilent); handlePlayerMessageSkill(player, value, primarySkillType, isSilent);
} }
} }
} }

View File

@ -1,10 +1,10 @@
package com.gmail.nossr50.commands.experience; package com.gmail.nossr50.commands.experience;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -20,7 +20,7 @@ public class MmoeditCommand extends ExperienceCommand {
} }
@Override @Override
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill, int value) {
int skillLevel = profile.getSkillLevel(skill); int skillLevel = profile.getSkillLevel(skill);
float xpRemoved = profile.getSkillXpLevelRaw(skill); float xpRemoved = profile.getSkillXpLevelRaw(skill);
@ -47,7 +47,7 @@ public class MmoeditCommand extends ExperienceCommand {
} }
@Override @Override
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) { protected void handlePlayerMessageSkill(Player player, int value, RootSkill rootSkill, boolean isSilent) {
if(isSilent) if(isSilent)
return; return;

View File

@ -1,14 +1,14 @@
package com.gmail.nossr50.commands.experience; package com.gmail.nossr50.commands.experience;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.EventUtils; import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -28,7 +28,7 @@ import java.util.UUID;
public class SkillresetCommand implements TabExecutor { public class SkillresetCommand implements TabExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill; RootSkill rootSkill;
switch (args.length) { switch (args.length) {
case 1: case 1:
if (CommandUtils.noConsoleUsage(sender)) { if (CommandUtils.noConsoleUsage(sender)) {
@ -51,7 +51,8 @@ public class SkillresetCommand implements TabExecutor {
skill = PrimarySkillType.getSkill(args[0]); skill = PrimarySkillType.getSkill(args[0]);
} }
editValues((Player) sender, mcMMO.getUserManager().getPlayer(sender.getName()), skill); editValues((Player) sender, mcMMO.getUserManager().queryPlayer(player)
, skill);
return true; return true;
case 2: case 2:
@ -114,7 +115,7 @@ public class SkillresetCommand implements TabExecutor {
} }
} }
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill) { protected void handleCommand(Player player, PlayerProfile profile, RootSkill rootSkill) {
int levelsRemoved = profile.getSkillLevel(skill); int levelsRemoved = profile.getSkillLevel(skill);
float xpRemoved = profile.getSkillXpLevelRaw(skill); float xpRemoved = profile.getSkillXpLevelRaw(skill);
@ -140,7 +141,7 @@ public class SkillresetCommand implements TabExecutor {
player.sendMessage(LocaleLoader.getString("Commands.Reset.All")); player.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
} }
protected void handlePlayerMessageSkill(Player player, PrimarySkillType skill) { protected void handlePlayerMessageSkill(Player player, RootSkill rootSkill) {
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName())); player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName()));
} }
@ -148,7 +149,7 @@ public class SkillresetCommand implements TabExecutor {
return skillName.equalsIgnoreCase("all") || !CommandUtils.isInvalidSkill(sender, skillName); return skillName.equalsIgnoreCase("all") || !CommandUtils.isInvalidSkill(sender, skillName);
} }
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) { protected static void handleSenderMessage(CommandSender sender, String playerName, RootSkill rootSkill) {
if (skill == null) { if (skill == null) {
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName)); sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
} }
@ -157,9 +158,9 @@ public class SkillresetCommand implements TabExecutor {
} }
} }
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill) { protected void editValues(Player player, PlayerProfile profile, RootSkill rootSkill) {
if (skill == null) { if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
handleCommand(player, profile, primarySkillType); handleCommand(player, profile, primarySkillType);
} }

View File

@ -1,10 +1,10 @@
package com.gmail.nossr50.commands.hardcore; package com.gmail.nossr50.commands.hardcore;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class HardcoreCommand extends HardcoreModeCommand { public class HardcoreCommand extends HardcoreModeCommand {
@ -19,9 +19,9 @@ public class HardcoreCommand extends HardcoreModeCommand {
} }
@Override @Override
protected boolean checkEnabled(PrimarySkillType skill) { protected boolean checkEnabled(RootSkill rootSkill) {
if (skill == null) { if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) { for (RootSkill rootSkill : PrimarySkillType.values()) {
if (!primarySkillType.getHardcoreStatLossEnabled()) { if (!primarySkillType.getHardcoreStatLossEnabled()) {
return false; return false;
} }
@ -34,12 +34,12 @@ public class HardcoreCommand extends HardcoreModeCommand {
} }
@Override @Override
protected void enable(PrimarySkillType skill) { protected void enable(RootSkill rootSkill) {
toggle(true, skill); toggle(true, skill);
} }
@Override @Override
protected void disable(PrimarySkillType skill) { protected void disable(RootSkill rootSkill) {
toggle(false, skill); toggle(false, skill);
} }
@ -49,9 +49,9 @@ public class HardcoreCommand extends HardcoreModeCommand {
sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D))); sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D)));
} }
private void toggle(boolean enable, PrimarySkillType skill) { private void toggle(boolean enable, RootSkill rootSkill) {
if (skill == null) { if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
primarySkillType.setHardcoreStatLossEnabled(enable); primarySkillType.setHardcoreStatLossEnabled(enable);
} }
} }

View File

@ -1,10 +1,10 @@
package com.gmail.nossr50.commands.hardcore; package com.gmail.nossr50.commands.hardcore;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;
@ -75,7 +75,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
return true; return true;
} }
PrimarySkillType skill = PrimarySkillType.getSkill(args[0]); RootSkill rootSkill = PrimarySkillType.getSkill(args[0]);
if (!CommandUtils.isChildSkill(sender, skill)) { if (!CommandUtils.isChildSkill(sender, skill)) {
return true; return true;
@ -122,8 +122,8 @@ public abstract class HardcoreModeCommand implements TabExecutor {
protected abstract boolean checkTogglePermissions(CommandSender sender); protected abstract boolean checkTogglePermissions(CommandSender sender);
protected abstract boolean checkModifyPermissions(CommandSender sender); protected abstract boolean checkModifyPermissions(CommandSender sender);
protected abstract boolean checkEnabled(PrimarySkillType skill); protected abstract boolean checkEnabled(RootSkill rootSkill);
protected abstract void enable(PrimarySkillType skill); protected abstract void enable(RootSkill rootSkill);
protected abstract void disable(PrimarySkillType skill); protected abstract void disable(RootSkill rootSkill);
protected abstract void modify(CommandSender sender, double newPercentage); protected abstract void modify(CommandSender sender, double newPercentage);
} }

View File

@ -1,10 +1,10 @@
package com.gmail.nossr50.commands.hardcore; package com.gmail.nossr50.commands.hardcore;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
public class VampirismCommand extends HardcoreModeCommand { public class VampirismCommand extends HardcoreModeCommand {
@ -19,9 +19,9 @@ public class VampirismCommand extends HardcoreModeCommand {
} }
@Override @Override
protected boolean checkEnabled(PrimarySkillType skill) { protected boolean checkEnabled(RootSkill rootSkill) {
if (skill == null) { if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) { for (RootSkill rootSkill : PrimarySkillType.values()) {
if (!primarySkillType.getHardcoreVampirismEnabled()) { if (!primarySkillType.getHardcoreVampirismEnabled()) {
return false; return false;
} }
@ -34,12 +34,12 @@ public class VampirismCommand extends HardcoreModeCommand {
} }
@Override @Override
protected void enable(PrimarySkillType skill) { protected void enable(RootSkill rootSkill) {
toggle(true, skill); toggle(true, skill);
} }
@Override @Override
protected void disable(PrimarySkillType skill) { protected void disable(RootSkill rootSkill) {
toggle(false, skill); toggle(false, skill);
} }
@ -49,9 +49,9 @@ public class VampirismCommand extends HardcoreModeCommand {
sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D))); sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D)));
} }
private void toggle(boolean enable, PrimarySkillType skill) { private void toggle(boolean enable, RootSkill rootSkill) {
if (skill == null) { if (skill == null) {
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { for (RootSkill rootSkill : PrimarySkillType.NON_CHILD_SKILLS) {
primarySkillType.setHardcoreVampirismEnabled(enable); primarySkillType.setHardcoreVampirismEnabled(enable);
} }
} }

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.neetgames.mcmmo.party.Party;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.neetgames.mcmmo.party.Party;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -2,13 +2,13 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.commands.chat.PartyChatCommand; import com.gmail.nossr50.commands.chat.PartyChatCommand;
import com.gmail.nossr50.commands.party.teleport.PtpCommand; import com.gmail.nossr50.commands.party.teleport.PtpCommand;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,10 +1,10 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyMember; import com.gmail.nossr50.datatypes.party.PartyMember;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.neetgames.mcmmo.party.Party;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,11 +1,11 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,11 +1,11 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,10 +1,10 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.neetgames.mcmmo.party.Party;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;

View File

@ -1,9 +1,9 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,11 +1,11 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyMember; import com.gmail.nossr50.datatypes.party.PartyMember;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,13 +1,13 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode; import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.neetgames.mcmmo.party.Party;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -1,12 +1,12 @@
package com.gmail.nossr50.commands.party.teleport; package com.gmail.nossr50.commands.party.teleport;
import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyMember; import com.gmail.nossr50.datatypes.party.PartyMember;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord; import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;

View File

@ -2,11 +2,9 @@ package com.gmail.nossr50.commands.party.teleport;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.WorldBlacklist;
import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord; import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.items.TeleportationWarmup; import com.gmail.nossr50.runnables.items.TeleportationWarmup;
@ -18,6 +16,8 @@ import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.gmail.nossr50.worldguard.WorldGuardUtils; import com.gmail.nossr50.worldguard.WorldGuardUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;

View File

@ -17,7 +17,8 @@ public class PtpToggleCommand implements CommandExecutor {
return true; return true;
} }
PartyTeleportRecord ptpRecord = mcMMO.getUserManager().getPlayer(sender.getName()).getPartyTeleportRecord(); PartyTeleportRecord ptpRecord = mcMMO.getUserManager().queryPlayer(player)
.getPartyTeleportRecord();
if (ptpRecord.isEnabled()) { if (ptpRecord.isEnabled()) {
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled")); sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));

View File

@ -1,15 +1,14 @@
package com.gmail.nossr50.commands.player; package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -53,17 +52,17 @@ public class InspectCommand implements TabExecutor {
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName)); sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
for (PrimarySkillType skill : PrimarySkillType.GATHERING_SKILLS) { for (RootSkill rootSkill : PrimarySkillType.GATHERING_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
} }
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
for (PrimarySkillType skill : PrimarySkillType.COMBAT_SKILLS) { for (RootSkill rootSkill : PrimarySkillType.COMBAT_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
} }
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc")); sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
for (PrimarySkillType skill : PrimarySkillType.MISC_SKILLS) { for (RootSkill rootSkill : PrimarySkillType.MISC_SKILLS) {
sender.sendMessage(CommandUtils.displaySkill(profile, skill)); sender.sendMessage(CommandUtils.displaySkill(profile, skill));
} }
} else { } else {

View File

@ -1,12 +1,12 @@
package com.gmail.nossr50.commands.player; package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;

View File

@ -1,13 +1,13 @@
package com.gmail.nossr50.commands.player; package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask; import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;
@ -82,7 +82,7 @@ public class McrankCommand implements TabExecutor {
private void display(CommandSender sender, String playerName) { private void display(CommandSender sender, String playerName) {
if (sender instanceof Player) { if (sender instanceof Player) {
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().getPlayer(sender.getName()); OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
if(mmoPlayer == null) if(mmoPlayer == null)
{ {

View File

@ -1,12 +1,12 @@
package com.gmail.nossr50.commands.player; package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.commands.player; package com.gmail.nossr50.commands.player;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask; import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
@ -10,6 +10,7 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;
@ -24,26 +25,26 @@ import java.util.List;
public class MctopCommand implements TabExecutor { public class MctopCommand implements TabExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill = null; RootSkill rootSkill = null;
switch (args.length) { switch (args.length) {
case 0: case 0:
display(1, skill, sender, command); display(1, rootSkill, sender, command);
return true; return true;
case 1: case 1:
if (StringUtils.isInt(args[0])) { if (StringUtils.isInt(args[0])) {
display(Math.abs(Integer.parseInt(args[0])), skill, sender, command); display(Math.abs(Integer.parseInt(args[0])), rootSkill, sender, command);
return true; return true;
} }
skill = extractSkill(sender, args[0]); rootSkill = extractSkill(sender, args[0]);
if (skill == null) { if (rootSkill == null) {
return true; return true;
} }
display(1, skill, sender, command); display(1, rootSkill, sender, command);
return true; return true;
case 2: case 2:
@ -51,13 +52,13 @@ public class MctopCommand implements TabExecutor {
return true; return true;
} }
skill = extractSkill(sender, args[0]); rootSkill = extractSkill(sender, args[0]);
if (skill == null) { if (rootSkill == null) {
return true; return true;
} }
display(Math.abs(Integer.parseInt(args[1])), skill, sender, command); display(Math.abs(Integer.parseInt(args[1])), rootSkill, sender, command);
return true; return true;
default: default:
@ -73,8 +74,8 @@ public class MctopCommand implements TabExecutor {
return ImmutableList.of(); return ImmutableList.of();
} }
private void display(int page, PrimarySkillType skill, CommandSender sender, Command command) { private void display(int page, @NotNull RootSkill rootSkill, @NotNull CommandSender sender, @NotNull Command command) {
if (skill != null && !Permissions.mctop(sender, skill)) { if (rootSkill != null && !Permissions.mctop(sender, CoreSkills.getSkill(rootSkill))) {
sender.sendMessage(command.getPermissionMessage()); sender.sendMessage(command.getPermissionMessage());
return; return;
} }
@ -84,7 +85,9 @@ public class MctopCommand implements TabExecutor {
return; return;
} }
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().getPlayer(sender.getName()); Player player = (Player) sender;
McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(player);
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750); long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
if (mmoPlayer.getDatabaseCommandATS() + cooldownMillis > System.currentTimeMillis()) { if (mmoPlayer.getDatabaseCommandATS() + cooldownMillis > System.currentTimeMillis()) {
@ -107,14 +110,14 @@ public class MctopCommand implements TabExecutor {
mmoPlayer.actualizeDatabaseCommandATS(); mmoPlayer.actualizeDatabaseCommandATS();
} }
display(page, skill, sender); display(page, rootSkill, sender);
} }
private void display(int page, PrimarySkillType skill, CommandSender sender) { private void display(int page, @NotNull RootSkill rootSkill, @NotNull CommandSender sender) {
boolean useBoard = (sender instanceof Player) && (Config.getInstance().getTopUseBoard()); boolean useBoard = (sender instanceof Player) && (Config.getInstance().getTopUseBoard());
boolean useChat = !useBoard || Config.getInstance().getTopUseChat(); boolean useChat = !useBoard || Config.getInstance().getTopUseChat();
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p); new MctopCommandAsyncTask(page, rootSkill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
} }
private PrimarySkillType extractSkill(CommandSender sender, String skillName) { private PrimarySkillType extractSkill(CommandSender sender, String skillName) {
@ -122,7 +125,7 @@ public class MctopCommand implements TabExecutor {
return null; return null;
} }
PrimarySkillType skill = PrimarySkillType.getSkill(skillName); RootSkill rootSkill = PrimarySkillType.getSkill(skillName);
if (CommandUtils.isChildSkill(sender, skill)) { if (CommandUtils.isChildSkill(sender, skill)) {
return null; return null;

View File

@ -1,12 +1,10 @@
package com.gmail.nossr50.commands.player; package com.gmail.nossr50.commands.player;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.util.experience.MMOExperienceBarManager;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.skills.SkillUtils; import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager; import com.gmail.nossr50.listeners.InteractionManager;
@ -10,6 +8,7 @@ import com.gmail.nossr50.util.random.RandomChanceSkill;
import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,16 +1,15 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
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; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.alchemy.AlchemyManager; import com.gmail.nossr50.skills.alchemy.AlchemyManager;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,13 +1,12 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.archery.Archery; import com.gmail.nossr50.skills.archery.Archery;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.axes.Axes; import com.gmail.nossr50.skills.axes.Axes;
@ -10,6 +8,7 @@ import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,10 +1,9 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.skills.crossbows.CrossbowManager; import com.gmail.nossr50.skills.crossbows.CrossbowManager;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,13 +1,12 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.excavation.ExcavationManager; import com.gmail.nossr50.skills.excavation.ExcavationManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.config.treasure.TreasureConfig; import com.gmail.nossr50.config.treasure.TreasureConfig;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.treasure.Rarity; import com.gmail.nossr50.datatypes.treasure.Rarity;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
@ -12,6 +10,7 @@ import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,13 +1,12 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.Material; import org.bukkit.Material;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.mining.MiningManager; import com.gmail.nossr50.skills.mining.MiningManager;
@ -9,6 +7,7 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
import com.gmail.nossr50.listeners.InteractionManager; import com.gmail.nossr50.listeners.InteractionManager;
@ -10,6 +8,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor; import org.bukkit.command.TabExecutor;

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.MaterialType; import com.gmail.nossr50.datatypes.skills.MaterialType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@ -14,6 +12,7 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.Material; import org.bukkit.Material;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,13 +1,12 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.salvage.Salvage; import com.gmail.nossr50.skills.salvage.Salvage;
import com.gmail.nossr50.skills.salvage.SalvageManager; import com.gmail.nossr50.skills.salvage.SalvageManager;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -3,13 +3,11 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.CoreSkills; 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; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.child.FamilyTree; import com.gmail.nossr50.skills.child.FamilyTree;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
@ -21,6 +19,7 @@ import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.neetgames.mcmmo.skill.RootSkill; import com.neetgames.mcmmo.skill.RootSkill;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
@ -39,7 +38,7 @@ import java.util.Set;
public abstract class SkillCommand implements TabExecutor { public abstract class SkillCommand implements TabExecutor {
protected @NotNull RootSkill rootSkill; protected @NotNull RootSkill rootSkill;
protected @NotNull PrimarySkillType primarySkillType; protected @NotNull RootSkill rootSkill;
private final String skillName; private final String skillName;
protected DecimalFormat percent = new DecimalFormat("##0.00%"); protected DecimalFormat percent = new DecimalFormat("##0.00%");
@ -47,7 +46,7 @@ public abstract class SkillCommand implements TabExecutor {
private final CommandExecutor skillGuideCommand; private final CommandExecutor skillGuideCommand;
public SkillCommand(@NotNull PrimarySkillType primarySkillType) { public SkillCommand(@NotNull RootSkill rootSkill) {
this.rootSkill = CoreSkills.getSkill(primarySkillType); this.rootSkill = CoreSkills.getSkill(primarySkillType);
this.primarySkillType = primarySkillType; this.primarySkillType = primarySkillType;
skillName = rootSkill.getSkillName(); skillName = rootSkill.getSkillName();

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.CoreSkills; import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.neetgames.mcmmo.skill.RootSkill; import com.neetgames.mcmmo.skill.RootSkill;
@ -16,7 +15,7 @@ import java.util.Arrays;
//TODO: Switch to root skill based //TODO: Switch to root skill based
public class SkillGuideCommand implements CommandExecutor { public class SkillGuideCommand implements CommandExecutor {
private final String header; private final String header;
private final PrimarySkillType skill; private final RootSkill rootSkill;
private final ArrayList<String> guide; private final ArrayList<String> guide;
private final String invalidPage = LocaleLoader.getString("Guides.Page.Invalid"); private final String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
@ -91,7 +90,7 @@ public class SkillGuideCommand implements CommandExecutor {
return allStrings; return allStrings;
} }
private ArrayList<String> getGuide(PrimarySkillType skill) { private ArrayList<String> getGuide(RootSkill rootSkill) {
ArrayList<String> guide = new ArrayList<>(); ArrayList<String> guide = new ArrayList<>();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {

View File

@ -1,13 +1,12 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -10,6 +8,7 @@ import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,13 +1,12 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.taming.Taming; import com.gmail.nossr50.skills.taming.Taming;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,8 +1,7 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -9,6 +7,7 @@ import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,13 +1,12 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.text.TextComponentFactory; import com.gmail.nossr50.util.text.TextComponentFactory;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -79,7 +79,7 @@ public class PersistentPlayerData implements MMOPlayerData {
//Core skills //Core skills
//TODO: Don't store values for disabled skills //TODO: Don't store values for disabled skills
for(RootSkill rootSkill : CoreSkills.getImmutableCoreRootSkillSet()) { for(RootSkill rootSkill : CoreSkills.getCoreSkills()) {
skillLevelValues.put(rootSkill, AdvancedConfig.getInstance().getStartingLevel()); skillLevelValues.put(rootSkill, AdvancedConfig.getInstance().getStartingLevel());
skillExperienceValues.put(rootSkill, 0F); skillExperienceValues.put(rootSkill, 0F);
} }

View File

@ -1,9 +1,14 @@
package com.gmail.nossr50.datatypes.skills; package com.gmail.nossr50.datatypes.skills;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.text.StringUtils;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.neetgames.mcmmo.skill.RootSkill; import com.neetgames.mcmmo.skill.RootSkill;
import com.neetgames.mcmmo.skill.SkillIdentity; import com.neetgames.mcmmo.skill.SkillIdentity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -117,7 +122,7 @@ public class CoreSkills {
* *
* @return a set of all root skills built into mcMMO * @return a set of all root skills built into mcMMO
*/ */
public static @NotNull Set<RootSkill> getImmutableCoreRootSkillSet() { public static @NotNull Set<RootSkill> getCoreSkills() {
return CORE_ROOT_SKILLS; return CORE_ROOT_SKILLS;
} }
@ -162,7 +167,7 @@ public class CoreSkills {
@Deprecated @Deprecated
private static @NotNull Set<RootSkill> generateNonChildSkillSet() { private static @NotNull Set<RootSkill> generateNonChildSkillSet() {
return getImmutableCoreRootSkillSet().stream().filter((x) -> !isChildSkill(x)).collect(Collectors.toSet()); return getCoreSkills().stream().filter((x) -> !isChildSkill(x)).collect(Collectors.toSet());
} }
public static @NotNull Set<RootSkill> getNonChildSkills() { public static @NotNull Set<RootSkill> getNonChildSkills() {

View File

@ -30,6 +30,7 @@ import org.bukkit.Color;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable; import org.bukkit.entity.Tameable;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -179,7 +180,8 @@ public enum PrimarySkillType {
return ExperienceConfig.getInstance().getFormulaSkillModifier(this); return ExperienceConfig.getInstance().getFormulaSkillModifier(this);
} }
public static PrimarySkillType getSkill(String skillName) { @Deprecated
public static @Nullable PrimarySkillType getSkill(String skillName) {
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) { if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
for (PrimarySkillType type : values()) { for (PrimarySkillType type : values()) {
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) { if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) {

View File

@ -1,6 +1,8 @@
package com.gmail.nossr50.datatypes.skills; package com.gmail.nossr50.datatypes.skills;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.text.StringUtils;
import com.neetgames.mcmmo.api.SkillRegister; import com.neetgames.mcmmo.api.SkillRegister;
import com.neetgames.mcmmo.skill.*; import com.neetgames.mcmmo.skill.*;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -143,7 +145,7 @@ public class SkillRegisterImpl implements SkillRegister {
} }
private void registerCoreSkills() { private void registerCoreSkills() {
for(RootSkill rootSkill : CoreSkills.getImmutableCoreRootSkillSet()) { for(RootSkill rootSkill : CoreSkills.getCoreSkills()) {
mcMMO.p.getLogger().info("Registering core skill: "+rootSkill.getSkillName()); mcMMO.p.getLogger().info("Registering core skill: "+rootSkill.getSkillName());
registerSkill(rootSkill); registerSkill(rootSkill);
} }
@ -153,4 +155,29 @@ public class SkillRegisterImpl implements SkillRegister {
public @NotNull Set<RootSkill> getCoreRootSkills() { public @NotNull Set<RootSkill> getCoreRootSkills() {
return coreRootSkills; return coreRootSkills;
} }
/**
* Used to match skill by a "skill name"
* This is NOT case sensitive
*
* Will match against any registered root skill if one of the following is true
* 1) The skills localized name is equal to the provided {@link String skillName}
* 2) The provided {@link String skillName} matches a root skill's fully qualified name
* 3) The provided {@link String skillName} matches the name of the default name of the skill (the en_US not localized name, this name is never overridden by locale)
*
* @param skillName skill name or skill identity
* @return The matching {@link RootSkill} if it exists
* @see SkillIdentity#getFullyQualifiedName()
*/
public @Nullable RootSkill matchRootSkill(@NotNull String skillName) {
for (RootSkill rootSkill : rootSkills) {
if (rootSkill.getSkillIdentity().getFullyQualifiedName().equalsIgnoreCase(skillName)
|| skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(rootSkill.getSkillName()) + ".SkillName"))
|| rootSkill.getSkillName().equalsIgnoreCase(skillName)) {
return rootSkill;
}
}
return null;
}
} }

View File

@ -7,16 +7,18 @@ import org.apache.commons.lang.Validate;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
public class MctopCommandAsyncTask extends BukkitRunnable { public class MctopCommandAsyncTask extends BukkitRunnable {
private final CommandSender sender; private final @NotNull CommandSender sender;
private final RootSkill rootSkill; private final @Nullable RootSkill rootSkill;
private final int page; private final int page;
private final boolean useBoard, useChat; private final boolean useBoard, useChat;
public MctopCommandAsyncTask(int page, RootSkill rootSkill, CommandSender sender, boolean useBoard, boolean useChat) { public MctopCommandAsyncTask(int page, @Nullable RootSkill rootSkill, @NotNull CommandSender sender, boolean useBoard, boolean useChat) {
Validate.isTrue(useBoard || useChat, "Attempted to start a rank retrieval with both board and chat off"); Validate.isTrue(useBoard || useChat, "Attempted to start a rank retrieval with both board and chat off");
Validate.notNull(sender, "Attempted to start a rank retrieval with no recipient"); Validate.notNull(sender, "Attempted to start a rank retrieval with no recipient");

View File

@ -2,14 +2,17 @@ package com.gmail.nossr50.runnables.commands;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.database.PlayerStat; import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager; import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
@ -19,14 +22,14 @@ import java.util.List;
public class MctopCommandDisplayTask extends BukkitRunnable { public class MctopCommandDisplayTask extends BukkitRunnable {
private final List<PlayerStat> userStats; private final List<PlayerStat> userStats;
private final CommandSender sender; private final CommandSender sender;
private final PrimarySkillType skill; private final @Nullable RootSkill rootSkill;
private final int page; private final int page;
private final boolean useBoard, useChat; private final boolean useBoard, useChat;
MctopCommandDisplayTask(List<PlayerStat> userStats, int page, PrimarySkillType skill, CommandSender sender, boolean useBoard, boolean useChat) { MctopCommandDisplayTask(@NotNull List<PlayerStat> userStats, int page, @Nullable RootSkill rootSkill, @NotNull CommandSender sender, boolean useBoard, boolean useChat) {
this.userStats = userStats; this.userStats = userStats;
this.page = page; this.page = page;
this.skill = skill; this.rootSkill = rootSkill;
this.sender = sender; this.sender = sender;
this.useBoard = useBoard; this.useBoard = useBoard;
this.useChat = useChat; this.useChat = useChat;
@ -50,8 +53,7 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
} }
private void displayChat() { private void displayChat() {
if (rootSkill == null) {
if (skill == null) {
if(sender instanceof Player) { if(sender instanceof Player) {
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard")); sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
} }
@ -61,10 +63,10 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
} }
else { else {
if(sender instanceof Player) { if(sender instanceof Player) {
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getName())); sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", rootSkill.getSkillName()));
} }
else { else {
sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.Skill.Leaderboard", skill.getName()))); sender.sendMessage(ChatColor.stripColor(LocaleLoader.getString("Commands.Skill.Leaderboard", rootSkill.getSkillName())));
} }
} }
@ -86,11 +88,11 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
} }
private void displayBoard() { private void displayBoard() {
if (skill == null) { if (rootSkill == null) {
ScoreboardManager.showTopPowerScoreboard((Player) sender, page, userStats); ScoreboardManager.showTopPowerScoreboard((Player) sender, page, userStats);
} }
else { else {
ScoreboardManager.showTopScoreboard((Player) sender, skill, page, userStats); ScoreboardManager.showTopScoreboard((Player) sender, CoreSkills.getSkill(rootSkill), page, userStats);
} }
} }
} }

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.util.experience;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.CoreSkills; import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.ExperienceBarHideTask; import com.gmail.nossr50.runnables.skills.ExperienceBarHideTask;
@ -183,7 +182,7 @@ public class MMOExperienceBarManager {
} }
public static void setBarStateDefaults(@NotNull Map<RootSkill, SkillBossBarState> barStateHashMap) { public static void setBarStateDefaults(@NotNull Map<RootSkill, SkillBossBarState> barStateHashMap) {
for(RootSkill rootSkill : CoreSkills.getImmutableCoreRootSkillSet()) { for(RootSkill rootSkill : CoreSkills.getCoreSkills()) {
if(CoreSkills.isChildSkill(rootSkill)) { if(CoreSkills.isChildSkill(rootSkill)) {
barStateHashMap.put(rootSkill, SkillBossBarState.DISABLED); barStateHashMap.put(rootSkill, SkillBossBarState.DISABLED);

View File

@ -394,7 +394,7 @@ public class ScoreboardManager {
} }
} }
public static void showTopScoreboard(Player player, PrimarySkillType skill, int pageNumber, List<PlayerStat> stats) { public static void showTopScoreboard(@NotNull Player player, @NotNull PrimarySkillType skill, int pageNumber, @NotNull List<PlayerStat> stats) {
ScoreboardWrapper wrapper = getWrapper(player); ScoreboardWrapper wrapper = getWrapper(player);