4drian3d / AuthMeVelocity

AuthMeReloaded support for Velocity proxy
https://modrinth.com/plugin/authmevelocity
GNU General Public License v3.0
67 stars 14 forks source link

Feature Request: TO_LAST_CONNECTED option for send-on-login #112

Closed RealTriassic closed 1 year ago

RealTriassic commented 1 year ago

A similar feature request for something like this is still open on the AuthMeBungee repository, I have made a very basic implementation of this as seen here, except it's functionality is limited to only Bungeecord & AuthMeBungee.

I believe since AuthMeVelocity is fairly actively maintained unlike AuthMeBungee, this simple functionality could be built straight into the plugin instead of having a seperate plugin for it, but, unfortunately I am too unfamiliar with this code base and Velocity as a whole to implement this myself.

It isn't exactly difficult to implement as evident by my implementation on Bungeecord, whilst being basic, it is completely functional, the player's last server is written to a yml file on server switch and when the player leaves the server and then once the player logs back onto the server, they are returned back to the server defined in the yml file.

4drian3d commented 1 year ago

A similar feature request for something like this is still open on the AuthMeBungee repository, I have made a very basic implementation of this as seen here, except it's functionality is limited to only Bungeecord & AuthMeBungee.

I believe since AuthMeVelocity is fairly actively maintained unlike AuthMeBungee, this simple functionality could be built straight into the plugin instead of having a seperate plugin for it, but, unfortunately I am too unfamiliar with this code base and Velocity as a whole to implement this myself.

It isn't exactly difficult to implement as evident by my implementation on Bungeecord, whilst being basic, it is completely functional, the player's last server is written to a yml file on server switch and when the player leaves the server and then once the player logs back onto the server, they are returned back to the server defined in the yml file.

I think it would be best to implement this functionality in another plugin, as it is not the purpose of AuthMeVelocity to store the last server a user joined, plus probably other functions need to be added. Also, I would not want to make a configuration file storage system, which would be too inefficient. A simple local database in sqlite or H2 would be best. Also, unlike AuthMeBungee, in AuthMeVelocity it would be too easy to implement this feature externally, just use the https://javadoc.io/doc/io.github.4drian3d/authmevelocity-api-velocity/latest/io.github._4drian3d.authmevelocity.api.velocity/io/github/_4drian3d/authmevelocity/api/velocity/event/PreSendOnLoginEvent.html event

RealTriassic commented 1 year ago

A similar feature request for something like this is still open on the AuthMeBungee repository, I have made a very basic implementation of this as seen here, except it's functionality is limited to only Bungeecord & AuthMeBungee. I believe since AuthMeVelocity is fairly actively maintained unlike AuthMeBungee, this simple functionality could be built straight into the plugin instead of having a seperate plugin for it, but, unfortunately I am too unfamiliar with this code base and Velocity as a whole to implement this myself. It isn't exactly difficult to implement as evident by my implementation on Bungeecord, whilst being basic, it is completely functional, the player's last server is written to a yml file on server switch and when the player leaves the server and then once the player logs back onto the server, they are returned back to the server defined in the yml file.

I think it would be best to implement this functionality in another plugin, as it is not the purpose of AuthMeVelocity to store the last server a user joined, plus probably other functions need to be added. Also, I would not want to make a configuration file storage system, which would be too inefficient. A simple local database in sqlite or H2 would be best. Also, unlike AuthMeBungee, in AuthMeVelocity it would be too easy to implement this feature externally, just use the https://javadoc.io/doc/io.github.4drian3d/authmevelocity-api-velocity/latest/io.github._4drian3d.authmevelocity.api.velocity/io/github/_4drian3d/authmevelocity/api/velocity/event/PreSendOnLoginEvent.html event

Alright, thank you for your reply, I will look into this

4drian3d commented 1 year ago

https://github.com/4drian3d/AuthMeVelocity-LastServerAddon in a few minutes I will finish it

4drian3d commented 1 year ago

done https://github.com/4drian3d/AuthMeVelocity-LastServerAddon/releases/tag/1.0.0 The plugin has not been tested, but it should work fine. In case of any error, you can report it in the corresponding repository

RealTriassic commented 1 year ago

done https://github.com/4drian3d/AuthMeVelocity-LastServerAddon/releases/tag/1.0.0 The plugin has not been tested, but it should work fine. In case of any error, you can report it in the corresponding repository

Wow this is really cool, I really like how you've used h2 instead of yml files like me. That is a way better way of storing this data!

It would be really cool if there was a way to require players to have a specific permission to return to their last connected server, but apart from that, it looks really good

RealTriassic commented 1 year ago

done https://github.com/4drian3d/AuthMeVelocity-LastServerAddon/releases/tag/1.0.0 The plugin has not been tested, but it should work fine. In case of any error, you can report it in the corresponding repository

After looking over the plugin's code, it appears that it doesn't make any checks to ensure that the last server isn't set to a login server on save and also doesn't check to make sure that the player's last server is online

On Bungeecord, checking this would be as easy as doing something like this image

I am not certain if this possible on Velocity though, but if the player's last server is offline, I'd assume the player gets stuck in the login server. On ReturnMe, if lastServer.ping returns any error, it sends the player to the default server that is defined in the configuration file, maybe something something similar could be done here?

4drian3d commented 1 year ago

done https://github.com/4drian3d/AuthMeVelocity-LastServerAddon/releases/tag/1.0.0 The plugin has not been tested, but it should work fine. In case of any error, you can report it in the corresponding repository

After looking over the plugin's code, it appears that it doesn't make any checks to ensure that the last server isn't set to a login server on save and also doesn't check to make sure that the player's last server is online

On Bungeecord, checking this would be as easy as doing something like this image

I am not certain if this possible on Velocity though, but if the player's last server is offline, I'd assume the player gets stuck in the login server. On ReturnMe, if lastServer.ping returns any error, it sends the player to the default server that is defined in the configuration file, maybe something something similar could be done here?

https://github.com/4drian3d/AuthMeVelocity-LastServerAddon/commit/fa6c0c9d6da475dd8ee29222933a55ca6e889b70