Skip to content

Commit

Permalink
update VineLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
404Setup committed Sep 8, 2024
1 parent e65ccdc commit 4992296
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 37 deletions.
6 changes: 3 additions & 3 deletions patches/server/0004-VineLogger.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ Subject: [PATCH] VineLogger

diff --git a/src/main/kotlin/one/tranic/vine/util/VineLogger.kt b/src/main/kotlin/one/tranic/vine/util/VineLogger.kt
new file mode 100644
index 0000000000000000000000000000000000000000..472256026b38f0ae165847eb50c83ab2691a7bcc
index 0000000000000000000000000000000000000000..d52aa9ff91ca8669d89f4698059e9ca041513ed5
--- /dev/null
+++ b/src/main/kotlin/one/tranic/vine/util/VineLogger.kt
@@ -0,0 +1,53 @@
+package one.tranic.vine.util
+
+import org.slf4j.LoggerFactory
+import com.mojang.logging.LogUtils
+
+object VineLogger {
+ private val logger: org.slf4j.Logger = LoggerFactory.getLogger("Vine")
+ private val logger: org.slf4j.Logger = LogUtils.getLogger()
+
+ fun get(): org.slf4j.Logger {
+ return logger
Expand Down
15 changes: 9 additions & 6 deletions patches/server/0007-Vine-Config-Util.patch
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..45f4c24cc689252513752e7b1cfa6736
\ No newline at end of file
diff --git a/src/main/kotlin/one/tranic/vine/config/ConfigUtil.kt b/src/main/kotlin/one/tranic/vine/config/ConfigUtil.kt
new file mode 100644
index 0000000000000000000000000000000000000000..2f4afece99a273baf515d02a52a8ed7299f02e1a
index 0000000000000000000000000000000000000000..d215f4aba1eb673d0b5e4395e56dbea47887e513
--- /dev/null
+++ b/src/main/kotlin/one/tranic/vine/config/ConfigUtil.kt
@@ -0,0 +1,74 @@
@@ -0,0 +1,77 @@
+package one.tranic.vine.config
+
+import com.aayushatharva.brotli4j.Brotli4jLoader
Expand Down Expand Up @@ -84,17 +84,20 @@ index 0000000000000000000000000000000000000000..2f4afece99a273baf515d02a52a8ed72
+ "****************************",
+ "Brotli in SectorFile currently faces poor performance issues,",
+ "it is recommended to choose ZSTD instead of Brotli",
+ "****************************"
+ "****************************",
+ ""
+ )
+ )
+ }
+ VineLogger.warn(
+ listOf(
+ "******************************************",
+ "Since Vine is compatible with multiple region formats, it is not possible to automatically convert between them. ",
+ "***********************************",
+ "Since Vine is compatible with multiple region formats, ",
+ "it is not possible to automatically convert between them. ",
+ "Currently, it only supports conversion between ANVIL and SectorFile.",
+ "If you have relevant needs, please download the relevant tools to convert region formats.",
+ "******************************************"
+ "************************************",
+ ""
+ )
+ )
+ }
Expand Down
46 changes: 18 additions & 28 deletions patches/server/0009-Vine-Config-Feature.patch
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ index 0000000000000000000000000000000000000000..4c9654fd67f8b68a30af044b0886e146
\ No newline at end of file
diff --git a/src/main/kotlin/one/tranic/vine/config/module/feature/Region.kt b/src/main/kotlin/one/tranic/vine/config/module/feature/Region.kt
new file mode 100644
index 0000000000000000000000000000000000000000..25e58745122872a473fe5614979f061e4f0dddf7
index 0000000000000000000000000000000000000000..0beda6c4679b93cdde58c58cd5b69e8659380e08
--- /dev/null
+++ b/src/main/kotlin/one/tranic/vine/config/module/feature/Region.kt
@@ -0,0 +1,86 @@
@@ -0,0 +1,83 @@
+package one.tranic.vine.config.module.feature
+
+import one.tranic.vine.config.VineConfig.Feature
Expand Down Expand Up @@ -129,18 +129,16 @@ index 0000000000000000000000000000000000000000..25e58745122872a473fe5614979f061e
+ if (Locker.regionFormat == null) {
+ Locker.regionFormat = b
+ Format.setNow(b)
+ } else if (!b.equals(Locker.regionFormat)) {
+ } else if (!b.equals(Locker.regionFormat))
+ VineLogger.error("Forbidden to modify the parameter \"$BASEPATH.format\" during runtime!!!")
+ }
+ }
+ getString("$BASEPATH.compression-format") {
+ val b = Compression.getCompression(it)
+ if (Locker.compressionFormat == null) {
+ Locker.compressionFormat = b
+ Compression.setNow(b)
+ } else if (!b.equals(Locker.compressionFormat)) {
+ } else if (!b.equals(Locker.compressionFormat))
+ VineLogger.error("Forbidden to modify the parameter \"$BASEPATH.compression-format\" during runtime!!!")
+ }
+ }
+ getInt("$BASEPATH.compression-level") {
+ if (Locker.regionCompressionLevel == null) {
Expand All @@ -152,20 +150,19 @@ index 0000000000000000000000000000000000000000..25e58745122872a473fe5614979f061e
+ it
+ }
+ Feature.Region.compressionLevel = Locker.regionCompressionLevel!!
+ } else if (Locker.regionCompressionLevel != it) {
+ } else if (Locker.regionCompressionLevel != it)
+ VineLogger.error("Forbidden to modify the parameter \"$BASEPATH.compression-level\" during runtime!!!")
+ }
+ }
+ Feature.Region.flushFrequency = getInt("$BASEPATH.flush-frequency")
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/one/tranic/vine/config/module/feature/Value.kt b/src/main/kotlin/one/tranic/vine/config/module/feature/Value.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e141b9f557d0ff9eacfb3eaf5a58497c3be3a20a
index 0000000000000000000000000000000000000000..782e236848d0d684750f152b28df1ef145227b54
--- /dev/null
+++ b/src/main/kotlin/one/tranic/vine/config/module/feature/Value.kt
@@ -0,0 +1,60 @@
@@ -0,0 +1,59 @@
+package one.tranic.vine.config.module.feature
+
+import one.tranic.vine.config.VineConfig.Feature
Expand Down Expand Up @@ -218,20 +215,19 @@ index 0000000000000000000000000000000000000000..e141b9f557d0ff9eacfb3eaf5a58497c
+ Feature.secureSeed = it
+ Locker.secureSeed = it
+ if (it) VineLogger.warn("** SecureSeed has been enabled, and this value cannot be modified before deleting the map.")
+ } else if (Locker.secureSeed != it) {
+ } else if (Locker.secureSeed != it)
+ VineLogger.get().error("Forbidden to modify the parameter \"feature.secure-seed\" during runtime!!!")
+ }
+ }
+ Feature.vanillaHopper = getBoolean("feature.vanilla-hopper")
+ Feature.zeroTickPlants = getBoolean("feature.zero-tick-plants")
+ }
+}
diff --git a/src/main/kotlin/one/tranic/vine/config/module/feature/VirtualThread.kt b/src/main/kotlin/one/tranic/vine/config/module/feature/VirtualThread.kt
new file mode 100644
index 0000000000000000000000000000000000000000..03bd7fef8c861b568410359cd66bbfa13be7ffdf
index 0000000000000000000000000000000000000000..8282045ea13e299b02a57920a95d3bf7a48af786
--- /dev/null
+++ b/src/main/kotlin/one/tranic/vine/config/module/feature/VirtualThread.kt
@@ -0,0 +1,68 @@
@@ -0,0 +1,62 @@
+package one.tranic.vine.config.module.feature
+
+import one.tranic.vine.config.VineConfig.Feature
Expand Down Expand Up @@ -259,44 +255,38 @@ index 0000000000000000000000000000000000000000..03bd7fef8c861b568410359cd66bbfa1
+ if (it) {
+ VineLogger.warn(
+ listOf(
+ "",
+ "********",
+ "****************************",
+ "Virtual threads enabled.",
+ "Will try to offload threads other than ShreddedPaper and ChunkThread to dummy threads",
+ "This feature is very experimental and may have some undesirable consequences",
+ "********",
+ "****************************",
+ ""
+ )
+ )
+ }
+ Feature.VirtualThread.enabled = it
+ Locker.virtualThread = it
+ } else if (it != Locker.virtualThread) {
+ VineLogger.get()
+ .error("Forbidden to modify the parameter \"$BASEPATH.enabled\" during runtime!!!")
+ }
+ } else if (it != Locker.virtualThread)
+ VineLogger.error("Forbidden to modify the parameter \"$BASEPATH.enabled\" during runtime!!!")
+ }
+ getBoolean("$BASEPATH.vt2") {
+ if (Locker.virtualThread2 == null) {
+ if (it) {
+ VineLogger.warn(
+ listOf(
+ "",
+ "********",
+ "****************************",
+ "Virtual Threads 2.0 is being enabled. This content is very experimental ",
+ "and may seriously affect stability. You should not enable it in a production ",
+ "environment. If you need more VT2.0 content, please switch to the virtual-thread fork download.",
+ "********",
+ "****************************",
+ ""
+ )
+ )
+ }
+ Feature.VirtualThread.vt2= it
+ Locker.virtualThread2 = it
+ } else if (it != Locker.virtualThread2) {
+ VineLogger.get()
+ .error("Forbidden to modify the parameter \"$BASEPATH.vt2\" during runtime!!!")
+ }
+ } else if (it != Locker.virtualThread2)
+ VineLogger.error("Forbidden to modify the parameter \"$BASEPATH.vt2\" during runtime!!!")
+ }
+ }
+}
Expand Down

0 comments on commit 4992296

Please sign in to comment.