From 69aead58a7e1fa431fa2b8b1295aae1c2d55964d Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 13 Jun 2013 12:36:49 -0400 Subject: [PATCH] Using getPlayerExact is faster. --- .../com/gmail/nossr50/commands/party/PartyInfoCommand.java | 5 ++--- .../java/com/gmail/nossr50/listeners/EntityListener.java | 4 ++-- .../nossr50/runnables/commands/McrankCommandDisplayTask.java | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyInfoCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyInfoCommand.java index 48e098a16..2f01d67ea 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyInfoCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyInfoCommand.java @@ -1,7 +1,6 @@ package com.gmail.nossr50.commands.party; import org.bukkit.ChatColor; -import org.bukkit.OfflinePlayer; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -43,12 +42,12 @@ public class PartyInfoCommand implements CommandExecutor { StringBuilder memberList = new StringBuilder(); for (String memberName : playerParty.getMembers()) { - OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberName); + Player member = mcMMO.p.getServer().getPlayerExact(memberName); if (playerParty.getLeader().equalsIgnoreCase(memberName)) { memberList.append(ChatColor.GOLD); } - else if (member.isOnline()) { + else if (member != null) { memberList.append(ChatColor.WHITE); } else { diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 73790d148..45cd523f8 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -403,7 +403,7 @@ public class EntityListener implements Listener { } // We can make this assumption because we (should) be the only ones using this exact metadata - Player player = plugin.getServer().getPlayer(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString()); + Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString()); if (Misc.isNPCEntity(player)) { return; @@ -430,7 +430,7 @@ public class EntityListener implements Listener { } // We can make this assumption because we (should) be the only ones using this exact metadata - Player player = plugin.getServer().getPlayer(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString()); + Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString()); if (Misc.isNPCEntity(player)) { return; diff --git a/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandDisplayTask.java b/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandDisplayTask.java index f86752918..4f0343e52 100644 --- a/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandDisplayTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/commands/McrankCommandDisplayTask.java @@ -25,7 +25,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable { @Override public void run() { - Player player = mcMMO.p.getServer().getPlayer(playerName); + Player player = mcMMO.p.getServer().getPlayerExact(playerName); Integer rank; sender.sendMessage(LocaleLoader.getString("Commands.mcrank.Heading"));