Archiviert
1
0
Dieser Commit ist enthalten in:
zOnlyKroks 2021-12-31 22:21:25 +01:00
Ursprung 87db052478
Commit 7220051c18

Datei anzeigen

@ -23,8 +23,11 @@ import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.sql.SteamwarUser; import de.steamwar.bungeecore.sql.SteamwarUser;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import org.apache.commons.lang3.LocaleUtils;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
public class PlaytimeCommand extends BasicCommand{ public class PlaytimeCommand extends BasicCommand{
@ -37,9 +40,10 @@ public class PlaytimeCommand extends BasicCommand{
if(!(sender instanceof ProxiedPlayer)) if(!(sender instanceof ProxiedPlayer))
return; return;
String s = Message.parse("DECIMAL_FORMAT", sender); NumberFormat format = NumberFormat.getNumberInstance(LocaleUtils.toLocale(Message.parse("DECIMAL_FORMAT", sender)));
String format = new DecimalFormat(s).format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); format.setMaximumFractionDigits(2);
String formattedText = format.format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600));
Message.send(Message.parse("HOURS_PLAYED", sender) + format,sender); Message.send(Message.parse("HOURS_PLAYED", sender) + formattedText,sender);
} }
} }