public static String Rank3()
{
int primeiro = 0;
int segundo = 0;
int terceiro = 0;
String nome1 = null;
String nome2 = null;
String nome3 = null;
for(Player p :Bukkit.getOfflinePlayers())
{
if(getConfig().contains(p.getName() + ".Quantidade"))
{
int valor = getConfig().getInt(p.getName() + ".Quantidade");
if(valor > primeiro)
{
primeiro = valor;
nome1 = p.getName();
}
if(valor > segundo)
{
segundo = valor;
nome2 = p.getName();
}
if(valor > terceiro)
{
terceiro = valor;
nome3 = p.getName();
}
}
}
return nome1 + " = " + primeiro + "\n"
+ nome2 + " = " + segundo + "\n"
+ nome3 + " = " + terceiro;
}
Sou + SQLite.
@Edit usa Bukkit.getOfflinePlayers()
E troca para OfflinePlayer
@Edit 2
Ou tenta assim, malz se escrevi algo errado.
da load da confi adcionando tudo em uma hashmap para ficar mais facil
static List<String> accountPlayer = getConfig().getStringList("Money");
static HashMap<String, Integer> moneyPlayer = new HashMap<String, Integer>();
public static void LoadFileArrays()
{
for(String s : accountPlayer)
{
int i = getConfig().getInt("Money." + s);
moneyPlayer.put(s, i);
}
}
e dps percorre e verifica os maior, logico tudo precisa esta em uma lista
public static String Rank()
{
int primeiro = 0;
int segundo = 0;
int terceiro = 0;
String nome1 = null;
String nome2 = null;
String nome3 = null;
for(Entry<String, Integer> e : moneyPlayer.entrySet())
{
int valor = e.getValue();
if(valor > primeiro)
{
primeiro = valor;
nome1 = e.getKey();
}
if(valor > segundo)
{
segundo = valor;
nome2 = e.getKey();
}
if(valor > terceiro)
{
terceiro = valor;
nome3 = e.getKey();
}
}
return nome1 + " = " + primeiro + "\n"
+ nome2 + " = " + segundo + "\n"
+ nome3 + " = " + terceiro;
}