mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 18:12:09 +01:00
50 lines
2 KiB
Diff
50 lines
2 KiB
Diff
--- a/net/minecraft/server/ServerTickRateManager.java
|
|
+++ b/net/minecraft/server/ServerTickRateManager.java
|
|
@@ -58,8 +_,14 @@
|
|
}
|
|
|
|
public boolean stopSprinting() {
|
|
+ // CraftBukkit start, add sendLog parameter
|
|
+ return this.stopSprinting(true);
|
|
+ }
|
|
+
|
|
+ public boolean stopSprinting(boolean sendLog) {
|
|
+ // CraftBukkit end
|
|
if (this.remainingSprintTicks > 0L) {
|
|
- this.finishTickSprint();
|
|
+ this.finishTickSprint(sendLog); // CraftBukkit - add sendLog parameter
|
|
return true;
|
|
} else {
|
|
return false;
|
|
@@ -76,14 +_,20 @@
|
|
return flag;
|
|
}
|
|
|
|
- private void finishTickSprint() {
|
|
+ private void finishTickSprint(boolean sendLog) { // CraftBukkit - add sendLog parameter
|
|
long l = this.scheduledCurrentSprintTicks - this.remainingSprintTicks;
|
|
double d = Math.max(1.0, (double)this.sprintTimeSpend) / TimeUtil.NANOSECONDS_PER_MILLISECOND;
|
|
int i = (int)(TimeUtil.MILLISECONDS_PER_SECOND * l / d);
|
|
String string = String.format("%.2f", l == 0L ? this.millisecondsPerTick() : d / l);
|
|
this.scheduledCurrentSprintTicks = 0L;
|
|
this.sprintTimeSpend = 0L;
|
|
- this.server.createCommandSourceStack().sendSuccess(() -> Component.translatable("commands.tick.sprint.report", i, string), true);
|
|
+ // CraftBukkit start - add sendLog parameter
|
|
+ if (sendLog) {
|
|
+ this.server.createCommandSourceStack().sendSuccess(() -> {
|
|
+ return Component.translatable("commands.tick.sprint.report", i, string);
|
|
+ }, true);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
this.remainingSprintTicks = 0L;
|
|
this.setFrozen(this.previousIsFrozen);
|
|
this.server.onTickRateChanged();
|
|
@@ -97,7 +_,7 @@
|
|
this.remainingSprintTicks--;
|
|
return true;
|
|
} else {
|
|
- this.finishTickSprint();
|
|
+ this.finishTickSprint(true); // CraftBukkit - add sendLog parameter
|
|
return false;
|
|
}
|
|
}
|