diff --git a/gradle.properties b/gradle.properties index 8272593..af4bce7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,4 +12,4 @@ my_modid=ariasessentials mc_version=1.18.2 forge_version=40.2.1 parchment_version=2022.11.06 -libz_version=1.0.5.0306230154 +libz_version=1.0.5.0306230211 diff --git a/src/main/java/dev/zontreck/essentials/commands/teleport/TPACommand.java b/src/main/java/dev/zontreck/essentials/commands/teleport/TPACommand.java index ed0b3b3..612991d 100644 --- a/src/main/java/dev/zontreck/essentials/commands/teleport/TPACommand.java +++ b/src/main/java/dev/zontreck/essentials/commands/teleport/TPACommand.java @@ -9,6 +9,7 @@ import dev.zontreck.libzontreck.chat.HoverTip; import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.util.ChatHelpers; +import dev.zontreck.libzontreck.util.DelayedExecutorService; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; @@ -47,7 +48,7 @@ public class TPACommand { return 1; } - TeleportContainer cont = new TeleportContainer(play.getUUID(), serverPlayer.getUUID()); + final TeleportContainer cont = new TeleportContainer(play.getUUID(), serverPlayer.getUUID()); for(TeleportContainer cont2 : TeleportRegistry.get()){ if(cont2.compareTo(cont)==0){ @@ -93,6 +94,17 @@ public class TPACommand { append(ChatHelpers.macro(Messages.TELEPORT_DENY).setStyle(s2)), serverPlayer.server); TeleportRegistry.get().add(cont); + DelayedExecutorService.getInstance().schedule(new Runnable(){ + @Override + public void run() + { + if(!(TeleportRegistry.get().contains(cont)))return; + TeleportRegistry.get().remove(cont); + + ChatHelpers.broadcastTo(cont.ToPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer()); + ChatHelpers.broadcastTo(cont.FromPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer()); + } + }, 30); return 0; } diff --git a/src/main/java/dev/zontreck/essentials/commands/teleport/TPAHereCommand.java b/src/main/java/dev/zontreck/essentials/commands/teleport/TPAHereCommand.java index d729fc9..f093244 100644 --- a/src/main/java/dev/zontreck/essentials/commands/teleport/TPAHereCommand.java +++ b/src/main/java/dev/zontreck/essentials/commands/teleport/TPAHereCommand.java @@ -9,6 +9,7 @@ import dev.zontreck.libzontreck.chat.HoverTip; import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.util.ChatHelpers; +import dev.zontreck.libzontreck.util.DelayedExecutorService; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; @@ -44,7 +45,7 @@ public class TPAHereCommand { return 1; } - TeleportContainer cont = new TeleportContainer(serverPlayer.getUUID(), play.getUUID()); + final TeleportContainer cont = new TeleportContainer(serverPlayer.getUUID(), play.getUUID()); for(TeleportContainer cont2 : TeleportRegistry.get()){ if(cont2.compareTo(cont)==0){ @@ -88,6 +89,18 @@ public class TPAHereCommand { append(ChatHelpers.macro(Messages.TELEPORT_DENY).setStyle(s2)), serverPlayer.server); TeleportRegistry.get().add(cont); + + DelayedExecutorService.getInstance().schedule(new Runnable(){ + @Override + public void run() + { + if(!(TeleportRegistry.get().contains(cont)))return; + TeleportRegistry.get().remove(cont); + + ChatHelpers.broadcastTo(cont.ToPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer()); + ChatHelpers.broadcastTo(cont.FromPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer()); + } + }, 30); return 0; }