Skip to content

Commit

Permalink
Some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Sep 28, 2023
1 parent 8730a4d commit 41df279
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 52 deletions.
31 changes: 29 additions & 2 deletions patches/server/0009-Console-logging-tweaks.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ Date: Wed, 27 Sep 2023 16:55:12 +0900
Subject: [PATCH] Console logging tweaks


diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
index e4fd372a1d585887287253a02531cd192929377b..dae0b0e1288afe0d8eb70d0e8e2db152aad42bf4 100644
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -355,7 +355,7 @@ public final class ChatProcessor {

private void sendToServer(final ChatType.Bound chatType, final @Nullable Function<Audience, net.minecraft.network.chat.Component> msgFunction) {
final PlayerChatMessage toConsoleMessage = msgFunction == null ? ChatProcessor.this.message : ChatProcessor.this.message.withUnsignedContent(msgFunction.apply(ChatProcessor.this.server.console));
- ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) ? null : "Not Secure");
+ ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, (!org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.notSecurePrefix || ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage)) ? null : "Not Secure"); // Plazma
}
}

diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index a970e00482952318c258fc406cb7c39a229b65bc..879c090d9c4574a2cd45a0eb1bf9cb171834d940 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
Expand Down Expand Up @@ -56,11 +69,24 @@ index a970e00482952318c258fc406cb7c39a229b65bc..879c090d9c4574a2cd45a0eb1bf9cb17

if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 5c38df8170033dbfee267520991a3cc3285d219e..58cc1bed851994fb591e9b832b98d25eda153b47 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1440,7 +1440,7 @@ public abstract class PlayerList {
}
public void broadcastChatMessage(PlayerChatMessage message, Predicate<ServerPlayer> shouldSendFiltered, @Nullable ServerPlayer sender, ChatType.Bound params, @Nullable Function<net.kyori.adventure.audience.Audience, Component> unsignedFunction) {
// Paper end
- boolean flag = this.verifyChatTrusted(message);
+ boolean flag = !org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.notSecurePrefix || this.verifyChatTrusted(message); // Plazma

this.server.logChatMessage((unsignedFunction == null ? message.decoratedContent() : unsignedFunction.apply(this.server.console)), params, flag ? null : "Not Secure"); // Paper
OutgoingChatMessage outgoingchatmessage = OutgoingChatMessage.create(message);
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index b9a6c781684b080bcfb07495e561325d594eeafd..59c862c0e8a4111d4e9aa14a424b15cd9c37e6d1 100644
index b9a6c781684b080bcfb07495e561325d594eeafd..81c6b6270fc7b74fdd1261fa1d14ec8221a36182 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -34,4 +34,12 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -34,4 +34,13 @@ public class GlobalConfiguration extends ConfigurationPart {
public class Player extends ConfigurationPart {

}
Expand All @@ -70,6 +96,7 @@ index b9a6c781684b080bcfb07495e561325d594eeafd..59c862c0e8a4111d4e9aa14a424b15cd
+
+ public boolean offlineWarnings = true;
+ public boolean rootUserWarnings = true;
+ public boolean notSecurePrefix = true;
+
+ }
}
8 changes: 4 additions & 4 deletions patches/server/0023-Implement-No-Chat-Reports.patch
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ index 6f6228edfe77668552a40a814ab3cebd74c4cb5a..22f26761965d3c03b109939585ff528d
if (packet == null || this.processedDisconnect) { // Spigot
return;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 5c38df8170033dbfee267520991a3cc3285d219e..d1702a97fc6aa5d427186209e5d282089c3a5af7 100644
index 58cc1bed851994fb591e9b832b98d25eda153b47..4fbe96813067d3ccf1d8f29151ac3fac0840d76f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1471,6 +1471,7 @@ public abstract class PlayerList {
Expand All @@ -123,11 +123,11 @@ index 5c38df8170033dbfee267520991a3cc3285d219e..d1702a97fc6aa5d427186209e5d28208
}

diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 065a4113f0b1dc1ee122af34609d0de02f62f9de..b7624af6896083e4a4190e7c0a3fc0a3260f5c27 100644
index 10b42754e872a6c05005c2a129c016e7f53fe516..fa9e3df5be290acfbfecdda93d042b0797e3d0f6 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -48,4 +48,22 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean rootUserWarnings = true;
@@ -49,4 +49,22 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean notSecurePrefix = true;

}
+
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <[email protected]>
Date: Tue, 28 Mar 2023 12:42:17 +0900
Subject: [PATCH] Implement MemoryLeakFix
From: AlphaKR93 <[email protected]>
Date: Thu, 28 Sep 2023 12:33:14 +0900
Subject: [PATCH] Fix pufferfish memory leak

Original: fxmorin/MemoryLeakFix
Copyright (C) 2023 fxmorin

diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
index ed439b7e94646141c93a7dd3704d1cdeb5c27e16..2bddcaf8762ee7834c32622402a976bfad12d127 100644
index ed439b7e94646141c93a7dd3704d1cdeb5c27e16..8c51973491005faa03c866c8472918d0817965ed 100644
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
@@ -67,7 +67,7 @@ public final class Biome {
private final MobSpawnSettings mobSettings;
private final BiomeSpecialEffects specialEffects;
// Pufferfish start - use our cache
- private final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> {
+ private static final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> { // Plazma - MemoryLeakFix
+ private static final ThreadLocal<gg.airplane.structs.Long2FloatAgingCache> temperatureCache = ThreadLocal.withInitial(() -> { // Plazma - Fix memory leak
return Util.make(() -> {
/*
Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) {
Expand All @@ -24,7 +22,7 @@ index ed439b7e94646141c93a7dd3704d1cdeb5c27e16..2bddcaf8762ee7834c32622402a976bf
long l = blockPos.asLong();
// Pufferfish start
- gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get();
+ gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // Plazma - MemoryLeakFix
+ gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // Plazma - Fix memory leak
float f = cache.getValue(l);
if (!Float.isNaN(f)) {
return f;
38 changes: 0 additions & 38 deletions patches/unapplied/server/0031-Reduce-Sensor-Work.patch

This file was deleted.

0 comments on commit 41df279

Please sign in to comment.