mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
bf7742bf96
It's always been commonly said to 'ignore' that TPS was '19.X', that it was fine. I suspect that the inaccuracy of floating point math resulted in us losing precision over time, making it difficult to actually get back to 20, as you know the fun 0.1 + 0.1 ... 9 more times != 1 problem. BigDecimal supports working with doubles with higher precision. This change makes it so our RollingAverage class maintains all of the data using BigDecimal and using BigDecimal arithematic operations. This ensures we have extremely high precision, enabling us to actually be able print '20 TPS' when TPS is perfect.
38 lines
No EOL
2 KiB
Diff
38 lines
No EOL
2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Thu, 28 Apr 2016 00:57:27 -0400
|
|
Subject: [PATCH] remove null possibility for getServer singleton
|
|
|
|
to stop IDE complaining about potential NPE
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 74c84dda69..eb6ada935f 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -0,0 +0,0 @@ import co.aikar.timings.MinecraftTimings; // Paper
|
|
|
|
public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStatistics, ICommandListener, Runnable {
|
|
|
|
+ private static MinecraftServer SERVER; // Paper
|
|
public static final Logger LOGGER = LogManager.getLogger();
|
|
public static final File a = new File("usercache.json");
|
|
public Convertable convertable;
|
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
|
// Spigot end
|
|
|
|
public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) {
|
|
+ SERVER = this; // Paper - better singleton
|
|
+ this.commandDispatcher = commanddispatcher; // CraftBukkit
|
|
this.ac = new ResourceManager(EnumResourcePackType.SERVER_DATA);
|
|
this.resourcePackRepository = new ResourcePackRepository(ResourcePackLoader::new);
|
|
this.ag = new CraftingManager();
|
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements IAsyncTaskHandler, IMojangStati
|
|
// CraftBukkit start
|
|
@Deprecated
|
|
public static MinecraftServer getServer() {
|
|
- return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
|
|
+ return SERVER;
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
--
|