Fixed stuff and removed support for offline players because #19

This commit is contained in:
Norbi Peti 2016-04-24 20:12:48 +02:00
parent 7b3edfd0cf
commit daa341ff7d
3 changed files with 9 additions and 3 deletions

Binary file not shown.

View file

@ -154,7 +154,7 @@ public class Commands implements CommandExecutor {
MaybeOfflinePlayer mp = MaybeOfflinePlayer
.GetFromName(args[1]);
if (mp == null) {
player.sendMessage("§cUnknown user: " + args[1]);
player.sendMessage("§cUnknown user (player has to be online): " + args[1]);
break;
}
player.sendMessage("§bUsername of " + args[1] + ": "
@ -443,7 +443,7 @@ public class Commands implements CommandExecutor {
}
MaybeOfflinePlayer p = MaybeOfflinePlayer.GetFromName(args[2]);
if (p == null) {
String message = "§cPlayer not found: " + args[2] + "§r";
String message = "§cPlayer not found: " + args[2] + " - Currently only online players can be viewed§r";
SendMessage(player, message);
return;
}

View file

@ -61,6 +61,8 @@ public class MaybeOfflinePlayer {
String tmp = cs2.getString("flairtime");
if (tmp.equals("--"))
mp.FlairTime = FlairTimeNonPresser;
else if (tmp.equals("??"))
mp.FlairTime = FlairTimeCantPress;
else if (tmp.length() > 0)
mp.FlairTime = Short.parseShort(tmp);
String flairstate = cs2.getString("flairstate");
@ -93,7 +95,11 @@ public class MaybeOfflinePlayer {
}
public static MaybeOfflinePlayer GetFromName(String name) {
return AllPlayers.get(Bukkit.getPlayer(name).getUniqueId());
Player p = Bukkit.getPlayer(name);
if (p != null)
return AllPlayers.get(p.getUniqueId());
else
return null;
}
public String GetFormattedFlair() {