Fixed some NPEs

This commit is contained in:
boy0001 2014-10-01 22:35:08 +10:00
parent 97c452e311
commit 49bf3b6694
4 changed files with 10 additions and 6 deletions

View File

@ -99,7 +99,7 @@ public class Info extends SubCommand {
}
private String getPlayerList(ArrayList<UUID> l) {
if ((l == null) || (l.size() < 1)) {
if (l == null || l.size() < 1) {
return " none";
}
String c = C.PLOT_USER_LIST.s();
@ -122,7 +122,7 @@ public class Info extends SubCommand {
return "everyone";
}
OfflinePlayer plr = Bukkit.getOfflinePlayer(uuid);
if (plr == null) {
if (plr.getName() == null) {
return "unknown";
}
return plr.getName();

View File

@ -69,7 +69,7 @@ public class TP extends SubCommand {
private Plot isAlias(World world, String a) {
int index = 0;
if (a.contains(":")) {
if (a.contains(";")) {
String[] split = a.split(";");
if (split[1].length()>0 && StringUtils.isNumeric(split[1])) {
index = Integer.parseInt(split[1]);

View File

@ -97,7 +97,11 @@ public class list extends SubCommand {
if (id == null) {
return "none";
}
return Bukkit.getOfflinePlayer(id).getName();
String name = Bukkit.getOfflinePlayer(id).getName();
if (name == null) {
return "none";
}
return name;
}
private String getArgumentList(String[] strings) {

View File

@ -83,9 +83,9 @@ import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
public class PlayerEvents implements Listener {
private String getName(UUID uuid) {
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
String player = Bukkit.getOfflinePlayer(uuid).getName();
if (player != null) {
return player.getName();
return player;
}
return "unknown";
}