diff --git a/src/main/gg/frog/mc/permissionstime/PluginMain.java b/src/main/gg/frog/mc/permissionstime/PluginMain.java index ec4ce87..c9d43a8 100644 --- a/src/main/gg/frog/mc/permissionstime/PluginMain.java +++ b/src/main/gg/frog/mc/permissionstime/PluginMain.java @@ -164,6 +164,8 @@ public class PluginMain extends JavaPlugin { public OfflinePlayer getOfflinePlayer(String name) { for (OfflinePlayer p : getServer().getOfflinePlayers()) { + if(p==null) + continue; if (p.getName().equalsIgnoreCase(name)) { return p; } diff --git a/src/main/gg/frog/mc/permissionstime/command/MeCmd.java b/src/main/gg/frog/mc/permissionstime/command/MeCmd.java index b1a7584..e178eee 100644 --- a/src/main/gg/frog/mc/permissionstime/command/MeCmd.java +++ b/src/main/gg/frog/mc/permissionstime/command/MeCmd.java @@ -2,6 +2,7 @@ package gg.frog.mc.permissionstime.command; import java.util.List; +import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -34,9 +35,9 @@ public class MeCmd implements Runnable { if (isPlayer) { if (args.length == 1) { sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING)); - Player p = (Player) sender; + OfflinePlayer p = this.pm.getOfflinePlayer(sender.getName()); List ps = sm.getTime(p.getUniqueId().toString()); - PlayerPermissionShow.show(p, ps); + PlayerPermissionShow.show((Player) sender, ps); } else { sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PARAMETER_MISMATCH)); sender.sendMessage(StrUtil.messageFormat(LangCfg.CMD_ME, pm.PLUGIN_NAME_LOWER_CASE));