Update command player lookups, fixes #3

This commit is contained in:
gravitylow 2014-04-16 18:35:36 -04:00
parent 751c2037e4
commit 91e7b1587f
2 changed files with 10 additions and 4 deletions

View File

@ -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,11 +205,14 @@ public abstract class FCommand extends MCommand<P> {
// Next we match player names
if (faction == null) {
FPlayer fplayer = FPlayers.i.getBestIdMatch(name);
OfflinePlayer player = Bukkit.getOfflinePlayer(name);
if (player.getName() != null) {
FPlayer fplayer = FPlayers.i.get(player);
if (fplayer != null) {
faction = fplayer.getFaction();
}
}
}
if (faction != null) {
ret = faction;

View File

@ -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<E extends Entity> 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());
}