SteamWar/BauSystem
Archiviert
13
0

Remove built in tps sensoring

Dieser Commit ist enthalten in:
Lixfel 2020-11-07 11:57:23 +01:00
Ursprung 90b3c7669b
Commit c3b59015fd
3 geänderte Dateien mit 7 neuen und 85 gelöschten Zeilen

Datei anzeigen

@ -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 <https://www.gnu.org/licenses/>.
*/
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;
}
}

Datei anzeigen

@ -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 <https://www.gnu.org/licenses/>.
*/
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;
}
}

Datei anzeigen

@ -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;
}
}