Archiviert
1
0

Merge pull request 'Playtime Command' (#285) from Playtime_Command into master

Reviewed-on: SteamWar/BungeeCore#285
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2022-01-01 21:04:48 +01:00
Commit b330b83ea2
3 geänderte Dateien mit 54 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -127,6 +127,7 @@ public class BungeeCore extends Plugin {
new VerifyCommand();
new ReplayCommand();
new GDPRQuery();
new PlaytimeCommand();
// Punishment Commands:
new PunishmentCommand("ban", Punishment.PunishmentType.Ban);

Datei anzeigen

@ -0,0 +1,49 @@
/*
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 <https://www.gnu.org/licenses/>.
*/
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 org.apache.commons.lang3.LocaleUtils;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
public class PlaytimeCommand extends BasicCommand{
public PlaytimeCommand() {
super("playtime", null);
}
@Override
public void execute(CommandSender sender, String[] strings) {
if(!(sender instanceof ProxiedPlayer))
return;
NumberFormat format = NumberFormat.getNumberInstance(((ProxiedPlayer)sender).getLocale());
format.setMaximumFractionDigits(2);
String formattedText = format.format((SteamwarUser.get((ProxiedPlayer) sender).getOnlinetime() / (double) 3600));
Message.send("HOURS_PLAYED", sender, formattedText);
}
}

Datei anzeigen

@ -568,4 +568,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
GDPR_STATUS_FINISHED=§7Packen abgeschlossen
#Playtime Command
HOURS_PLAYED=§7Deine Spielzeit beträgt§8: §e{0}h