mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Don't throw a warning if we're expecting a null object.
This commit is contained in:
parent
51bf989418
commit
2bae937b28
@ -67,7 +67,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
String playerName = Misc.getMatchedPlayerName(args[0]);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
|
||||
|
||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
if (mcMMOPlayer == null) {
|
||||
|
@ -58,7 +58,7 @@ public class SkillresetCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
String playerName = Misc.getMatchedPlayerName(args[0]);
|
||||
mcMMOPlayer = UserManager.getPlayer(playerName);
|
||||
mcMMOPlayer = UserManager.getPlayer(playerName, true);
|
||||
|
||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
if (mcMMOPlayer == null) {
|
||||
|
@ -34,7 +34,7 @@ public class InspectCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
String playerName = Misc.getMatchedPlayerName(args[0]);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
|
||||
|
||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
if (mcMMOPlayer == null) {
|
||||
|
@ -52,7 +52,7 @@ public class McrankCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
String playerName = Misc.getMatchedPlayerName(args[0]);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(playerName, true);
|
||||
|
||||
if (mcMMOPlayer != null) {
|
||||
playerName = mcMMOPlayer.getPlayer().getName();
|
||||
|
@ -77,7 +77,7 @@ public final class UserManager {
|
||||
* @return the player's McMMOPlayer object
|
||||
*/
|
||||
public static McMMOPlayer getPlayer(String playerName) {
|
||||
return retrieveMcMMOPlayer(playerName);
|
||||
return retrieveMcMMOPlayer(playerName, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,17 +87,24 @@ public final class UserManager {
|
||||
* @return the player's McMMOPlayer object
|
||||
*/
|
||||
public static McMMOPlayer getPlayer(OfflinePlayer player) {
|
||||
return retrieveMcMMOPlayer(player.getName());
|
||||
return retrieveMcMMOPlayer(player.getName(), false);
|
||||
}
|
||||
|
||||
private static McMMOPlayer retrieveMcMMOPlayer(String playerName) {
|
||||
public static McMMOPlayer getPlayer(String playerName, boolean offlineValid) {
|
||||
return retrieveMcMMOPlayer(playerName, offlineValid);
|
||||
}
|
||||
|
||||
private static McMMOPlayer retrieveMcMMOPlayer(String playerName, boolean offlineValid) {
|
||||
McMMOPlayer mcMMOPlayer = players.get(playerName);
|
||||
|
||||
if (mcMMOPlayer == null) {
|
||||
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
||||
|
||||
if (player == null) {
|
||||
mcMMO.p.getLogger().warning("A valid mcMMOPlayer object could not be found for " + playerName + ".");
|
||||
if (!offlineValid) {
|
||||
mcMMO.p.getLogger().warning("A valid mcMMOPlayer object could not be found for " + playerName + ".");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user