AuthMeReloaded icon indicating copy to clipboard operation
AuthMeReloaded copied to clipboard

Paper teleportAsync blocked during PlayerSpawnLocationEvent or PlayerJoinEvent

Open MithrandirCraft opened this issue 3 years ago • 2 comments

What behaviour is observed?

The following code is obstructed by a loaded AuthMeReloaded: https://gist.github.com/MithrandirCraft/108cfd2a34db7cfa54c83afa1bc72922 In essence, attempting to execute teleport, or teleportAsync during PlayerSpawnLocationEvent or PlayerJoinEvent.

In line 28, player.teleportAsync() will never complete. I am naively asuming this is happening because AuthMe is forcing it's own teleportation based on logout coordinates.

The event will also not prioritize my own teleportAsync if I set EventHandler(priority = EventPriority.HIGHEST)

I also tried teleporting the player with a 5 tick delay after join, with no luck. I could try higher, but really it sonds like a bad solution so I dropped that option.

This does not happen without a loaded instance of AuthMeReloaded on the same server.

Expected behaviour

I don't know really. I'd say this is kinda normal considering how AuthMe handles login coordinates. I'd just like to know what the workaround is for this.

My system is supposed to check if the player's spawn coordinates on login are within an area (line 24 of my code, returning a Location and not null), if so, the player is sent to spawn, else the player appears in it's last logout coordinates.

To Reproduce

  1. Have AuthMeReloaded loaded on a blank paper server.
  2. Have a separate plugin with player.teleportAsync on a separate jar for PlayerSpawnLocationEvent or PlayerJoinEvent.
  3. Join the server and notice the teleport will not occur.

Plugin list

Plugins (54): 40ServidoresMC, AdvancedPortals, AuthMe, BanFromClaim, BetterChair, BetterRTP, BottledExp, BungeeTabListPlus, ChatControlRed, ClearLag, CMILib, CoreProtect, CrazyCrates, CustomJukebox, DisableSuffocation, DownloadResourcePack, ElytraBalance, EnjinMinecraftPlugin, Essentials, EssentialsSpawn, FastAsyncVoxelSniper, FastAsyncWorldEdit (WorldEdit), FastLogin, GriefDefender, Guilds, HolographicDisplays, HolographicScoreboard*, HopeCommander-Spigot*, JukeboxRegion, LibsDisguises, LuckPerms, MarriageMaster, MiniaturePets, MythicMobs, NameMCVotifierHook, NerfVillages, PlaceholderAPI, PlayerHeads, PlayerWarps, PremiumVanish, ProtocolLib, Shopkeepers, SkinsRestorer, Spartan, Spawner, SSX-Connector, StatsPvP*, Storage, TradeSystem, Vault, ViewDistanceTweaks, Votifier, VotingPlugin, WorldGuard

Server Implementation

BungeeCord

Database Implementation

MySQL

AuthMe Version

5.6.0-SNAPSHOT-b2530

Error log (if applicable)

No response

Configuration

https://gist.github.com/MithrandirCraft/e19e818e7f3abf30a2cfc4a8359bd52d

MithrandirCraft avatar Dec 03 '22 18:12 MithrandirCraft

In the config, try changing noTeleport setting and you still have teleportUnAuthedToSpawn enabled...

krusic22 avatar Dec 03 '22 18:12 krusic22

noTeleport this does indeed fix the issue. But it will make teleportUnAuthedToSpawn not work, of course you could argue the whole event gets overriden by the unauthed to spawn behaviour.

Maybe the best option would be hooking up to the AuthMe API?

MithrandirCraft avatar Dec 03 '22 20:12 MithrandirCraft