Rewrite config file system and remove useless patches
This commit is contained in:
@@ -1,91 +1,70 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MrHua269 <novau233@163.com>
|
||||
Date: Sat, 27 Jan 2024 07:55:42 +0000
|
||||
Date: Wed, 7 Feb 2024 02:00:50 +0000
|
||||
Subject: [PATCH] Add config for chat sign
|
||||
|
||||
|
||||
diff --git a/src/main/java/me/earthme/luminol/LuminolConfig.java b/src/main/java/me/earthme/luminol/LuminolConfig.java
|
||||
index a49da370c91211d4e2274f72d62c911a1912296a..8d1ce8eae252fcf05b6a62d2dc467d6d503d3df4 100644
|
||||
--- a/src/main/java/me/earthme/luminol/LuminolConfig.java
|
||||
+++ b/src/main/java/me/earthme/luminol/LuminolConfig.java
|
||||
@@ -13,6 +13,7 @@ public class LuminolConfig {
|
||||
|
||||
public static String serverModName = "Luminol";
|
||||
public static boolean fakeVanillaModeEnabled = false;
|
||||
+ public static boolean disableChatSign = false;
|
||||
|
||||
public static boolean safeTeleportation = true;
|
||||
public static boolean enableSandDuping = false;
|
||||
@@ -36,6 +37,7 @@ public class LuminolConfig {
|
||||
public static void initValues(){
|
||||
serverModName = get("misc.server_mod_name",serverModName,"The servermod name will be sent to players,and you can see it in F3 or motd responses");
|
||||
fakeVanillaModeEnabled = get("misc.enable_fake_vanilla_mode",fakeVanillaModeEnabled,"Enable this to make the ping response of your server like a vanilla server");
|
||||
+ disableChatSign = get("misc.disable_chat_sign",disableChatSign,"Set this to true to disable mojang's chat sign");
|
||||
|
||||
safeTeleportation = get("fixes.enable_safe_teleportation",safeTeleportation,"If this enabled,the end portals will not teleport removed entities.");
|
||||
enableSandDuping = get("fixes.enable_sand_duping",enableSandDuping,"If this enabled,The value of safe teleportation will always be false and sand duping will be enabled");
|
||||
diff --git a/src/main/java/me/earthme/luminol/config/modules/misc/ChatSignConfig.java b/src/main/java/me/earthme/luminol/config/modules/misc/ChatSignConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1e03e51e51f56c38abaad100274e25c9f854f727
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/earthme/luminol/config/modules/misc/ChatSignConfig.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package me.earthme.luminol.config.modules.misc;
|
||||
+
|
||||
+import me.earthme.luminol.config.ConfigInfo;
|
||||
+import me.earthme.luminol.config.EnumConfigCategory;
|
||||
+import me.earthme.luminol.config.IConfigModule;
|
||||
+
|
||||
+public class ChatSignConfig implements IConfigModule {
|
||||
+ @ConfigInfo(baseName = "enabled")
|
||||
+ public static boolean enabled = true;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumConfigCategory getCategory() {
|
||||
+ return EnumConfigCategory.MISC;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBaseName() {
|
||||
+ return "mojang_chat_sign";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java b/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
|
||||
index 72a8aa676836fcb3b4578689d16af65e18f55bbe..04653d58f2493d796e61bc97f0481cb628539c37 100644
|
||||
index 72a8aa676836fcb3b4578689d16af65e18f55bbe..9408747cb254a99d5cb3fc26fde16ddb80168894 100644
|
||||
--- a/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
|
||||
+++ b/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
|
||||
@@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import me.earthme.luminol.LuminolConfig;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.chat.MessageSignature;
|
||||
import net.minecraft.network.chat.SignableCommand;
|
||||
@@ -14,8 +16,16 @@ public record ArgumentSignatures(List<ArgumentSignatures.Entry> entries) {
|
||||
@@ -14,9 +14,17 @@ public record ArgumentSignatures(List<ArgumentSignatures.Entry> entries) {
|
||||
private static final int MAX_ARGUMENT_NAME_LENGTH = 16;
|
||||
|
||||
public ArgumentSignatures(FriendlyByteBuf buf) {
|
||||
- this(buf.readCollection(FriendlyByteBuf.limitValue(ArrayList::new, 8), ArgumentSignatures.Entry::new));
|
||||
+ this(readSign(buf));
|
||||
+ }
|
||||
+
|
||||
+ this(readSign(buf)); //Luminol - Fix java compile
|
||||
}
|
||||
|
||||
+ //Luminol start - Add config for chat sign
|
||||
+ private static List<ArgumentSignatures.Entry> readSign(FriendlyByteBuf buf) {
|
||||
+ var entries = buf.readCollection(FriendlyByteBuf.limitValue(ArrayList::new, 8), Entry::new);
|
||||
+ return LuminolConfig.disableChatSign ? List.of() : entries;
|
||||
}
|
||||
+ return me.earthme.luminol.config.modules.misc.ChatSignConfig.enabled ? List.of() : entries;
|
||||
+ }
|
||||
+ //Luminol end
|
||||
+
|
||||
|
||||
+
|
||||
@Nullable
|
||||
public MessageSignature get(String argumentName) {
|
||||
for(ArgumentSignatures.Entry entry : this.entries) {
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index b863249ff7e13cf4939c8961601f0564c62fd661..4e9bfce4fd188e832c15feedebe4d10b6873b764 100644
|
||||
index b863249ff7e13cf4939c8961601f0564c62fd661..6ab73b0568c3f9df8090be992736a14d49e0286c 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -48,6 +48,8 @@ import java.util.function.Function;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.function.ToIntFunction;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import me.earthme.luminol.LuminolConfig;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
@@ -83,6 +85,8 @@ import org.joml.Vector3f;
|
||||
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
|
||||
|
||||
+import net.minecraft.network.protocol.status.ServerStatus;
|
||||
+
|
||||
public class FriendlyByteBuf extends ByteBuf {
|
||||
|
||||
public static final int DEFAULT_NBT_QUOTA = 2097152;
|
||||
@@ -143,6 +147,17 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
@@ -143,6 +143,16 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
// Paper end - Adventure; add max length parameter
|
||||
DataResult<JsonElement> dataresult = codec.encodeStart(JsonOps.INSTANCE, value);
|
||||
|
||||
+
|
||||
+ //Luminol start - Add config for chat sign
|
||||
+ if (codec == ServerStatus.CODEC) {
|
||||
+ if (codec == net.minecraft.network.protocol.status.ServerStatus.CODEC) {
|
||||
+ JsonElement element = Util.getOrThrow(dataresult, string -> new EncoderException("Failed to encode: " + string + " " + value));
|
||||
+ element.getAsJsonObject().addProperty("preventsChatReports", LuminolConfig.disableChatSign);
|
||||
+ element.getAsJsonObject().addProperty("preventsChatReports", !me.earthme.luminol.config.modules.misc.ChatSignConfig.enabled);
|
||||
+
|
||||
+ this.writeUtf(GSON.toJson(element));
|
||||
+ return;
|
||||
|
||||
Reference in New Issue
Block a user