Eclipse类文件错误 - localPlayerList

时间:2014-03-17 18:40:41

标签: java eclipse plugins minecraft bukkit

为什么localPlayerList会给我一个错误?谢谢(我的错误是用 localPlayerList

签名的
public OfflinePlayer findPlayer(String paramString)
{
    Object localObject = this.plugin.getServer().getOfflinePlayer(paramString);
    if(!((OfflinePlayer) localObject).hasPlayedBefore())
    {
        localObject = this.plugin.getServer().getPlayer(paramString);
    }
    if(localObject == null)
    {
        PlayerList localPlayerList = this.plugin.getPlayerList(true);
        for(PlayerList.Entry localEntry : localPlayerList)
        {
            String str = paramString.toLowerCase();
            if(localEntry.name.toLowerCase().startsWith(str))
            {
                localObject = this.plugin.getServer().getOfflinePlayer(localEntry.name);
                break;
            }
        }
    }
    return (OfflinePlayer) localObject;
}

1 个答案:

答案 0 :(得分:0)

根据PlayerList.Entry循环中提到的for判断,PlayerList可能实现java.util.Map,这意味着要迭代它应该被调用的条目:

for(PlayerList.Entry localEntry : localPlayerList.entrySet())