Compare commits

...

7 Commits

Author SHA1 Message Date
IPECTER 이팩터
0a80ae1fba Merge pull request #45 from IPECTER/ver/1.19.4
Merge Test
2023-05-08 23:13:21 +09:00
IPECTER 이팩터
da32e11768 Merge branch 'ver/1.19.4' into ver/1.19.4 2023-05-08 23:12:20 +09:00
IPECTER
54d889eb82 Merge remote-tracking branch 'origin/ver/1.19.4' into ver/1.19.4 2023-05-08 23:11:32 +09:00
IPECTER
dc0868081e Fix NCR
Add Some Patches
2023-05-08 23:11:26 +09:00
IPECTER 이팩터
c8329815dd Merge pull request #44 from IPECTER/ver/1.19.4
Fix NCR and Some Patches
2023-05-08 22:29:31 +09:00
IPECTER 이팩터
44ef4e3069 Merge branch 'ver/1.19.4' into ver/1.19.4 2023-05-08 22:25:42 +09:00
IPECTER
d5b9a2215a Fix NCR
Add Some Patches
2023-05-08 22:24:45 +09:00
15 changed files with 298 additions and 91 deletions

View File

@@ -7,21 +7,8 @@ Subject: [PATCH] Console log tweaks
Original by Irochi <me@irochi.moe>
Licensed under the GPL 3.0
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
index 951a7df30bd70bb3051c04f592529d560be6948e..461dbcac2f1265be7b23960f4422f69d5c8c42a9 100644
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
@@ -353,7 +353,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, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) || !org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.enableSecureChatMarker ? null : "Not Secure");
}
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 429ccd583ecd136a63862e94b8eb36b371e28d0f..efcee39cd7154493de04ca903edbd32b5901b191 100644
index 429ccd583ecd136a63862e94b8eb36b371e28d0f..fd962c112f5d8823fa6f28c556c4fcb5e8abf9d7 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -179,16 +179,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -55,7 +42,7 @@ index 429ccd583ecd136a63862e94b8eb36b371e28d0f..efcee39cd7154493de04ca903edbd32b
}
// Spigot end
- DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
+ DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the \"server.properties\" file or set \"console-logs.offline-warning\" to \"false\" in the \"plazma.yml\" file."); // Plazma
+ DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the \"server.properties\" file or set \"console-logs.offline-warning\" to \"false\" in the \"config/plazma-global.yml\" file."); // Plazma
}
+ // Plazma start - Moved down
@@ -72,30 +59,16 @@ index 429ccd583ecd136a63862e94b8eb36b371e28d0f..efcee39cd7154493de04ca903edbd32b
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 33d4c1af86382cc3343d5db42283b27f69f52374..030166f46b2ce23976a679685ffccf8b5439ce48 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1431,7 +1431,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 = this.verifyChatTrusted(message) || !org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.enableSecureChatMarker;
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 3c70653b720d3d55be199e000e89c627b90e65da..ba542542cbab63b0764d437049123a76ccaca716 100644
index 3c70653b720d3d55be199e000e89c627b90e65da..122482e1fae7d6ac8e6b32ebdcf3e611d47901c4 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -24,6 +24,9 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -24,6 +24,8 @@ public class GlobalConfiguration extends ConfigurationPart {
public ConsoleLogs consoleLogs;
public class ConsoleLogs extends ConfigurationPart {
+ public boolean enableOfflineWarnings = true;
+ public boolean enableRootUserWarnings = true;
+ public boolean enableSecureChatMarker = DO_OPTIMIZE;
}
}

View File

@@ -5,12 +5,12 @@ Subject: [PATCH] Player configuration section
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index ba542542cbab63b0764d437049123a76ccaca716..3590442906a3f1cf27f621a1e093c1c4cc0887ac 100644
index 122482e1fae7d6ac8e6b32ebdcf3e611d47901c4..61f364abb094a1d137478c106fefa22ceb057ed2 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -28,5 +28,12 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -27,5 +27,12 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean enableOfflineWarnings = true;
public boolean enableRootUserWarnings = true;
public boolean enableSecureChatMarker = DO_OPTIMIZE;
+ }
+

View File

@@ -18,10 +18,10 @@ index f719f8aafe7c75e2ef8fcb05f556a8d6bd94b9a0..06ff5dd9e39e2be8dd8397a764813111
if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation) {
if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(packet.name())) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 3590442906a3f1cf27f621a1e093c1c4cc0887ac..b9a04a8042f1bedaeb27681f84f9e2df7cf1794d 100644
index 61f364abb094a1d137478c106fefa22ceb057ed2..a45ff31d08129c0d5f159615d934a4450d54146e 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -33,7 +33,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -32,7 +32,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public Player player;
public class Player extends ConfigurationPart {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add permission to bypass reducedDebugInfo gamerule
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 030166f46b2ce23976a679685ffccf8b5439ce48..427a50198c80459fb4d2364a859ed978b1ec7871 100644
index 33d4c1af86382cc3343d5db42283b27f69f52374..e49e213924206f55f25a44edb4d0ce4bb4d27fc2 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -273,7 +273,7 @@ public abstract class PlayerList {
@@ -13,7 +13,7 @@ index 030166f46b2ce23976a679685ffccf8b5439ce48..427a50198c80459fb4d2364a859ed978
GameRules gamerules = worldserver1.getGameRules();
boolean flag = gamerules.getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN);
- boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
+ boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) || !player.getBukkitEntity().hasPermission("plazma.bypass-reduced-debug-info-gamerule"); // Plazma
+ boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) && !player.getBukkitEntity().hasPermission("plazma.bypass-reduced-debug-info-gamerule"); // Plazma
// Spigot - view distance
playerconnection.send(new ClientboundLoginPacket(player.getId(), worlddata.isHardcore(), player.gameMode.getGameModeForPlayer(), player.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.synchronizedRegistries, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetSendDistance(), worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance(), flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), player.getLastDeathLocation())); // Paper - replace old player chunk management

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Misc configuration
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index b9a04a8042f1bedaeb27681f84f9e2df7cf1794d..1e979bb87ec743e87909927a517692da38e7b18f 100644
index a45ff31d08129c0d5f159615d934a4450d54146e..59b9b268467b098e5c21d1d00f599cfb36154179 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -35,5 +35,12 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -34,5 +34,12 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean allowAnyUsername = false;

View File

@@ -18,7 +18,7 @@ index 591163d8f8300b084ac734800efee902c4def958..d74401ca3182145d136ad668704f5c04
double d1 = (double) (center.y - maxRange);
double d2 = (double) (center.x + maxRange);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 29c46144de1aad31b997ee5000114e6f33f1a1f7..c6d860687f6a1c286c286bb64ac4eed75a88f0c4 100644
index de93be4ddbc36832a76ee94ac9828e1873ab3775..dab9aade837cfe97993c689e598f46e9bb796ffe 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -403,7 +403,7 @@ public class ServerPlayer extends Player {
@@ -162,10 +162,10 @@ index 9e9ac64764cf0a84e25e75d8d6f516cde6047284..2d197a7de77657a19b1b527c0aa53ef9
MinecraftServer minecraftServer = this.level.getServer();
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 1e979bb87ec743e87909927a517692da38e7b18f..66436d4eb66b5a71f18b7db359ab1d63bbac74c0 100644
index 59b9b268467b098e5c21d1d00f599cfb36154179..fa33fd5a64fadbfe6507ae9f61fdfbfc816686b5 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -40,7 +40,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -39,7 +39,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public Misc misc;
public class Misc extends ConfigurationPart {

View File

@@ -10,14 +10,14 @@ Subject: [PATCH] Various Optimizations
0011 - Swaps the predicate order of collision (Akarin)
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3c10c719f6172161a2dcc6592a0a1492e9b3d7c1..d64f188257c135e2a4af07e28ff8f912c80eac03 100644
index b2ee73a2ef6042694ca84c27d592e5fb13b4a0fe..d6e20ebb1e07da767f6571bbaf0dc882cdf4503f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1991,8 +1991,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public void playerTouch(Player player) {}
public void push(Entity entity) {
+ if (entity.noPhysics && this.noPhysics) return; // Plazma
+ if (entity.noPhysics || this.noPhysics) return; // Plazma
if (!this.isPassengerOfSameVehicle(entity)) {
- if (!entity.noPhysics && !this.noPhysics) {
+ //if (!entity.noPhysics && !this.noPhysics) { // Plazma
@@ -81,10 +81,10 @@ index 36af81f0957d17e170d229059c66f4eb4539dfeb..039c952f0c157cba6e79fa9b976958bd
}
// Spigot Start
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 66436d4eb66b5a71f18b7db359ab1d63bbac74c0..87a85fb1cd9a19541df04a5d1c457d86cf7f68eb 100644
index fa33fd5a64fadbfe6507ae9f61fdfbfc816686b5..590afba7c588e7b9f5f9c61e91805e3dc3b62771 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -41,6 +41,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -40,6 +40,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public class Misc extends ConfigurationPart {
public boolean reduceCreateRandomInstance = DO_OPTIMIZE;

View File

@@ -39,10 +39,10 @@ index 6afee2a744a3498d4a0eee35f77cde444f73d12c..dbb987d5896e199aeae3bcd86c69bf33
this.entity.stopSeenByPlayer(player);
player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()}));
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 87a85fb1cd9a19541df04a5d1c457d86cf7f68eb..989b6d20818dec0a527a170ad2b19d456ca023d9 100644
index 590afba7c588e7b9f5f9c61e91805e3dc3b62771..8ed22e178bd093241592981c06c747524ad24dc3 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -42,6 +42,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -41,6 +41,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean reduceCreateRandomInstance = DO_OPTIMIZE;
public boolean doNotTriggerLootTableRefreshForNonPlayerInteraction = DO_OPTIMIZE;

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] No Chat Reports Configuration
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 989b6d20818dec0a527a170ad2b19d456ca023d9..b6348572f4a90acbcf6ec234beac84e8a019ee50 100644
index 8ed22e178bd093241592981c06c747524ad24dc3..0e8d5b01a673ba826c943fcb33552518022a2ea3 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -44,5 +44,12 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -43,5 +43,12 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean doNotTriggerLootTableRefreshForNonPlayerInteraction = DO_OPTIMIZE;
public boolean doNotSendUselessEntityPackets = DO_OPTIMIZE;

View File

@@ -5,10 +5,25 @@ Subject: [PATCH] Implement No Chat Reports
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index 1f4b64a5f812376c499c98cb4be62469bd0b7dbe..59d3b33d523dea21e7a3f0747734b20226fd1dae 100644
index 1f4b64a5f812376c499c98cb4be62469bd0b7dbe..c0bd2997fe3ebbfe926de832a36d209cc875f3e2 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -156,9 +156,14 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -147,18 +147,23 @@ public class FriendlyByteBuf extends ByteBuf {
public <T> T readJsonWithCodec(Codec<T> codec) {
JsonElement jsonelement = (JsonElement) GsonHelper.fromJson(FriendlyByteBuf.GSON, this.readUtf(), JsonElement.class);
DataResult<T> dataresult = codec.parse(JsonOps.INSTANCE, jsonelement);
-
- return Util.getOrThrow(dataresult, (s) -> {
- return new DecoderException("Failed to decode json: " + s);
- });
+ // Plazma start - NCR
+ T result = Util.getOrThrow(dataresult, (s) -> new DecoderException("Failed to decode json: " + s));
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.addQueryData() && jsonelement.getAsJsonObject().has("preventsChatReports"))
+ ((net.minecraft.network.protocol.status.ServerStatus) result).setPreventsChatReports(jsonelement.getAsJsonObject().get("preventsChatReports").getAsBoolean());
+ return result;
+ // Plazma end
}
public <T> void writeJsonWithCodec(Codec<T> codec, T value) {
DataResult<JsonElement> dataresult = codec.encodeStart(JsonOps.INSTANCE, value);
@@ -17,48 +32,41 @@ index 1f4b64a5f812376c499c98cb4be62469bd0b7dbe..59d3b33d523dea21e7a3f0747734b202
- })));
+ // Plazma start - NCR
+ JsonElement element = Util.getOrThrow(dataresult, (s) -> new EncoderException("Failed to encode: " + s + " " + value));
+
+ if (codec == net.minecraft.network.protocol.status.ServerStatus.CODEC && org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.addQueryData())
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.addQueryData() && codec == net.minecraft.network.protocol.status.ServerStatus.CODEC)
+ element.getAsJsonObject().addProperty("preventsChatReports", true);
+
+ this.writeUtf(FriendlyByteBuf.GSON.toJson(element));
+ // Plazma end
}
public <T> void writeId(IdMap<T> registry, T value) {
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
index b8c1f3b9afddc87d56541c8af63cffecfcdd2653..c74c17f058b7a6587e3dcab35878d469e0599240 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatCommandPacket.java
@@ -24,4 +24,10 @@ public record ServerboundChatCommandPacket(String command, Instant timeStamp, lo
public void handle(ServerGamePacketListener listener) {
listener.handleChatCommand(this);
diff --git a/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java b/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java
index e6cc2bab1fde2e8c1394772b99201ea8d7eb8057..2ba3291f6c82f633d7ed7b150f2ae3c28d74b21e 100644
--- a/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java
+++ b/src/main/java/net/minecraft/network/protocol/status/ServerStatus.java
@@ -64,4 +64,21 @@ public record ServerStatus(Component description, Optional<ServerStatus.Players>
return new ServerStatus.Version(worldVersion.getName(), worldVersion.getProtocolVersion());
}
}
+
+ // Plazma start - NCR
+ public ArgumentSignatures argumentSignatures() {
+ return org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.enabled ? ArgumentSignatures.EMPTY : this.argumentSignatures;
+ public boolean enforcesSecureChat() {
+ return org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.enabled || this.enforcesSecureChat;
+ }
+ // Plazma end
}
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
index d1d2fc0c57523c1abf1e8bfec913c78927c3dafc..f93372070b3babc76d43b18df9a0f91a2125e37e 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
@@ -25,4 +25,11 @@ public record ServerboundChatPacket(String message, Instant timeStamp, long salt
public void handle(ServerGamePacketListener listener) {
listener.handleChat(this);
}
+
+ // Plazma start - NCR
+ @Nullable
+ public MessageSignature signature() {
+ return org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.enabled ? null : this.signature;
+ private static boolean preventsChatReports;
+
+ public boolean preventsChatReports() {
+ if (this.version().isPresent() && this.version().get().protocol() < 759 && this.version().get().protocol() > 0) return true;
+ return this.preventsChatReports;
+ }
+
+ public void setPreventsChatReports(boolean prevents) {
+ this.preventsChatReports = prevents;
+ }
+ // Plazma end
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index efcee39cd7154493de04ca903edbd32b5901b191..a398b71c52817bd68a05613ec037ed6d7ae6fb27 100644
index fd962c112f5d8823fa6f28c556c4fcb5e8abf9d7..43ee9198b323a89625b723ba25e09cbfc6c29f7c 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -683,7 +683,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -71,18 +79,16 @@ index efcee39cd7154493de04ca903edbd32b5901b191..a398b71c52817bd68a05613ec037ed6d
protected boolean convertOldUsers() {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ed696a749feed6e9da9302e15130694e659a0a0b..3726af867efbb5dc5b898e00efd5e35f1fd834d4 100644
index ed696a749feed6e9da9302e15130694e659a0a0b..48ee396b858a26f382ca71d0665475abb4ae5891 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2234,10 +2234,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2234,10 +2234,19 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override
public void send(Packet<?> packet) {
+ // Plazma start - NCR
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.convertToGameMessage() && packet instanceof ClientboundPlayerChatPacket chat) {
+ this.send(new ClientboundSystemChatPacket(null, Component.Serializer.toJson(chat.chatType().resolve(this.player.level.registryAccess()).get().decorate(chat.unsignedContent() != null ? chat.unsignedContent() : Component.literal(chat.body().content()))), false));
+ return;
+ }
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().noChatReports.convertToGameMessage() && packet instanceof ClientboundPlayerChatPacket chat)
+ packet = new ClientboundSystemChatPacket(null, Component.Serializer.toJson(chat.chatType().resolve(this.player.level.registryAccess()).get().decorate(chat.unsignedContent() != null ? chat.unsignedContent() : Component.literal(chat.body().content()))), false);
this.send(packet, (PacketSendListener) null);
}
@@ -97,7 +103,7 @@ index ed696a749feed6e9da9302e15130694e659a0a0b..3726af867efbb5dc5b898e00efd5e35f
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 427a50198c80459fb4d2364a859ed978b1ec7871..91c047d865fe40f130f4414e9722dad447478de5 100644
index e49e213924206f55f25a44edb4d0ce4bb4d27fc2..b0b7affc10892ca5572e5c220bd26811778b2d57 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1462,7 +1462,7 @@ public abstract class PlayerList {
@@ -110,10 +116,10 @@ index 427a50198c80459fb4d2364a859ed978b1ec7871..91c047d865fe40f130f4414e9722dad4
// CraftBukkit start
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index b6348572f4a90acbcf6ec234beac84e8a019ee50..7a585540c72c1c18ddcb45ec1caa350f1f9ce544 100644
index 0e8d5b01a673ba826c943fcb33552518022a2ea3..17454a128f7ef53428920f95e4709180fd8efb32 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -49,7 +49,17 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -48,7 +48,17 @@ public class GlobalConfiguration extends ConfigurationPart {
public NoChatReports noChatReports;
public class NoChatReports extends ConfigurationPart {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] FixMySpawnR Configuration
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 7a585540c72c1c18ddcb45ec1caa350f1f9ce544..088670ec016514b4a7fae402d7119a6aaa491c5d 100644
index 17454a128f7ef53428920f95e4709180fd8efb32..39eca4acefa8f9cf143398cfc6cf157e8489947e 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -62,4 +62,12 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -61,4 +61,12 @@ public class GlobalConfiguration extends ConfigurationPart {
}
}

View File

@@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 3 May 2023 16:51:49 +0900
Subject: [PATCH] Reduce Sensor Work
Original: Bloom-host/Petal
Copyright (C) 2023 peaches94
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index b67660cda74a4754d1701e746aca99bde868c150..8dcc8ea2450ee14880e2ffff0f013ccee9b33e2f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1020,20 +1020,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
if (entity != null) {
- ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD);
+ // ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); // Plazma - check head itemstack only when needed
EntityType<?> entitytypes = entity.getType();
// Purpur start
- if (entitytypes == EntityType.SKELETON && itemstack.is(Items.SKELETON_SKULL)) {
+ if (entitytypes == EntityType.SKELETON && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.SKELETON_SKULL)) { // Plazma
d0 *= entity.level.purpurConfig.skeletonHeadVisibilityPercent;
}
- else if (entitytypes == EntityType.ZOMBIE && itemstack.is(Items.ZOMBIE_HEAD)) {
+ else if (entitytypes == EntityType.ZOMBIE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.ZOMBIE_HEAD)) { // Plazma
d0 *= entity.level.purpurConfig.zombieHeadVisibilityPercent;
}
- else if (entitytypes == EntityType.CREEPER && itemstack.is(Items.CREEPER_HEAD)) {
+ else if (entitytypes == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) { // Plazma
d0 *= entity.level.purpurConfig.creeperHeadVisibilityPercent;
}
- else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && itemstack.is(Items.PIGLIN_HEAD)) {
+ else if ((entitytypes == EntityType.PIGLIN || entitytypes == EntityType.PIGLIN_BRUTE) && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD)) { // Plazma
d0 *= entity.level.purpurConfig.piglinHeadVisibilityPercent;
}
// Purpur end

View File

@@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 3 May 2023 16:51:49 +0900
Subject: [PATCH] Configurable Sensor Tick
Original: Bloom-host/Petal
Copyright (C) 2023 peaches94
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 8e2274f7dce34e0997356205cf96e46f8d41cca1..3a365d7efd439cb8ddb99381bd714fb48896f4d2 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -932,10 +932,10 @@ public abstract class Mob extends LivingEntity implements Targeting {
}
// Paper end
//this.level.getProfiler().push("sensing"); // Purpur
- this.sensing.tick();
+ // Plazma - Configurable Sensor Tick
//this.level.getProfiler().pop(); // Purpur
int i = this.level.getServer().getTickCount() + this.getId();
-
+ if (i % this.level.plazmaLevelConfiguration().entity.sensor.tick == 0) this.sensing.tick(); // Plazma - Configurable Sensor Tick
if (i % 2 != 0 && this.tickCount > 1) {
//this.level.getProfiler().push("targetSelector"); // Purpur
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
index e6c22ab535ab8fecaadbf06d4982440fd5863f17..185e2627596314d979188468f838d008442f2d2e 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -107,5 +107,12 @@ public class LevelConfigurations extends ConfigurationPart {
}
+ public Sensor sensor;
+ public class Sensor extends ConfigurationPart {
+
+ public int tick = DO_OPTIMIZE ? 10 : 1;
+
+ }
+
}
}

View File

@@ -0,0 +1,70 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Thu, 4 May 2023 16:54:53 +0900
Subject: [PATCH] Optimize VarInts
https://github.com/PaperMC/Paper/pull/8418
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index c0bd2997fe3ebbfe926de832a36d209cc875f3e2..6108f3aa438b96e817c3a2e582c2c817f096e2eb 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -104,7 +104,20 @@ public class FriendlyByteBuf extends ByteBuf {
this.source = parent;
}
+ // Plazma start - Optimize VarInts
+ private static final int[] VARINT_EXACT_BYTE_LENGTHS = new int[33];
+ static {
+ for (int i = 0; i <= 32; ++i) {
+ VARINT_EXACT_BYTE_LENGTHS[i] = (int) Math.ceil((31d - (i - 1)) / 7d);
+ }
+ VARINT_EXACT_BYTE_LENGTHS[32] = 1; // Special case for the number 0.
+ }
+ // Plazma end
public static int getVarIntSize(int value) {
+ // Plazma start - Optimize VarInts
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.optimizeVarInts)
+ return VARINT_EXACT_BYTE_LENGTHS[Integer.numberOfLeadingZeros(value)];
+ // Plazma end
for (int j = 1; j < 5; ++j) {
if ((value & -1 << j * 7) == 0) {
return j;
@@ -620,6 +633,25 @@ public class FriendlyByteBuf extends ByteBuf {
}
public FriendlyByteBuf writeVarInt(int value) {
+ // Plazma start - Optimize VarInts
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.optimizeVarInts) {
+ // Peel the one and two byte count cases explicitly as they are the most common VarInt sizes
+ // that the proxy will write, to improve inlining.
+ if ((value & (0xFFFFFFFF << 7)) == 0) {
+ writeByte(value);
+ } else if ((value & (0xFFFFFFFF << 14)) == 0) {
+ int w = (value & 0x7F | 0x80) << 8 | (value >>> 7);
+ writeShort(w);
+ } else {
+ while ((value & -128) != 0) {
+ this.writeByte(value & 127 | 128);
+ value >>>= 7;
+ }
+ this.writeByte(value);
+ }
+ return this;
+ }
+ // Plazma end
while ((value & -128) != 0) {
this.writeByte(value & 127 | 128);
value >>>= 7;
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 39eca4acefa8f9cf143398cfc6cf157e8489947e..754ed13a04631c69e3fb2421a12b17d0a6f732c6 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -42,6 +42,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean reduceCreateRandomInstance = DO_OPTIMIZE;
public boolean doNotTriggerLootTableRefreshForNonPlayerInteraction = DO_OPTIMIZE;
public boolean doNotSendUselessEntityPackets = DO_OPTIMIZE;
+ public boolean optimizeVarInts = DO_OPTIMIZE;
}

View File

@@ -0,0 +1,78 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Sat, 6 May 2023 21:09:45 +0900
Subject: [PATCH] Variable-Entity-WakeUp-Duration
Original: GaleMC/Gale
Copyright (C) 2023 Martijn Muijsers
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
index 185e2627596314d979188468f838d008442f2d2e..238e10a35a9e4b300b11c838cda39b8799f16fe2 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -114,5 +114,20 @@ public class LevelConfigurations extends ConfigurationPart {
}
+ public WakeUp wakeUp;
+ public class WakeUp extends ConfigurationPart {
+
+ public DurationVariance durationVariance;
+ public class DurationVariance extends ConfigurationPart {
+
+ public double animal = DO_OPTIMIZE ? 0.2 : 0.0;
+ public double monster = DO_OPTIMIZE ? 0.2 : 0.0;
+ public double flyingMonster = DO_OPTIMIZE ? 0.2 : 0.0;
+ public double villager = DO_OPTIMIZE ? 0.2 : 0.0;
+
+ }
+
+ }
+
}
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index ee64ddb0da23ea1e54d0295324aca5b46a438111..d5230a360cd8c296303b494d716d33ad1fca6a96 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -75,28 +75,36 @@ public class ActivationRange
if (entity.activationType == ActivationType.VILLAGER) {
if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) {
world.wakeupInactiveRemainingVillagers--;
- return config.wakeUpInactiveVillagersFor;
+ return getWakeUpDurationWithVariance(config.wakeUpInactiveVillagersFor, entity.level.plazmaLevelConfiguration().entity.wakeUp.durationVariance.villager); // Plazma - Variable Entity WakeUp Duration
}
} else if (entity.activationType == ActivationType.ANIMAL) {
if (inactiveFor > config.wakeUpInactiveAnimalsEvery && world.wakeupInactiveRemainingAnimals > 0) {
world.wakeupInactiveRemainingAnimals--;
- return config.wakeUpInactiveAnimalsFor;
+ return getWakeUpDurationWithVariance(config.wakeUpInactiveAnimalsFor, entity.level.plazmaLevelConfiguration().entity.wakeUp.durationVariance.animal); // Plazma - Variable Entity WakeUp Duration
}
} else if (entity.activationType == ActivationType.FLYING_MONSTER) {
if (inactiveFor > config.wakeUpInactiveFlyingEvery && world.wakeupInactiveRemainingFlying > 0) {
world.wakeupInactiveRemainingFlying--;
- return config.wakeUpInactiveFlyingFor;
+ return getWakeUpDurationWithVariance(config.wakeUpInactiveFlyingFor, entity.level.plazmaLevelConfiguration().entity.wakeUp.durationVariance.flyingMonster); // Plazma - Variable Entity WakeUp Duration
}
} else if (entity.activationType == ActivationType.MONSTER || entity.activationType == ActivationType.RAIDER) {
if (inactiveFor > config.wakeUpInactiveMonstersEvery && world.wakeupInactiveRemainingMonsters > 0) {
world.wakeupInactiveRemainingMonsters--;
- return config.wakeUpInactiveMonstersFor;
+ return getWakeUpDurationWithVariance(config.wakeUpInactiveMonstersFor, entity.level.plazmaLevelConfiguration().entity.wakeUp.durationVariance.monster); // Plazma - Variable Entity WakeUp Duration
}
}
return -1;
}
// Paper end
+ // Plazma start - Variable Entity WakeUp Duration
+ private static final java.util.Random wakeUpDurationRandom = new java.util.Random();
+ private static int getWakeUpDurationWithVariance(int wakeUpDuration, double deviation) {
+ if (deviation <= 0) return wakeUpDuration;
+ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(wakeUpDuration * wakeUpDurationRandom.nextGaussian(1, deviation))));
+ }
+ // Plazma end
+
static AABB maxBB = new AABB( 0, 0, 0, 0, 0, 0 );
/**