+ 修复一个小碧油鸡

This commit is contained in:
坏黑 2018-09-12 01:01:42 +08:00
parent de98b51c57
commit e648107f1b
2 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package me.skymc.taboolib;
import me.skymc.taboolib.nms.NMSUtils;
import me.skymc.taboolib.other.NumberUtils;
import me.skymc.taboolib.playerdata.DataUtils;
import net.md_5.bungee.api.ChatColor;
@ -129,6 +130,21 @@ public class TabooLib {
return DataUtils.getPluginData("TabooLibrary", null).getString("serverUID");
}
/**
* 获取服务器 TPS
*
* @return double[3]
*/
public static double[] getTPS() {
try {
Class<?> minecraftServer = NMSUtils.getNMSClass("MinecraftServer");
Object server = minecraftServer.getMethod("getServer").invoke(null);
return (double[]) server.getClass().getField("recentTps").get(server);
} catch (Exception e) {
return new double[] {0, 0, 0};
}
}
@Deprecated
public static int getVerint() {
String version = getVersion();

View File

@ -1,13 +1,12 @@
package me.skymc.taboolib.socket;
·import me.skymc.taboolib.TabooLib;
import me.skymc.taboolib.TabooLib;
import me.skymc.taboolib.other.NumberUtils;
import me.skymc.taboolib.socket.packet.Packet;
import me.skymc.taboolib.socket.packet.PacketSerializer;
import me.skymc.taboolib.socket.packet.impl.PacketHeartbeat;
import me.skymc.taboolib.socket.packet.impl.PacketQuit;
import me.skymc.taboolib.socket.server.ClientConnection;
import org.bukkit.Bukkit;
import java.io.IOException;
import java.net.ServerSocket;