Workaround for TPS
This commit is contained in:
parent
c5799af7dc
commit
dc1ad6d418
@ -35,6 +35,7 @@ public class TpsCommand implements WSCommand {
|
|||||||
* @return Current server Tps
|
* @return Current server Tps
|
||||||
*/
|
*/
|
||||||
public double[] getTps() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException {
|
public double[] getTps() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException {
|
||||||
|
try {
|
||||||
Class<?> minecraftServerClass = Class.forName("net.minecraft.server." + mcVer + ".MinecraftServer");
|
Class<?> minecraftServerClass = Class.forName("net.minecraft.server." + mcVer + ".MinecraftServer");
|
||||||
Method getServerMethod = minecraftServerClass.getDeclaredMethod("getServer");
|
Method getServerMethod = minecraftServerClass.getDeclaredMethod("getServer");
|
||||||
Object serverInstance = getServerMethod.invoke(null);
|
Object serverInstance = getServerMethod.invoke(null);
|
||||||
@ -44,6 +45,10 @@ public class TpsCommand implements WSCommand {
|
|||||||
recentTps[i] = Math.round(recentTps[i]);
|
recentTps[i] = Math.round(recentTps[i]);
|
||||||
}
|
}
|
||||||
return recentTps;
|
return recentTps;
|
||||||
|
} catch (Exception e) {
|
||||||
|
//If an uncaught exception is thrown, maybe it is because this method of getting TPS does not work in the MV version currently running..
|
||||||
|
return new double[] { 0 };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user