mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-10-06 11:38:13 +02:00
balancetop only braodcasts to the issuer now, fix messages, remove util sortingmethods
This commit is contained in:
parent
3898970bba
commit
cd4c58cfcb
@ -472,4 +472,14 @@ public class Util
|
||||
}));
|
||||
return keys;
|
||||
}
|
||||
|
||||
public static List<Object> getKeysFromValue(Map<?, ?> map, Object value){
|
||||
List <Object>list = new ArrayList<Object>();
|
||||
for(Object o:map.keySet()){
|
||||
if(map.get(o).equals(value)) {
|
||||
list.add(o);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,12 @@ package com.earth2me.essentials.commands;
|
||||
import org.bukkit.Server;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -35,26 +38,20 @@ public class Commandbalancetop extends EssentialsCommand
|
||||
//catch it because they tried to enter a string not number.
|
||||
}
|
||||
}
|
||||
HashMap<User, Double> balances = new HashMap<User, Double>();
|
||||
Map<Double, User> balances = new TreeMap<Double, User>(Collections.reverseOrder());
|
||||
for (Map.Entry<String, User> u : ess.getAllUsers().entrySet())
|
||||
{
|
||||
balances.put(u.getValue(), u.getValue().getMoney());
|
||||
balances.put(u.getValue().getMoney(), u.getValue());
|
||||
}
|
||||
int count = 0;
|
||||
server.broadcastMessage(Util.format("balanceTop", max));
|
||||
for (Iterator i = Util.sortMapByValueDesc(balances).iterator(); i.hasNext();)
|
||||
sender.sendMessage(Util.format("balanceTop", max));
|
||||
for (Map.Entry<Double, User> ba : balances.entrySet())
|
||||
{
|
||||
if (count == max)
|
||||
{
|
||||
break;
|
||||
}
|
||||
User key = (User)i.next();
|
||||
|
||||
server.broadcastMessage(key.getDisplayName() + ", " + Util.formatCurrency(balances.get(key)));
|
||||
if(!(sender instanceof Player))
|
||||
{
|
||||
sender.sendMessage(key.getDisplayName() + ", " + Util.formatCurrency(balances.get(key)));
|
||||
}
|
||||
sender.sendMessage(ba.getValue().getDisplayName() + ", " + Util.formatCurrency(ba.getKey()));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ backUsageMsg = \u00a77Returning to previous location.
|
||||
backupFinished = Backup finished
|
||||
backupStarted = Backup started
|
||||
balance = \u00a77Balance: {0}
|
||||
balanceTop = $7 Top {0} balances
|
||||
balanceTop = \u00a77 Top {0} balances
|
||||
banIpAddress = \u00a77Banned IP address
|
||||
bannedIpsFileError = Error reading banned-ips.txt
|
||||
bannedIpsFileNotFound = banned-ips.txt not found
|
||||
|
@ -14,7 +14,7 @@ backUsageMsg = \u00a77Returnere til tidligere placering.
|
||||
backupFinished = Backup sluttede
|
||||
backupStarted = Backup startede
|
||||
balance = \u00a77Balance: {0}
|
||||
balanceTop = $7 Top {0} saldi
|
||||
balanceTop = \u00a77 Top {0} saldi
|
||||
banIpAddress = \u00a77Bannede IP addresse
|
||||
bannedIpsFileError = Fejl i l\u00e6sning af banned-ips.txt
|
||||
bannedIpsFileNotFound = banned-ips.txt ikke fundet
|
||||
|
@ -12,7 +12,7 @@ backUsageMsg = \u00a77Kehre zur letzten Position zur\u00fcck.
|
||||
backupFinished = Backup beendet
|
||||
backupStarted = Backup gestartet
|
||||
balance = \u00a77Geldb\u00f6rse: {0}
|
||||
balanceTop = $7 Top {0} Guthaben
|
||||
balanceTop = \u00a77 Top {0} Guthaben
|
||||
banIpAddress = \u00a77IP-Adresse gesperrt.
|
||||
bannedIpsFileError = Fehler beim Lesen von banned-ips.txt
|
||||
bannedIpsFileNotFound = banned-ips.txt nicht gefunden
|
||||
|
@ -12,7 +12,7 @@ backUsageMsg = \u00a77Returning to previous location.
|
||||
backupFinished = Backup finished
|
||||
backupStarted = Backup started
|
||||
balance = \u00a77Balance: {0}
|
||||
balanceTop = $7 Top {0} balances
|
||||
balanceTop = \u00a77 Top {0} balances
|
||||
banIpAddress = \u00a77Banned IP address
|
||||
bannedIpsFileError = Error reading banned-ips.txt
|
||||
bannedIpsFileNotFound = banned-ips.txt not found
|
||||
|
@ -12,7 +12,7 @@ backUsageMsg = \u00a77Retour a votre emplacement pr\u00e9c\u00e8dent.
|
||||
backupFinished = Backup termin\u00e9
|
||||
backupStarted = D\u00e9but du backup
|
||||
balance = \u00a77Solde: {0}
|
||||
balanceTop = $7 Top {0} soldes
|
||||
balanceTop = \u00a77 Top {0} soldes
|
||||
banIpAddress = \u00a77Adresse IP banni
|
||||
bannedIpsFileError = Erreur de lecture de banned-ips.txt
|
||||
bannedIpsFileNotFound = Fichier banned-ips.txt introuvable
|
||||
|
@ -13,7 +13,7 @@ backUsageMsg = \u00a77Bezig met terugkeren naar vorige locatie.
|
||||
backupFinished = Backup voltooid
|
||||
backupStarted = Backup wordt nu gemaakt
|
||||
balance = \u00a77Saldo: {0}
|
||||
balanceTop = $7 Top {0} saldi
|
||||
balanceTop = \u00a77 Top {0} saldi
|
||||
banIpAddress = \u00a77Verboden IP-adres
|
||||
bannedIpsFileError = Fout bij het lezen van banned-ips.txt
|
||||
bannedIpsFileNotFound = banned-ips.txt werd niet gevonden
|
||||
|
Loading…
Reference in New Issue
Block a user