diff --git a/plazma-server/minecraft-patches/sources/net/minecraft/CrashReport.java.patch b/plazma-server/minecraft-patches/sources/net/minecraft/CrashReport.java.patch index d7c0e9a..149d8e3 100644 --- a/plazma-server/minecraft-patches/sources/net/minecraft/CrashReport.java.patch +++ b/plazma-server/minecraft-patches/sources/net/minecraft/CrashReport.java.patch @@ -24,7 +24,7 @@ public void getDetails(StringBuilder builder) { - if ((this.uncategorizedStackTrace == null || this.uncategorizedStackTrace.length <= 0) && !this.details.isEmpty()) { - this.uncategorizedStackTrace = ArrayUtils.subarray(this.details.get(0).getStacktrace(), 0, 1); -+ if ((this.uncategorizedStackTrace == null || this.uncategorizedStackTrace.length == 0) && !this.details.isEmpty()) { ++ if ((this.uncategorizedStackTrace == null || this.uncategorizedStackTrace.length == 0) && !this.details.isEmpty()) { // Plazma - Fix IDE warning + this.uncategorizedStackTrace = ArrayUtils.subarray(this.details.getFirst().getStacktrace(), 0, 1); // Plazma - Use modern method } @@ -80,7 +80,7 @@ } - if (stackTrace != null && 0 <= i1 && i1 < stackTrace.length) { -+ if (0 <= i1 && i1 < stackTrace.length) { ++ if (0 <= i1 && i1 < stackTrace.length) { // Plazma - Not nullable stackTraceElement = stackTrace[i1]; if (stackTrace.length + 1 - i < stackTrace.length) { stackTraceElement1 = stackTrace[stackTrace.length + 1 - i]; @@ -89,7 +89,7 @@ this.trackingStackTrace = crashReportCategory.validateStackTrace(stackTraceElement, stackTraceElement1); - if (stackTrace != null && stackTrace.length >= i && 0 <= i1 && i1 < stackTrace.length) { -+ if (stackTrace.length >= i && 0 <= i1 && i1 < stackTrace.length) { ++ if (stackTrace.length >= i && 0 <= i1 && i1 < stackTrace.length) { // Plazma - Not nullable this.uncategorizedStackTrace = new StackTraceElement[i1]; System.arraycopy(stackTrace, 0, this.uncategorizedStackTrace, 0, this.uncategorizedStackTrace.length); } else { diff --git a/plazma-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch b/plazma-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch index d1d1532..ddba5fc 100644 --- a/plazma-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch +++ b/plazma-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch @@ -1,13 +1,5 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -18,6 +_,7 @@ - import it.unimi.dsi.fastutil.objects.ObjectArraySet; - import java.awt.image.BufferedImage; - import java.io.ByteArrayOutputStream; -+import java.io.File; - import java.io.IOException; - import java.io.Writer; - import java.lang.management.ManagementFactory; @@ -174,24 +_,26 @@ import org.slf4j.Logger; @@ -237,7 +229,7 @@ Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); // CraftBukkit end this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files -+ this.plazmaConfigurations = services.plazmaConfigurations(); ++ this.plazmaConfigurations = services.plazmaConfigurations(); // Plazma - Configurable Plazma } private void readScoreboard(DimensionDataStorage dataStorage) { @@ -383,7 +375,7 @@ public String getLocalIp() { - return this.localIp; -+ return (this.localIp == null) ? "" : this.localIp; ++ return (this.localIp == null) ? "" : this.localIp; // Plazma - Null safety } public void setLocalIp(String localIp) { @@ -392,10 +384,10 @@ // Paper start - Further improve server tick loop private static final long SEC_IN_NANO = 1000000000; - private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L; -+ //private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L; ++ //private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L; // Plazma private long lastTick = 0; - private long catchupTime = 0; -+ //private long catchupTime = 0; ++ //private long catchupTime = 0; // Plazma public final RollingAverage tps5s = new RollingAverage(5); // Purpur - Add 5 second tps average in /tps public final RollingAverage tps1 = new RollingAverage(60); public final RollingAverage tps5 = new RollingAverage(60 * 5); @@ -430,8 +422,8 @@ Optional optional = Optional.of(this.getFile("server-icon.png")) - .filter(path -> Files.isRegularFile(path)) - .or(() -> this.storageSource.getIconFile().filter(path -> Files.isRegularFile(path))); -+ .filter(Files::isRegularFile) -+ .or(() -> this.storageSource.getIconFile().filter(Files::isRegularFile)); ++ .filter(Files::isRegularFile) // Plazma - Use modern method ++ .or(() -> this.storageSource.getIconFile().filter(Files::isRegularFile)); // Plazma - Use modern method return optional.flatMap(path -> { try { BufferedImage bufferedImage = ImageIO.read(path.toFile()); @@ -575,18 +567,18 @@ @Override public int getPlayerCount() { - return this.playerList.getPlayerCount(); -+ return this.getPlayerList().getPlayerCount(); ++ return this.getPlayerList().getPlayerCount(); // Plazma - Null safety } @Override public int getMaxPlayers() { - return this.playerList.getMaxPlayers(); -+ return this.getPlayerList().getMaxPlayers(); ++ return this.getPlayerList().getMaxPlayers(); // Plazma - Null safety } public String[] getPlayerNames() { - return this.playerList.getPlayerNamesArray(); -+ return this.getPlayerList().getPlayerNamesArray(); ++ return this.getPlayerList().getPlayerNamesArray(); // Plazma - Null safety } @DontObfuscate @@ -621,7 +613,7 @@ public net.kyori.adventure.text.Component motd() { - return this.motd; -+ return Objects.requireNonNullElse(this.motd, net.kyori.adventure.text.Component.empty()); ++ return Objects.requireNonNullElse(this.motd, net.kyori.adventure.text.Component.empty()); // Plazma - Null safety } public void motd(net.kyori.adventure.text.Component motd) { @@ -630,7 +622,7 @@ public PlayerList getPlayerList() { - return this.playerList; -+ return Objects.requireNonNull(this.playerList, "Server is not started yet"); ++ return Objects.requireNonNull(this.playerList, "Server is not started yet"); // Plazma - Null safety } public void setPlayerList(PlayerList list) { @@ -638,7 +630,7 @@ this.playerIdleTimeout = idleTimeout; } -+ @Nullable ++ @Nullable // Plazma - Null safety public MinecraftSessionService getSessionService() { return this.services.sessionService(); } @@ -646,7 +638,7 @@ return this.services.profileKeySignatureValidator(); } -+ @Nullable ++ @Nullable // Plazma - Null safety public GameProfileRepository getProfileRepository() { return this.services.profileRepository(); } @@ -654,7 +646,7 @@ - @Nullable public GameProfileCache getProfileCache() { - return this.services.profileCache(); -+ return Objects.requireNonNull(this.services.profileCache(), "Profile cache is null"); ++ return Objects.requireNonNull(this.services.profileCache(), "Profile cache is null"); // Plazma - Null safety } @Nullable @@ -680,7 +672,7 @@ public GameRules getGameRules() { - return this.overworld().getGameRules(); -+ return Objects.requireNonNull(this.overworld()).getGameRules(); ++ return Objects.requireNonNull(this.overworld()).getGameRules(); // Plazma - Null safety } public CustomBossEvents getCustomBossEvents() { @@ -691,7 +683,7 @@ - String property1 = System.getProperty("path.separator"); - for (String string : Splitter.on(property1).split(property)) { -+ for (String string : Splitter.on(File.pathSeparator).split(property)) { ++ for (String string : Splitter.on(java.io.File.pathSeparator).split(property)) { // Plazma - Use modern method bufferedWriter.write(string); bufferedWriter.write("\n"); } diff --git a/plazma-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch b/plazma-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch index 8bbc8fc..db21f4b 100644 --- a/plazma-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch +++ b/plazma-server/minecraft-patches/sources/net/minecraft/world/level/Level.java.patch @@ -19,7 +19,7 @@ private int skyDarken; protected int randValue = RandomSource.create().nextInt(); - protected final int addend = 1013904223; -+ //protected final int addend = 1013904223; ++ //protected final int addend = 1013904223; // Plazma protected float oRainLevel; public float rainLevel; protected float oThunderLevel; @@ -58,7 +58,7 @@ private org.spigotmc.TickLimiter tileLimiter; - private int tileTickPosition; - public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions -+ //private int tileTickPosition; ++ //private int tileTickPosition; // Plazma + final Map explosionDensityCache = new HashMap<>(); public final void clearExplosionDensityCache() { this.explosionDensityCache.clear(); } // Paper - Optimize explosions // Plazma - public -> package-private + @Nullable // Plazma - Null safety public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here diff --git a/plazma-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch b/plazma-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch index fecc260..83386c0 100644 --- a/plazma-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch +++ b/plazma-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch @@ -4,7 +4,7 @@ org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); -+ this.console.plazmaConfigurations.reloadConfigs(this.console); ++ this.console.plazmaConfigurations.reloadConfigs(this.console); // Plazma - Configurable Plazma org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur - Purpur config files for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty