comment some lines

This commit is contained in:
AlphaKR93
2025-02-19 21:24:33 +09:00
parent 883f334864
commit e286d62894
4 changed files with 22 additions and 30 deletions

View File

@@ -24,7 +24,7 @@
public void getDetails(StringBuilder builder) { public void getDetails(StringBuilder builder) {
- if ((this.uncategorizedStackTrace == null || this.uncategorizedStackTrace.length <= 0) && !this.details.isEmpty()) { - if ((this.uncategorizedStackTrace == null || this.uncategorizedStackTrace.length <= 0) && !this.details.isEmpty()) {
- this.uncategorizedStackTrace = ArrayUtils.subarray(this.details.get(0).getStacktrace(), 0, 1); - 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 + 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 (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]; stackTraceElement = stackTrace[i1];
if (stackTrace.length + 1 - i < stackTrace.length) { if (stackTrace.length + 1 - i < stackTrace.length) {
stackTraceElement1 = stackTrace[stackTrace.length + 1 - i]; stackTraceElement1 = stackTrace[stackTrace.length + 1 - i];
@@ -89,7 +89,7 @@
this.trackingStackTrace = crashReportCategory.validateStackTrace(stackTraceElement, stackTraceElement1); this.trackingStackTrace = crashReportCategory.validateStackTrace(stackTraceElement, stackTraceElement1);
- if (stackTrace != null && stackTrace.length >= i && 0 <= i1 && i1 < stackTrace.length) { - 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]; this.uncategorizedStackTrace = new StackTraceElement[i1];
System.arraycopy(stackTrace, 0, this.uncategorizedStackTrace, 0, this.uncategorizedStackTrace.length); System.arraycopy(stackTrace, 0, this.uncategorizedStackTrace, 0, this.uncategorizedStackTrace.length);
} else { } else {

View File

@@ -1,13 +1,5 @@
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/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 @@ @@ -174,24 +_,26 @@
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -237,7 +229,7 @@
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end // CraftBukkit end
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files 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) { private void readScoreboard(DimensionDataStorage dataStorage) {
@@ -383,7 +375,7 @@
public String getLocalIp() { public String getLocalIp() {
- return this.localIp; - return this.localIp;
+ return (this.localIp == null) ? "" : this.localIp; + return (this.localIp == null) ? "" : this.localIp; // Plazma - Null safety
} }
public void setLocalIp(String localIp) { public void setLocalIp(String localIp) {
@@ -392,10 +384,10 @@
// Paper start - Further improve server tick loop // Paper start - Further improve server tick loop
private static final long SEC_IN_NANO = 1000000000; 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; + //private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L; // Plazma
private long lastTick = 0; private long lastTick = 0;
- private long catchupTime = 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 tps5s = new RollingAverage(5); // Purpur - Add 5 second tps average in /tps
public final RollingAverage tps1 = new RollingAverage(60); public final RollingAverage tps1 = new RollingAverage(60);
public final RollingAverage tps5 = new RollingAverage(60 * 5); public final RollingAverage tps5 = new RollingAverage(60 * 5);
@@ -430,8 +422,8 @@
Optional<Path> optional = Optional.of(this.getFile("server-icon.png")) Optional<Path> optional = Optional.of(this.getFile("server-icon.png"))
- .filter(path -> Files.isRegularFile(path)) - .filter(path -> Files.isRegularFile(path))
- .or(() -> this.storageSource.getIconFile().filter(path -> Files.isRegularFile(path))); - .or(() -> this.storageSource.getIconFile().filter(path -> Files.isRegularFile(path)));
+ .filter(Files::isRegularFile) + .filter(Files::isRegularFile) // Plazma - Use modern method
+ .or(() -> this.storageSource.getIconFile().filter(Files::isRegularFile)); + .or(() -> this.storageSource.getIconFile().filter(Files::isRegularFile)); // Plazma - Use modern method
return optional.flatMap(path -> { return optional.flatMap(path -> {
try { try {
BufferedImage bufferedImage = ImageIO.read(path.toFile()); BufferedImage bufferedImage = ImageIO.read(path.toFile());
@@ -575,18 +567,18 @@
@Override @Override
public int getPlayerCount() { public int getPlayerCount() {
- return this.playerList.getPlayerCount(); - return this.playerList.getPlayerCount();
+ return this.getPlayerList().getPlayerCount(); + return this.getPlayerList().getPlayerCount(); // Plazma - Null safety
} }
@Override @Override
public int getMaxPlayers() { public int getMaxPlayers() {
- return this.playerList.getMaxPlayers(); - return this.playerList.getMaxPlayers();
+ return this.getPlayerList().getMaxPlayers(); + return this.getPlayerList().getMaxPlayers(); // Plazma - Null safety
} }
public String[] getPlayerNames() { public String[] getPlayerNames() {
- return this.playerList.getPlayerNamesArray(); - return this.playerList.getPlayerNamesArray();
+ return this.getPlayerList().getPlayerNamesArray(); + return this.getPlayerList().getPlayerNamesArray(); // Plazma - Null safety
} }
@DontObfuscate @DontObfuscate
@@ -621,7 +613,7 @@
public net.kyori.adventure.text.Component motd() { public net.kyori.adventure.text.Component motd() {
- return this.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) { public void motd(net.kyori.adventure.text.Component motd) {
@@ -630,7 +622,7 @@
public PlayerList getPlayerList() { public PlayerList getPlayerList() {
- return this.playerList; - 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) { public void setPlayerList(PlayerList list) {
@@ -638,7 +630,7 @@
this.playerIdleTimeout = idleTimeout; this.playerIdleTimeout = idleTimeout;
} }
+ @Nullable + @Nullable // Plazma - Null safety
public MinecraftSessionService getSessionService() { public MinecraftSessionService getSessionService() {
return this.services.sessionService(); return this.services.sessionService();
} }
@@ -646,7 +638,7 @@
return this.services.profileKeySignatureValidator(); return this.services.profileKeySignatureValidator();
} }
+ @Nullable + @Nullable // Plazma - Null safety
public GameProfileRepository getProfileRepository() { public GameProfileRepository getProfileRepository() {
return this.services.profileRepository(); return this.services.profileRepository();
} }
@@ -654,7 +646,7 @@
- @Nullable - @Nullable
public GameProfileCache getProfileCache() { public GameProfileCache getProfileCache() {
- return this.services.profileCache(); - 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 @Nullable
@@ -680,7 +672,7 @@
public GameRules getGameRules() { public GameRules getGameRules() {
- return this.overworld().getGameRules(); - return this.overworld().getGameRules();
+ return Objects.requireNonNull(this.overworld()).getGameRules(); + return Objects.requireNonNull(this.overworld()).getGameRules(); // Plazma - Null safety
} }
public CustomBossEvents getCustomBossEvents() { public CustomBossEvents getCustomBossEvents() {
@@ -691,7 +683,7 @@
- String property1 = System.getProperty("path.separator"); - String property1 = System.getProperty("path.separator");
- for (String string : Splitter.on(property1).split(property)) { - 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(string);
bufferedWriter.write("\n"); bufferedWriter.write("\n");
} }

View File

@@ -19,7 +19,7 @@
private int skyDarken; private int skyDarken;
protected int randValue = RandomSource.create().nextInt(); protected int randValue = RandomSource.create().nextInt();
- protected final int addend = 1013904223; - protected final int addend = 1013904223;
+ //protected final int addend = 1013904223; + //protected final int addend = 1013904223; // Plazma
protected float oRainLevel; protected float oRainLevel;
public float rainLevel; public float rainLevel;
protected float oThunderLevel; protected float oThunderLevel;
@@ -58,7 +58,7 @@
private org.spigotmc.TickLimiter tileLimiter; private org.spigotmc.TickLimiter tileLimiter;
- private int tileTickPosition; - private int tileTickPosition;
- public final Map<ServerExplosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions - public final Map<ServerExplosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
+ //private int tileTickPosition; + //private int tileTickPosition; // Plazma
+ final Map<ServerExplosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); public final void clearExplosionDensityCache() { this.explosionDensityCache.clear(); } // Paper - Optimize explosions // Plazma - public -> package-private + final Map<ServerExplosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); public final void clearExplosionDensityCache() { this.explosionDensityCache.clear(); } // Paper - Optimize explosions // Plazma - public -> package-private
+ @Nullable // Plazma - Null safety + @Nullable // Plazma - Null safety
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here

View File

@@ -4,7 +4,7 @@
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console); 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 org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur - Purpur config files
for (ServerLevel world : this.console.getAllLevels()) { for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty