mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-26 20:55:30 +01:00
05691646ca
* add second origami fork * Add Origmai2 * Move configs, exclude purpur again * Add missing config entry * Update README.md * Create LICENSE * fix lithium license * fix fix lithium license Co-authored-by: tr7zw <tr7zw@live.de>
59 lines
3.5 KiB
Diff
59 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: tr7zw <tr7zw@live.de>
|
|
Date: Fri, 31 Jul 2020 21:19:26 -0500
|
|
Subject: [PATCH] Add getLastTickMs api
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 7cc402a4dfaa2a4bb123c897b05c09190cbdd489..8e5284fd39be45055bec1609f6b8dd05229e6b35 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -930,6 +930,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
// Paper End
|
|
// Spigot End
|
|
|
|
+ public static long lastTickMs = 0; // Yatopia
|
|
+
|
|
protected void v() {
|
|
try {
|
|
long serverStartTime = SystemUtils.getMonotonicNanos(); // Paper
|
|
@@ -998,7 +1000,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
this.a(gameprofilertick);
|
|
//this.methodProfiler.a(); // Akarin - remove caller
|
|
//this.methodProfiler.enter("tick"); // Akarin - remove caller
|
|
+ long tickStart = System.currentTimeMillis(); // Yatopia
|
|
this.a(this::canSleepForTick);
|
|
+ lastTickMs = System.currentTimeMillis() - tickStart; // Yatopia
|
|
//this.methodProfiler.exitEnter("nextTickWait"); // Akarin - remove caller
|
|
this.X = true;
|
|
// Purpur start - tps catchup
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index e9b5140dbac0516c8900f32d686bb812c11562aa..dc7cd8c22b7edd6e63167421a565aca8dddbd102 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -2421,4 +2421,11 @@ public final class CraftServer implements Server {
|
|
return getServer().lagging;
|
|
}
|
|
// Purpur end
|
|
+
|
|
+ // Yatopia start
|
|
+ @Override
|
|
+ public long getLastTickMs() {
|
|
+ return net.minecraft.server.MinecraftServer.lastTickMs;
|
|
+ }
|
|
+ // Yatopia end
|
|
}
|
|
diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
|
index 3c7b9a6d24e064f9c1ec5fb6d52f42627944d7fa..87812ace9e1327f31693bdfb3fa45ac38766799b 100644
|
|
--- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
|
+++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java
|
|
@@ -33,7 +33,7 @@ public class TicksPerSecondCommand extends Command
|
|
for ( int i = 0; i < tps.length; i++) {
|
|
tpsAvg[i] = format( tps[i] );
|
|
}
|
|
- sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); // Purpur
|
|
+ sender.sendMessage(ChatColor.GOLD + "TPS from last 5s, 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ") + " Last tick time: " + org.bukkit.Bukkit.getLastTickMs() + "ms"); // Yatopia // Purpur
|
|
if (args.length > 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) {
|
|
sender.sendMessage(ChatColor.GOLD + "Current Memory Usage: " + ChatColor.GREEN + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024)) + "/" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + " mb (Max: " + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " mb)");
|
|
if (!hasShownMemoryWarning) {
|