为什么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;
}
答案 0 :(得分:0)
根据PlayerList.Entry
循环中提到的for
判断,PlayerList
可能实现java.util.Map
,这意味着要迭代它应该被调用的条目:
for(PlayerList.Entry localEntry : localPlayerList.entrySet())