From 11330ece35567c17dab7a6c67a46abfb9499c860 Mon Sep 17 00:00:00 2001 From: GeekFrog Date: Wed, 18 Apr 2018 20:54:37 +0800 Subject: [PATCH] =?UTF-8?q?2652146617=20=E6=8F=90=E4=BA=A4=E7=9A=84BUG?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E4=BA=86op=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=9D=83=E9=99=90=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/gg/frog/mc/permissionstime/PluginMain.java | 2 ++ src/main/gg/frog/mc/permissionstime/command/MeCmd.java | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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));