mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-23 18:55:25 +01:00
Fix f who issue with looking up offline players. Fixes issue #8
This commit is contained in:
parent
9a7ecf33a7
commit
28afd6530c
@ -15,10 +15,12 @@ import com.massivecraft.factions.zcore.persist.PlayerEntity;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
/**
|
||||
@ -303,9 +305,8 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
|
||||
if (isOnline()) {
|
||||
return getPlayer().getName();
|
||||
}
|
||||
/*OfflinePlayer player = Bukkit.getOfflinePlayer(UUID.fromString(getId()));
|
||||
return player.getName() != null ? player.getName() : getId();*/
|
||||
return getId();
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(UUID.fromString(getId()));
|
||||
return player.getName() != null ? player.getName() : getId();
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
|
@ -133,6 +133,7 @@ public class Factions extends EntityCollection<Faction> {
|
||||
return errors;
|
||||
}
|
||||
|
||||
// Loops through all faction tags. Case and color insensitive.
|
||||
public Faction getByTag(String str) {
|
||||
String compStr = MiscUtil.getComparisonString(str);
|
||||
for (Faction faction : this.get()) {
|
||||
|
@ -185,7 +185,7 @@ public abstract class FCommand extends MCommand<P> {
|
||||
|
||||
// First we try an exact match
|
||||
if (faction == null) {
|
||||
faction = Factions.i.getByTag(name);
|
||||
faction = Factions.i.getByTag(name); // Checks for faction name match.
|
||||
}
|
||||
|
||||
// Next we match faction tags
|
||||
@ -196,11 +196,9 @@ public abstract class FCommand extends MCommand<P> {
|
||||
// Next we match player names
|
||||
if (faction == null) {
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(name);
|
||||
if (player.hasPlayedBefore()) {
|
||||
FPlayer fplayer = FPlayers.i.get(player);
|
||||
if (fplayer != null) {
|
||||
faction = fplayer.getFaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user