From c3b59015fd6c25b2b858dcf11da1a3f8101a81cb Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 7 Nov 2020 11:57:23 +0100 Subject: [PATCH] Remove built in tps sensoring --- .../bausystem/commands/CommandInfo_12.java | 30 ----------------- .../bausystem/commands/CommandInfo_15.java | 30 ----------------- .../bausystem/commands/CommandInfo.java | 32 ++++--------------- 3 files changed, 7 insertions(+), 85 deletions(-) delete mode 100644 BauSystem_12/src/de/steamwar/bausystem/commands/CommandInfo_12.java delete mode 100644 BauSystem_15/src/de/steamwar/bausystem/commands/CommandInfo_15.java diff --git a/BauSystem_12/src/de/steamwar/bausystem/commands/CommandInfo_12.java b/BauSystem_12/src/de/steamwar/bausystem/commands/CommandInfo_12.java deleted file mode 100644 index 9ae06e1..0000000 --- a/BauSystem_12/src/de/steamwar/bausystem/commands/CommandInfo_12.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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.bausystem.commands; - -import net.minecraft.server.v1_12_R1.MinecraftServer; - -class CommandInfo_12 { - private CommandInfo_12(){} - - static double[] getTps(){ - return MinecraftServer.getServer().recentTps; - } -} diff --git a/BauSystem_15/src/de/steamwar/bausystem/commands/CommandInfo_15.java b/BauSystem_15/src/de/steamwar/bausystem/commands/CommandInfo_15.java deleted file mode 100644 index a84f280..0000000 --- a/BauSystem_15/src/de/steamwar/bausystem/commands/CommandInfo_15.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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.bausystem.commands; - -import net.minecraft.server.v1_15_R1.MinecraftServer; - -public class CommandInfo_15 { - private CommandInfo_15(){} - - static double[] getTps(){ - return MinecraftServer.getServer().recentTps; - } -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandInfo.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandInfo.java index 3002547..0b506d9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandInfo.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandInfo.java @@ -20,7 +20,7 @@ package de.steamwar.bausystem.commands; import de.steamwar.bausystem.BauSystem; -import de.steamwar.core.Core; +import de.steamwar.core.TPSWatcher; import de.steamwar.sql.BauweltMember; import de.steamwar.sql.SteamwarUser; import org.bukkit.command.Command; @@ -32,7 +32,6 @@ import java.util.List; public class CommandInfo implements CommandExecutor { @Override - @SuppressWarnings("deprecation") public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { sender.sendMessage(BauSystem.PREFIX + "Besitzer: §e" + SteamwarUser.get(BauSystem.getOwnerID()).getUserName()); sender.sendMessage(BauSystem.PREFIX + "TNT-Schaden: " + (CommandTNT.getInstance().isOn() ? "§aAUS" : "§cAN")); @@ -50,29 +49,12 @@ public class CommandInfo implements CommandExecutor { } sender.sendMessage(membermessage.toString()); - StringBuilder tpsmessage = new StringBuilder().append(BauSystem.PREFIX).append("TPS:§e"); - for(float tps : getTps()){ - tpsmessage.append(" " + tps); - } - sender.sendMessage(tpsmessage.toString()); + sender.sendMessage(BauSystem.PREFIX + "TPS:§e" + + " " + TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_SECOND) + + " " + TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_SECONDS) + + " " + TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE) + + " " + TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES) + + " " + TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)); return false; } - - public static float[] getTps() { - double[] tps; - - switch (Core.getVersion()) { - case 15: - tps = CommandInfo_15.getTps(); - break; - default: - tps = CommandInfo_12.getTps(); - } - - float[] roundedTps = new float[3]; - for(int i = 0; i < tps.length; i++) { - roundedTps[i] = tps[i] > 20.0D ? 20.0F : Math.round(tps[i] * 10) / 10f; - } - return roundedTps; - } }