RonanPlugins / BetterRTP

Official wiki of the BetterRTP plugin!
https://www.spigotmc.org/resources/36081/
MIT License
108 stars 83 forks source link

First Join RTP Save Location #152

Open roracle opened 1 year ago

roracle commented 1 year ago

Plugin Version: 3.6.10

Request: An option with the "First join RTP" settings that allow us to save the location of that player and reference it with a placeholder, such as %betterrtp_player_spawn%. This way using other plugins, we can alias a teleport command with /spawn to execute /tp %player% %betterrtp_player_spawn% OR a built-in /spawn command override that automatically sends them to their first spawn location.

How/Why: To allow servers a way to hedge against griefers in their creative worlds.

Additional Context: No additional context, but I love this plugin :)

TechnicallyCoded commented 1 year ago

Correct way:

Make your plugin use RTP_TeleportPostEvent and save that location only once. Ignore subsequent RTPs by that player.

Hacky/incorrect way:

Set the following settings

  RtpOnFirstJoin: # Will execute as console to override delays
    Enabled: true # Make the player rtp when joining the server for the first time
    # Doesn't matter for this :: World: world # World to first rtp in
    # Doesn't matter for this :: SetAsRespawn: true # Save this first rtp as players new spawn point

Now use the player join event on priority MONITOR and get the player's location. Save it.

TechnicallyCoded commented 1 year ago

Avoid placeholders for transmitting data at all costs.

roracle commented 1 year ago

Correct way:

Make your plugin use RTP_TeleportPostEvent and save that location only once. Ignore subsequent RTPs by that player.

Hacky/incorrect way:

Set the following settings

  RtpOnFirstJoin: # Will execute as console to override delays
    Enabled: true # Make the player rtp when joining the server for the first time
    # Doesn't matter for this :: World: world # World to first rtp in
    # Doesn't matter for this :: SetAsRespawn: true # Save this first rtp as players new spawn point

Now use the player join event on priority MONITOR and get the player's location. Save it.

I have no idea what you mean by some of this but I can infer. I don't know how to do plugins, but I'm great at bug reports, suggestions, etc. lol

It would be a nice addition. If I knew how I would make it. Sounds like it would be simple enough, but I wouldn't know where to start.

SuperRonanCraft commented 8 months ago

Correct way:

Make your plugin use RTP_TeleportPostEvent and save that location only once. Ignore subsequent RTPs by that player.

Hacky/incorrect way:

Set the following settings

  RtpOnFirstJoin: # Will execute as console to override delays
    Enabled: true # Make the player rtp when joining the server for the first time
    # Doesn't matter for this :: World: world # World to first rtp in
    # Doesn't matter for this :: SetAsRespawn: true # Save this first rtp as players new spawn point

Now use the player join event on priority MONITOR and get the player's location. Save it.

This reminds me, I should change the way this get triggered, instead of having Minecraft save player data as some servers might delete this kinda data. BetterRTP should save its self if its seen a player before, else teleport them for the first time.