mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
Removed some deprec(i)ated calls to Users.getProfile()
This commit is contained in:
parent
56617a1c1c
commit
ef775f1c24
@ -8,7 +8,6 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.utilities.SkillTools;
|
||||
import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public final class CommandHelper {
|
||||
private CommandHelper() {}
|
||||
@ -55,17 +54,11 @@ public final class CommandHelper {
|
||||
* Print out details on Gathering skills. Only for online players.
|
||||
*
|
||||
* @param inspect The player to retrieve stats for
|
||||
* @param profile The player's profile
|
||||
* @param display The sender to display stats to
|
||||
*/
|
||||
public static void printGatheringSkills(Player inspect, CommandSender display) {
|
||||
public static void printGatheringSkills(Player inspect, PlayerProfile profile, CommandSender display) {
|
||||
if (SkillTools.hasGatheringSkills(inspect)) {
|
||||
PlayerProfile profile = Users.getProfile(inspect);
|
||||
|
||||
if (profile == null) {
|
||||
display.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return;
|
||||
}
|
||||
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
|
||||
if (Permissions.excavation(inspect)) {
|
||||
@ -90,25 +83,19 @@ public final class CommandHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static void printGatheringSkills(Player player) {
|
||||
printGatheringSkills(player, player);
|
||||
public static void printGatheringSkills(Player player, PlayerProfile profile) {
|
||||
printGatheringSkills(player, profile, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print out details on Combat skills. Only for online players.
|
||||
*
|
||||
* @param inspect The player to retrieve stats for
|
||||
* @param profile The player's profile
|
||||
* @param display The sender to display stats to
|
||||
*/
|
||||
public static void printCombatSkills(Player inspect, CommandSender display) {
|
||||
public static void printCombatSkills(Player inspect, PlayerProfile profile, CommandSender display) {
|
||||
if (SkillTools.hasCombatSkills(inspect)) {
|
||||
PlayerProfile profile = Users.getProfile(inspect);
|
||||
|
||||
if (profile == null) {
|
||||
display.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return;
|
||||
}
|
||||
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
|
||||
if (Permissions.axes(inspect)) {
|
||||
@ -133,25 +120,19 @@ public final class CommandHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static void printCombatSkills(Player player) {
|
||||
printCombatSkills(player, player);
|
||||
public static void printCombatSkills(Player player, PlayerProfile profile) {
|
||||
printCombatSkills(player, profile, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print out details on Misc skills. Only for online players.
|
||||
*
|
||||
* @param inspect The player to retrieve stats for
|
||||
* @param profile The player's profile
|
||||
* @param display The sender to display stats to
|
||||
*/
|
||||
public static void printMiscSkills(Player inspect, CommandSender display) {
|
||||
public static void printMiscSkills(Player inspect, PlayerProfile profile, CommandSender display) {
|
||||
if (SkillTools.hasMiscSkills(inspect)) {
|
||||
PlayerProfile profile = Users.getProfile(inspect);
|
||||
|
||||
if (profile == null) {
|
||||
display.sendMessage(LocaleLoader.getString("Commands.DoesNotExist"));
|
||||
return;
|
||||
}
|
||||
|
||||
display.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
|
||||
if (Permissions.acrobatics(inspect)) {
|
||||
@ -164,7 +145,7 @@ public final class CommandHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static void printMiscSkills(Player player) {
|
||||
printMiscSkills(player, player);
|
||||
public static void printMiscSkills(Player player, PlayerProfile profile) {
|
||||
printMiscSkills(player, profile, player);
|
||||
}
|
||||
}
|
||||
|
@ -35,10 +35,12 @@ public class InspectCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
PlayerProfile profile = mcmmoPlayer.getProfile();
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Stats", new Object[] { target.getName() }));
|
||||
CommandHelper.printGatheringSkills(target, sender);
|
||||
CommandHelper.printCombatSkills(target, sender);
|
||||
CommandHelper.printMiscSkills(target, sender);
|
||||
CommandHelper.printGatheringSkills(target, profile, sender);
|
||||
CommandHelper.printCombatSkills(target, profile, sender);
|
||||
CommandHelper.printMiscSkills(target, profile, sender);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel", new Object[] { mcmmoPlayer.getPowerLevel() }));
|
||||
|
||||
return true;
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@ -22,20 +23,23 @@ public class McstatsCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile profile = Users.getPlayer(player).getProfile();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Stats.Own.Stats"));
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
|
||||
|
||||
CommandHelper.printGatheringSkills(player);
|
||||
CommandHelper.printCombatSkills(player);
|
||||
CommandHelper.printMiscSkills(player);
|
||||
CommandHelper.printGatheringSkills(player, profile);
|
||||
CommandHelper.printCombatSkills(player, profile);
|
||||
CommandHelper.printMiscSkills(player, profile);
|
||||
|
||||
int powerLevelCap = Config.getInstance().getPowerLevelCap();
|
||||
|
||||
if (powerLevelCap > 0)
|
||||
if (powerLevelCap > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", new Object[] { String.valueOf(Users.getPlayer(player).getPowerLevel()), String.valueOf(powerLevelCap) }));
|
||||
else
|
||||
}
|
||||
else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", new Object[] { String.valueOf(Users.getPlayer(player).getPowerLevel()) }));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -122,6 +122,6 @@ public final class Users {
|
||||
* @return the player's McMMOPlayer object
|
||||
*/
|
||||
public static McMMOPlayer getPlayer(Player player) {
|
||||
return getPlayer(player.getName());
|
||||
return players.get(player.getName());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user