EssentialsX

EssentialsX

2M Downloads

Random teleport should have a message letting you know that it's searching for a location

DavidVrckovic opened this issue ยท 6 comments

commented

Feature description

Here is the video that demonstrates the two issues I am discussing below.

When executing the random teleport command, nothing happens for about 10+ seconds, and it suddenly outputs the "teleportation will commence in 3 seconds" message. If the player is doing something like moving during this time and not paying attention, it can easily cause the teleportation to cancel.

There should be a message immediately after the player types in the command, letting them know it is searching for a safe location. This will prevent accidental teleport cancellations.

If there is a cooldown defined for the random teleport command, and the teleportation is cancelled before it completes, the player can't type the command again for the set time despite the player not being teleported.

This left many players on my server frustrated because they had to wait a while to just accidentally cancel the teleportation, only to wait even longer for another attempt. I think the cooldown should only apply if the player teleports successfully.

I am aware that this might cause another concern: Players can just use rtp right after cancelling the teleport, and the server will search for another location and therefore utilise a lot of resources. This is the main reason I set the cooldown in the first place. The only solution I can think of would be if the players cancel the teleport, the plugin remembers the found location and teleports them there on their next attempt to not waste resources for another safe location search.

How the feature is useful

The above will mostly benefit players as they will get less frustrated by all the waiting and accidental teleport cancellations.

commented

Something doesn't really line up here - random teleport is almost never searching for locations as the locations are cached. When there are not enough cached locations remaining it will cache more, so that when players actually use the command it is nearly instant (and as a result, no extra message is necessary).

Is it possible that something else is delaying the teleportation on your server?

commented

See if it happens without other plugins installed. But yeah, on my server the time between typing /tpr and actually teleporting is generally a few milliseconds.

commented

Oh, I did not know that it caches the locations. I'm not sure if there could be something delaying it.

Here is the dump if it helps: https://essentialsx.net/dump.html?id=f4cf4ac515f2434896c92e27a11c7d85

commented

Okay, I will try and test. Might take some time because I really want to find out what's causing it.

So since random teleport caches the locations, could the second issue be addressed - the cooldown?

commented

Here is what I've figured out after testing: The first time someone uses random teleport on the server after the server is booted up, it will take 10 or more seconds to teleport them, but after that, it does teleport immediately every time (even after 100 attempts).

I've tried removing the plugins one by one until I've ended up with only 3 - Essentials, LuckPerms and Vault. I have also tried deleting the worlds so the server can generate brand-new ones. And finally, I tried on an entirely different server I made from scratch (default configs, server properties, etc.), but none of this made any difference.

commented

Ah okay, that makes much more sense. Caching doesn't normally take effect until the first time the command is used. This is specifically done to prevent Essentials from potentially generating random new chunks in the users' world if they are potentially not even using the random teleport feature.

To enable pre-caching (which ensures that there is always cache on startup) set pre-cache to true in tpr.yml.