9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-04 15:41:31 +00:00

Update PCA, fix #280

This commit is contained in:
violetc
2024-07-26 17:48:42 +08:00
parent 7d09a3a0fb
commit 86d85530bc
2 changed files with 103 additions and 57 deletions

View File

@@ -85,10 +85,10 @@ index c2c421b1caf76b40542fdc436801accbe97a38cb..29f139fb4d70a9a362ac0a30579eb0b4
.withRequiredArg()
diff --git a/src/main/java/org/leavesmc/leaves/LeavesConfig.java b/src/main/java/org/leavesmc/leaves/LeavesConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..c0afb54a352bec9e311677c2a13e491efead093b
index 0000000000000000000000000000000000000000..403c5f4f374a7e7525f9a81c9e70b6b2791db248
--- /dev/null
+++ b/src/main/java/org/leavesmc/leaves/LeavesConfig.java
@@ -0,0 +1,925 @@
@@ -0,0 +1,930 @@
+package org.leavesmc.leaves;
+
+import com.destroystokyo.paper.util.SneakyThrow;
@@ -789,24 +789,29 @@ index 0000000000000000000000000000000000000000..c0afb54a352bec9e311677c2a13e491e
+
+ // Leaves end - protocol - syncmatica
+
+ @GlobalConfig(name = "pca-sync-protocol", category = "protocol")
+ @GlobalConfig(name = "pca-sync-protocol", category = "protocol", verify = PcaVerify.class)
+ public static boolean pcaSyncProtocol = false;
+
+ @GlobalConfig(name = "pca-sync-player-entity", category = "protocol", verify = PcaPlayerEntityVerify.class)
+ public static String pcaSyncPlayerEntity = "OPS";
+
+ private static class PcaPlayerEntityVerify extends ConfigVerify.StringConfigVerify {
+ private static final List<String> pcaSyncPlayerEntityList = List.of("NOBODY", "BOT", "OPS", "OPS_AND_SELF", "EVERYONE");
+
+ public static class PcaVerify extends ConfigVerify.BooleanConfigVerify {
+ @Override
+ public String check(String old, String value) {
+ if (!pcaSyncPlayerEntityList.contains(value)) {
+ return "pca-sync-player-entity value error";
+ public String check(Boolean old, Boolean value) {
+ if (old != null && old != value) {
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.onConfigModify(value);
+ }
+ return null;
+ }
+ }
+
+ @GlobalConfig(name = "pca-sync-player-entity", category = "protocol", verify = PcaPlayerEntityVerify.class)
+ public static PcaPlayerEntityType pcaSyncPlayerEntity = PcaPlayerEntityType.OPS;
+
+ public enum PcaPlayerEntityType {
+ NOBODY, BOT, OPS, OPS_AND_SELF, EVERYONE
+ }
+
+ private static class PcaPlayerEntityVerify extends ConfigVerify.EnumConfigVerify<PcaPlayerEntityType> {
+ }
+
+ @GlobalConfig(name = "bbor-protocol", category = "protocol")
+ public static boolean bborProtocol = false;
+