From d72c8e612f9164d5d8538eb0e13b1aef40b46996 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Fri, 24 Dec 2021 11:16:29 +0100 Subject: [PATCH 01/20] Command implementation --- src/de/steamwar/bungeecore/BungeeCore.java | 1 + .../bungeecore/commands/PlaytimeCommand.java | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/de/steamwar/bungeecore/commands/PlaytimeCommand.java diff --git a/src/de/steamwar/bungeecore/BungeeCore.java b/src/de/steamwar/bungeecore/BungeeCore.java index 72da98a..fdc019e 100644 --- a/src/de/steamwar/bungeecore/BungeeCore.java +++ b/src/de/steamwar/bungeecore/BungeeCore.java @@ -129,6 +129,7 @@ public class BungeeCore extends Plugin { new StatCommand(); new VerifyCommand(); new GDPRQuery(); + new PlaytimeCommand(); // Punishment Commands: new PunishmentCommand("ban", Punishment.PunishmentType.Ban); diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java new file mode 100644 index 0000000..003f3dc --- /dev/null +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -0,0 +1,21 @@ +package de.steamwar.bungeecore.commands; + +import de.steamwar.bungeecore.Message; +import de.steamwar.bungeecore.sql.SteamwarUser; +import net.md_5.bungee.api.CommandSender; +import net.md_5.bungee.api.connection.ProxiedPlayer; + +import java.text.DecimalFormat; + +public class PlaytimeCommand extends BasicCommand{ + + public PlaytimeCommand() { + super("playtime", null); + } + + @Override public void execute(CommandSender sender, String[] strings) { + ProxiedPlayer player = (ProxiedPlayer) sender; + SteamwarUser user = SteamwarUser.get(player); + Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600)); + } +} From 9b487e929c43090256977e3b431c4964f3e784f1 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Fri, 24 Dec 2021 17:16:01 +0100 Subject: [PATCH 02/20] Fixes --- .../bungeecore/commands/PlaytimeCommand.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 003f3dc..47b96a8 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -1,3 +1,22 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.Message; @@ -13,7 +32,10 @@ public class PlaytimeCommand extends BasicCommand{ super("playtime", null); } - @Override public void execute(CommandSender sender, String[] strings) { + @Override + public void execute(CommandSender sender, String[] strings) { + if(!(sender instanceof ProxiedPlayer)) + return; ProxiedPlayer player = (ProxiedPlayer) sender; SteamwarUser user = SteamwarUser.get(player); Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600)); From 28f96c1708c6e95344a0e4443469d449c21527e6 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Fri, 24 Dec 2021 17:29:41 +0100 Subject: [PATCH 03/20] Formatting --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 5 ++++- src/de/steamwar/messages/BungeeCore.properties | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 47b96a8..9cce3fb 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -34,10 +34,13 @@ public class PlaytimeCommand extends BasicCommand{ @Override public void execute(CommandSender sender, String[] strings) { + if(!(sender instanceof ProxiedPlayer)) return; + ProxiedPlayer player = (ProxiedPlayer) sender; SteamwarUser user = SteamwarUser.get(player); - Message.send("WHOIS_HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600)); + Message.send("HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600)); } + } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 9e232f9..fbfb85f 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -557,4 +557,7 @@ GDPR_STATUS_WORLD=§7Packe Bauwelten... GDPR_STATUS_INVENTORIES=§7Suche und packe Inventare... GDPR_STATUS_DATABASE=§7Packe Datenbankinhalte... GDPR_STATUS_LOGS=§7Suche und packe logs... -GDPR_STATUS_FINISHED=§7Packen abgeschlossen \ No newline at end of file +GDPR_STATUS_FINISHED=§7Packen abgeschlossen + +#Playtime Command +HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h \ No newline at end of file From 896ea6b6d4121f4aa9c941fdb3b9e42dca5985af Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Fri, 24 Dec 2021 17:35:17 +0100 Subject: [PATCH 04/20] Formatting --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 9cce3fb..9e17309 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -34,13 +34,10 @@ public class PlaytimeCommand extends BasicCommand{ @Override public void execute(CommandSender sender, String[] strings) { - if(!(sender instanceof ProxiedPlayer)) return; - ProxiedPlayer player = (ProxiedPlayer) sender; - SteamwarUser user = SteamwarUser.get(player); - Message.send("HOURS_PLAYED", player, new DecimalFormat("###.##").format(user.getOnlinetime() / (double) 3600)); + Message.send("HOURS_PLAYED", sender, new DecimalFormat("###.##").format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); } } From 86e9c17d732dd54ab1124e79da09605519cbfcc1 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Fri, 24 Dec 2021 17:36:22 +0100 Subject: [PATCH 05/20] Yoyo ist nen formatting freak --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 9e17309..7e40f9f 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -39,5 +39,4 @@ public class PlaytimeCommand extends BasicCommand{ Message.send("HOURS_PLAYED", sender, new DecimalFormat("###.##").format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); } - } From 6b0fb7ca6f935871c05ba62f2b4877144f5cb329 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Fri, 24 Dec 2021 17:37:53 +0100 Subject: [PATCH 06/20] ) --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 7e40f9f..468fae8 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -37,6 +37,6 @@ public class PlaytimeCommand extends BasicCommand{ if(!(sender instanceof ProxiedPlayer)) return; - Message.send("HOURS_PLAYED", sender, new DecimalFormat("###.##").format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); + Message.send("HOURS_PLAYED", sender, new DecimalFormat("###.##").format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600))); } } From 803b591ff4e0ef114c60e62053c0346fcef4f08a Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 09:29:55 +0100 Subject: [PATCH 07/20] Format --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 468fae8..e570db1 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -25,6 +25,9 @@ import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.text.DecimalFormat; +import java.text.Format; +import java.text.NumberFormat; +import java.util.Locale; public class PlaytimeCommand extends BasicCommand{ @@ -37,6 +40,10 @@ public class PlaytimeCommand extends BasicCommand{ if(!(sender instanceof ProxiedPlayer)) return; - Message.send("HOURS_PLAYED", sender, new DecimalFormat("###.##").format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600))); + NumberFormat format = NumberFormat.getNumberInstance(Locale.GERMAN); + format.setMaximumFractionDigits(2); + format.format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); + + Message.send("HOURS_PLAYED", sender, format); } } From 73321e4b7e46bcb38c57875bab63196d75913795 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 10:11:39 +0100 Subject: [PATCH 08/20] Format --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 5 ++--- src/de/steamwar/messages/BungeeCore.properties | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index e570db1..5b39ca8 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -40,9 +40,8 @@ public class PlaytimeCommand extends BasicCommand{ if(!(sender instanceof ProxiedPlayer)) return; - NumberFormat format = NumberFormat.getNumberInstance(Locale.GERMAN); - format.setMaximumFractionDigits(2); - format.format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); + String s = Message.parse("TIME_FORMAT", sender); + String format = new DecimalFormat(s).format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); Message.send("HOURS_PLAYED", sender, format); } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index fbfb85f..48b8f97 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -560,4 +560,7 @@ GDPR_STATUS_LOGS=§7Suche und packe logs... GDPR_STATUS_FINISHED=§7Packen abgeschlossen #Playtime Command -HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h \ No newline at end of file +HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h + +#Player +TIME_FORMAT=hh:mm:ss \ No newline at end of file From 981be71d4ebdcb62cdb3ceefb044f459685d035d Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 10:15:24 +0100 Subject: [PATCH 09/20] Format --- src/de/steamwar/messages/BungeeCore.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 48b8f97..7dac936 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -563,4 +563,4 @@ GDPR_STATUS_FINISHED=§7Packen abgeschlossen HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h #Player -TIME_FORMAT=hh:mm:ss \ No newline at end of file +TIME_FORMAT='###,##' \ No newline at end of file From 591395c64c0788d93843551a33a271b885b953fe Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 10:16:58 +0100 Subject: [PATCH 10/20] Format --- src/de/steamwar/messages/BungeeCore.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 7dac936..b55dce6 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -563,4 +563,4 @@ GDPR_STATUS_FINISHED=§7Packen abgeschlossen HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h #Player -TIME_FORMAT='###,##' \ No newline at end of file +DECIMAL_FORMAT='###,##' \ No newline at end of file From f1c85771a7668444141d31619b7f1698ed4ebd18 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 10:17:09 +0100 Subject: [PATCH 11/20] Format --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 5b39ca8..83805a5 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -43,6 +43,6 @@ public class PlaytimeCommand extends BasicCommand{ String s = Message.parse("TIME_FORMAT", sender); String format = new DecimalFormat(s).format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); - Message.send("HOURS_PLAYED", sender, format); + Message.send("DECIMAL_FORMAT", sender, format); } } From 1815c986d588901ea623936fb5388c288e89dd6f Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 10:17:25 +0100 Subject: [PATCH 12/20] Format --- src/de/steamwar/messages/BungeeCore.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index b55dce6..8c9c1fc 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -563,4 +563,4 @@ GDPR_STATUS_FINISHED=§7Packen abgeschlossen HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h #Player -DECIMAL_FORMAT='###,##' \ No newline at end of file +DECIMAL_FORMAT=###,## \ No newline at end of file From 94fe11933048416fade1f7968e34ea126a4de883 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 10:19:53 +0100 Subject: [PATCH 13/20] Format --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 83805a5..862515c 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -25,9 +25,6 @@ import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; import java.text.DecimalFormat; -import java.text.Format; -import java.text.NumberFormat; -import java.util.Locale; public class PlaytimeCommand extends BasicCommand{ @@ -43,6 +40,6 @@ public class PlaytimeCommand extends BasicCommand{ String s = Message.parse("TIME_FORMAT", sender); String format = new DecimalFormat(s).format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); - Message.send("DECIMAL_FORMAT", sender, format); + Message.send(format,sender); } } From 071e88966e78bd65366612839672d1909ecafd71 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 10:23:58 +0100 Subject: [PATCH 14/20] Format --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 862515c..8a0eee3 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -40,6 +40,6 @@ public class PlaytimeCommand extends BasicCommand{ String s = Message.parse("TIME_FORMAT", sender); String format = new DecimalFormat(s).format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); - Message.send(format,sender); + Message.send(Message.parse("HOURS_PLAYED", sender) + format,sender); } } From 858e657974b5d4c5161125f4de16a1b89b2e729a Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 10:30:15 +0100 Subject: [PATCH 15/20] Format --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 2 +- src/de/steamwar/messages/BungeeCore.properties | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 8a0eee3..0aaca7c 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -37,7 +37,7 @@ public class PlaytimeCommand extends BasicCommand{ if(!(sender instanceof ProxiedPlayer)) return; - String s = Message.parse("TIME_FORMAT", sender); + String s = Message.parse("DECIMAL_FORMAT", sender); String format = new DecimalFormat(s).format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); Message.send(Message.parse("HOURS_PLAYED", sender) + format,sender); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 8c9c1fc..77a720a 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -561,6 +561,4 @@ GDPR_STATUS_FINISHED=§7Packen abgeschlossen #Playtime Command HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h - -#Player DECIMAL_FORMAT=###,## \ No newline at end of file From 1cfa6359e8c7dbae8ac7890ac7d8e1b48152c40e Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 10:38:05 +0100 Subject: [PATCH 16/20] Formatting --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 0aaca7c..f705790 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -34,6 +34,7 @@ public class PlaytimeCommand extends BasicCommand{ @Override public void execute(CommandSender sender, String[] strings) { + if(!(sender instanceof ProxiedPlayer)) return; From 87db052478df9213c72dc5e264b3f0249ca3f46a Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Wed, 29 Dec 2021 10:42:38 +0100 Subject: [PATCH 17/20] =?UTF-8?q?Yoyo=20gl=C3=BCcklich=20machen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index f705790..0aaca7c 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -34,7 +34,6 @@ public class PlaytimeCommand extends BasicCommand{ @Override public void execute(CommandSender sender, String[] strings) { - if(!(sender instanceof ProxiedPlayer)) return; From 7220051c18aff0e180730a46040cf9702d7d8764 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Fri, 31 Dec 2021 22:21:25 +0100 Subject: [PATCH 18/20] Rework --- .../steamwar/bungeecore/commands/PlaytimeCommand.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 0aaca7c..c5ff347 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -23,8 +23,11 @@ import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.connection.ProxiedPlayer; +import org.apache.commons.lang3.LocaleUtils; import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.Locale; public class PlaytimeCommand extends BasicCommand{ @@ -37,9 +40,10 @@ public class PlaytimeCommand extends BasicCommand{ if(!(sender instanceof ProxiedPlayer)) return; - String s = Message.parse("DECIMAL_FORMAT", sender); - String format = new DecimalFormat(s).format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); + NumberFormat format = NumberFormat.getNumberInstance(LocaleUtils.toLocale(Message.parse("DECIMAL_FORMAT", sender))); + 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); } } From 20dc8fca3e0a16fd2ea27b310c3850340ef109fd Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 1 Jan 2022 12:24:36 +0100 Subject: [PATCH 19/20] . --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 2 +- src/de/steamwar/messages/BungeeCore.properties | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index c5ff347..5953e03 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -40,7 +40,7 @@ public class PlaytimeCommand extends BasicCommand{ if(!(sender instanceof ProxiedPlayer)) return; - NumberFormat format = NumberFormat.getNumberInstance(LocaleUtils.toLocale(Message.parse("DECIMAL_FORMAT", sender))); + NumberFormat format = NumberFormat.getNumberInstance(((ProxiedPlayer)sender).getLocale()); format.setMaximumFractionDigits(2); String formattedText = format.format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 436827d..5e46bc5 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -570,5 +570,4 @@ GDPR_STATUS_LOGS=§7Suche und packe logs... GDPR_STATUS_FINISHED=§7Packen abgeschlossen #Playtime Command -HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h -DECIMAL_FORMAT=###,## \ No newline at end of file +HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h \ No newline at end of file From b77cce9921444b4cadf95af39821e6278ee05178 Mon Sep 17 00:00:00 2001 From: zOnlyKroks Date: Sat, 1 Jan 2022 18:43:43 +0100 Subject: [PATCH 20/20] . --- src/de/steamwar/bungeecore/commands/PlaytimeCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java index 5953e03..23e16a0 100644 --- a/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java +++ b/src/de/steamwar/bungeecore/commands/PlaytimeCommand.java @@ -44,6 +44,6 @@ public class PlaytimeCommand extends BasicCommand{ format.setMaximumFractionDigits(2); String formattedText = format.format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600)); - Message.send(Message.parse("HOURS_PLAYED", sender) + formattedText,sender); + Message.send("HOURS_PLAYED", sender, formattedText); } }