Round TPS instead of flooring

This commit is contained in:
business-goose 2022-03-21 17:11:04 +00:00
parent ae97ecacd1
commit ef4d2c46d8
2 changed files with 1 additions and 7 deletions

View file

@ -1,9 +1,7 @@
package me.StevenLawson.TotalFreedomMod.discord.commands; package me.StevenLawson.TotalFreedomMod.discord.commands;
import com.earth2me.essentials.utils.DateUtil;
import me.StevenLawson.TotalFreedomMod.Server; import me.StevenLawson.TotalFreedomMod.Server;
import me.StevenLawson.TotalFreedomMod.discord.command.ExecutableDiscordCommand; import me.StevenLawson.TotalFreedomMod.discord.command.ExecutableDiscordCommand;
import org.bukkit.Bukkit;
import org.javacord.api.entity.message.MessageBuilder; import org.javacord.api.entity.message.MessageBuilder;
import org.javacord.api.entity.message.embed.EmbedBuilder; import org.javacord.api.entity.message.embed.EmbedBuilder;
import org.javacord.api.entity.user.User; import org.javacord.api.entity.user.User;
@ -19,7 +17,7 @@ public class TPSCommand extends ExecutableDiscordCommand {
public MessageBuilder execute(User user, List<String> args) { public MessageBuilder execute(User user, List<String> args) {
EmbedBuilder builder = new EmbedBuilder(); EmbedBuilder builder = new EmbedBuilder();
builder.setTitle("Server lag information"); builder.setTitle("Server lag information");
builder.addField("TPS", String.valueOf(Math.floor(Server.getTPS()))); builder.addField("TPS", String.valueOf(Math.round(Server.getTPS())));
builder.addField("Uptime", Server.getUptime()); builder.addField("Uptime", Server.getUptime());
builder.addField("Maximum Memory", String.format("%s MB", Math.ceil(Server.getMaxMem()))); builder.addField("Maximum Memory", String.format("%s MB", Math.ceil(Server.getMaxMem())));
builder.addField("Allocated Memory", String.format("%s MB", Math.floor(Server.getTotalMem()))); builder.addField("Allocated Memory", String.format("%s MB", Math.floor(Server.getTotalMem())));

View file

@ -9,11 +9,7 @@ import org.javacord.api.entity.user.User;
import java.awt.*; import java.awt.*;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class UptimeCommand extends ExecutableDiscordCommand { public class UptimeCommand extends ExecutableDiscordCommand {
public UptimeCommand(String command, String description, String category, boolean isAdmin) { public UptimeCommand(String command, String description, String category, boolean isAdmin) {