Skip to content

Commit

Permalink
Rename some config
Browse files Browse the repository at this point in the history
  • Loading branch information
MC-XiaoHei authored Jul 23, 2024
1 parent 913fb0b commit b05969d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 32 deletions.
37 changes: 9 additions & 28 deletions patches/server/0004-Lumina-server-config-and-command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -431,20 +431,18 @@ index 0000000000000000000000000000000000000000..4a50bf4aae9cb4c20e160e0739aa1db4
+}
diff --git a/src/main/java/org/leavesmc/lumina/config/modules/Fix.java b/src/main/java/org/leavesmc/lumina/config/modules/Fix.java
new file mode 100644
index 0000000000000000000000000000000000000000..3c084fbef60b6c560c8f0648acf57413ae6b60c5
index 0000000000000000000000000000000000000000..9ce750c78fdd04d62f97ed590226650079ca77bf
--- /dev/null
+++ b/src/main/java/org/leavesmc/lumina/config/modules/Fix.java
@@ -0,0 +1,13 @@
@@ -0,0 +1,11 @@
+package org.leavesmc.lumina.config.modules;
+
+import org.leavesmc.lumina.config.modules.fix.FoliaEntityMovingFixConfig;
+import org.leavesmc.lumina.config.modules.fix.FoliaTeleportAsyncFixConfig;
+import org.leavesmc.lumina.config.modules.fix.FixFoliaTeleportAsyncConfig;
+import org.spongepowered.configurate.objectmapping.ConfigSerializable;
+
+@ConfigSerializable
+public class Fix {
+ public FoliaEntityMovingFixConfig fixEntityMoving = new FoliaEntityMovingFixConfig();
+ public FoliaTeleportAsyncFixConfig fixTeleportAsync = new FoliaTeleportAsyncFixConfig();
+ public FixFoliaTeleportAsyncConfig fixFoliaTeleportAsync = new FixFoliaTeleportAsyncConfig();
+ public boolean fixFoliaSpectorTeleport = true;
+ public boolean fixFoliaPoiAccessOffRegion = true;
+}
Expand Down Expand Up @@ -509,35 +507,18 @@ index 0000000000000000000000000000000000000000..6b93c0bf96b2a1b779ab12b2b65245fd
+ public boolean enableCarpetProtocol = false;
+ public LeavesBladerenProtocolConfig leavesBladerenProtocol = new LeavesBladerenProtocolConfig();
+}
diff --git a/src/main/java/org/leavesmc/lumina/config/modules/fix/FoliaEntityMovingFixConfig.java b/src/main/java/org/leavesmc/lumina/config/modules/fix/FoliaEntityMovingFixConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..4f8d731b897c8550d7a2b034146d4b99c0a3de45
--- /dev/null
+++ b/src/main/java/org/leavesmc/lumina/config/modules/fix/FoliaEntityMovingFixConfig.java
@@ -0,0 +1,10 @@
+package org.leavesmc.lumina.config.modules.fix;
+
+import org.spongepowered.configurate.objectmapping.ConfigSerializable;
+import org.spongepowered.configurate.objectmapping.meta.Setting;
+
+@ConfigSerializable
+public class FoliaEntityMovingFixConfig {
+ public boolean enabled = false;
+ public boolean warnOnDetected = true;
+}
diff --git a/src/main/java/org/leavesmc/lumina/config/modules/fix/FoliaTeleportAsyncFixConfig.java b/src/main/java/org/leavesmc/lumina/config/modules/fix/FoliaTeleportAsyncFixConfig.java
diff --git a/src/main/java/org/leavesmc/lumina/config/modules/fix/FixFoliaTeleportAsyncConfig.java b/src/main/java/org/leavesmc/lumina/config/modules/fix/FixFoliaTeleportAsyncConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..9552e998a723693f700e0a26542691791a59f9e5
index 0000000000000000000000000000000000000000..b043bf36de0604028cb7bdd166d000d2dec76360
--- /dev/null
+++ b/src/main/java/org/leavesmc/lumina/config/modules/fix/FoliaTeleportAsyncFixConfig.java
@@ -0,0 +1,10 @@
+++ b/src/main/java/org/leavesmc/lumina/config/modules/fix/FixFoliaTeleportAsyncConfig.java
@@ -0,0 +1,9 @@
+package org.leavesmc.lumina.config.modules.fix;
+
+import org.spongepowered.configurate.objectmapping.ConfigSerializable;
+import org.spongepowered.configurate.objectmapping.meta.Setting;
+
+@ConfigSerializable
+public class FoliaTeleportAsyncFixConfig {
+public class FixFoliaTeleportAsyncConfig {
+ public boolean enabled = false;
+ public boolean throwOnDetected = true;
+}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent teleportAsync calling during moving event being


diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index fdd745062f1516338cf91489d9e64f706912b470..053801f728638d70f45e711922f8f101a40d098c 100644
index 29f8946dc609056c28ed2cf819e25feb086b2d9a..3c95ea6fdab99e414270fd5ed960c539b7ada265 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -346,6 +346,10 @@ public class ServerPlayer extends Player {
Expand Down Expand Up @@ -44,17 +44,17 @@ index 2ae2527bbe5a08af98eb6405a8403c2199052f19..7ddb7d5aa1047eb8151aef01d5db694d
// If the event is cancelled we move the player back to their old location.
if (event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index bfc6c269d96201e8001b6575d4cb59cd70d1d7bc..d50fef64e608a4cb7aa06e5037474061bb1d02e4 100644
index bfc6c269d96201e8001b6575d4cb59cd70d1d7bc..676feaa5670d703429a987ff274ccfa755d64183 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4038,6 +4038,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
java.util.function.Consumer<Entity> teleportComplete) {
io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot teleport entity async");

+ //Luminol start - Prevent teleportAsync calling during moving event being handled
+ if (this instanceof ServerPlayer player && org.leavesmc.lumina.config.LuminaConfig.configModule.fix.fixTeleportAsync.enabled){
+ if (this instanceof ServerPlayer player && org.leavesmc.lumina.config.LuminaConfig.configModule.fix.fixFoliaTeleportAsync.enabled){
+ if (player.handlingMoveEvent){
+ if (org.leavesmc.lumina.config.LuminaConfig.configModule.fix.fixTeleportAsync.throwOnDetected){
+ if (org.leavesmc.lumina.config.LuminaConfig.configModule.fix.fixFoliaTeleportAsync.throwOnDetected){
+ throw new IllegalStateException("Player " + player.getScoreboardName() + " is trying to teleport to " + pos + " during move event handling!");
+ }
+ MinecraftServer.LOGGER.warn("Player {} is trying to teleport to {} during move event handling!",player.getScoreboardName(),pos);
Expand Down

0 comments on commit b05969d

Please sign in to comment.