From 91e7b1587f6a2b4067cf9ca9ac6d3eaf0e39f024 Mon Sep 17 00:00:00 2001 From: gravitylow Date: Wed, 16 Apr 2014 18:35:36 -0400 Subject: [PATCH] Update command player lookups, fixes #3 --- .../java/com/massivecraft/factions/cmd/FCommand.java | 11 ++++++++--- .../zcore/persist/PlayerEntityCollection.java | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/FCommand.java b/src/main/java/com/massivecraft/factions/cmd/FCommand.java index 72b8903b..ca8fe648 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCommand.java @@ -4,6 +4,8 @@ import com.massivecraft.factions.*; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.MCommand; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -203,9 +205,12 @@ public abstract class FCommand extends MCommand

{ // Next we match player names if (faction == null) { - FPlayer fplayer = FPlayers.i.getBestIdMatch(name); - if (fplayer != null) { - faction = fplayer.getFaction(); + OfflinePlayer player = Bukkit.getOfflinePlayer(name); + if (player.getName() != null) { + FPlayer fplayer = FPlayers.i.get(player); + if (fplayer != null) { + faction = fplayer.getFaction(); + } } } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntityCollection.java b/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntityCollection.java index 84d6ac80..3d54982b 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntityCollection.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntityCollection.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.zcore.persist; import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; import org.bukkit.craftbukkit.libs.com.google.gson.Gson; import org.bukkit.entity.Player; @@ -24,7 +25,7 @@ public abstract class PlayerEntityCollection extends EntityCol super(entityClass, entities, id2entity, file, gson, true); } - public E get(Player player) { + public E get(OfflinePlayer player) { return this.get(player.getUniqueId().toString()); }