From 4ee9e4d81e5d2b8a71613a61e53f4d4e3a8891f2 Mon Sep 17 00:00:00 2001 From: FishyFinn Date: Tue, 24 Dec 2024 12:32:45 +1100 Subject: [PATCH 1/2] added LP Meta for custom command_warmup times --- .../mixin/teleport_warmup/ServerPlayerMixin.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/sakurawald/module/mixin/teleport_warmup/ServerPlayerMixin.java b/src/main/java/io/github/sakurawald/module/mixin/teleport_warmup/ServerPlayerMixin.java index d164a418..58c87e29 100644 --- a/src/main/java/io/github/sakurawald/module/mixin/teleport_warmup/ServerPlayerMixin.java +++ b/src/main/java/io/github/sakurawald/module/mixin/teleport_warmup/ServerPlayerMixin.java @@ -1,6 +1,7 @@ package io.github.sakurawald.module.mixin.teleport_warmup; import io.github.sakurawald.core.auxiliary.minecraft.EntityHelper; +import io.github.sakurawald.core.auxiliary.minecraft.PermissionHelper; import io.github.sakurawald.core.auxiliary.minecraft.RegistryHelper; import io.github.sakurawald.core.auxiliary.minecraft.TextHelper; import io.github.sakurawald.core.manager.Managers; @@ -15,6 +16,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import java.util.Optional; import java.util.Set; @Mixin(value = ServerPlayerEntity.class, priority = 1000 - 500) @@ -32,14 +34,18 @@ public void interceptTeleportAndAddTicket(ServerWorld serverWorld, double x, dou // If we try to spawn a fake-player in the end or nether, the fake-player will initially spawn in overworld // and teleport to the target world. This will cause the teleport warmup to be triggered. if (!EntityHelper.isRealPlayer(player)) return; - TeleportTicket ticket = TeleportWarmupInitializer.getTeleportTicket(player); + + Optional permission_warmup_time = PermissionHelper.getMeta(player.getUuid(), "fuji.teleport_warmup.warmup", Integer::valueOf); + //set warmup seconds to LP permission seconds or default config seconds + int warmup_seconds = permission_warmup_time.orElse(TeleportWarmupInitializer.config.model().warmup_second); + if (ticket == null) { ticket = TeleportTicket.make( player , SpatialPose.of(player) , new SpatialPose(serverWorld, x, y, z, yaw, pitch) - , TeleportWarmupInitializer.config.model().warmup_second * 1000 + , warmup_seconds * 1000 , TeleportWarmupInitializer.config.model().interruptible ); Managers.getBossBarManager().addTicket(ticket); From f0bc44ffb47011b80c3bf5ab40b12b6df21ecce0 Mon Sep 17 00:00:00 2001 From: FishyFinn Date: Tue, 24 Dec 2024 22:49:44 +1100 Subject: [PATCH 2/2] Added meta to doc --- docs/chapters/module/teleport_warmup/teleport_warmup.tex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/chapters/module/teleport_warmup/teleport_warmup.tex b/docs/chapters/module/teleport_warmup/teleport_warmup.tex index c350587a..4ec6ca73 100644 --- a/docs/chapters/module/teleport_warmup/teleport_warmup.tex +++ b/docs/chapters/module/teleport_warmup/teleport_warmup.tex @@ -30,3 +30,7 @@ } \end{Configuration} +\LevelTwo{Meta} +\begin{description} + \item [fuji.teleport_warmup.warmup] The per player teleport warmup time in seconds. +\end{description}