Publish a quick bugfix to AE

This commit is contained in:
Aria 2023-03-06 02:12:13 -07:00
parent 0b1535cc38
commit 6ec1f51808
3 changed files with 28 additions and 3 deletions

View file

@ -12,4 +12,4 @@ my_modid=ariasessentials
mc_version=1.18.2 mc_version=1.18.2
forge_version=40.2.1 forge_version=40.2.1
parchment_version=2022.11.06 parchment_version=2022.11.06
libz_version=1.0.5.0306230154 libz_version=1.0.5.0306230211

View file

@ -9,6 +9,7 @@ import dev.zontreck.libzontreck.chat.HoverTip;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.util.DelayedExecutorService;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.commands.arguments.EntityArgument;
@ -47,7 +48,7 @@ public class TPACommand {
return 1; return 1;
} }
TeleportContainer cont = new TeleportContainer(play.getUUID(), serverPlayer.getUUID()); final TeleportContainer cont = new TeleportContainer(play.getUUID(), serverPlayer.getUUID());
for(TeleportContainer cont2 : TeleportRegistry.get()){ for(TeleportContainer cont2 : TeleportRegistry.get()){
if(cont2.compareTo(cont)==0){ if(cont2.compareTo(cont)==0){
@ -93,6 +94,17 @@ public class TPACommand {
append(ChatHelpers.macro(Messages.TELEPORT_DENY).setStyle(s2)), serverPlayer.server); append(ChatHelpers.macro(Messages.TELEPORT_DENY).setStyle(s2)), serverPlayer.server);
TeleportRegistry.get().add(cont); 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; return 0;
} }

View file

@ -9,6 +9,7 @@ import dev.zontreck.libzontreck.chat.HoverTip;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.util.DelayedExecutorService;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.commands.arguments.EntityArgument;
@ -44,7 +45,7 @@ public class TPAHereCommand {
return 1; return 1;
} }
TeleportContainer cont = new TeleportContainer(serverPlayer.getUUID(), play.getUUID()); final TeleportContainer cont = new TeleportContainer(serverPlayer.getUUID(), play.getUUID());
for(TeleportContainer cont2 : TeleportRegistry.get()){ for(TeleportContainer cont2 : TeleportRegistry.get()){
if(cont2.compareTo(cont)==0){ if(cont2.compareTo(cont)==0){
@ -88,6 +89,18 @@ public class TPAHereCommand {
append(ChatHelpers.macro(Messages.TELEPORT_DENY).setStyle(s2)), serverPlayer.server); append(ChatHelpers.macro(Messages.TELEPORT_DENY).setStyle(s2)), serverPlayer.server);
TeleportRegistry.get().add(cont); 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; return 0;
} }