Automatic Group placement upon server join
KJ-Shipp opened this issue ยท 5 comments
I'm trying to find out how to set things up so that when a player joins the server they are automatically placed into a custom group. I understand how to script it, roughly, but I don't know how to make the action happen upon login. Where and how do I initiate an action when a player logs in. Any help would be greatly appreciated.
From a technical standpoint, you are not able to auto assign a rank using the permission system alone. However, all players not explicitly assigned to a group are put in the _GUEST_ group. For your base player group, it is easiest to just modify the prefix to be what ever name you want your default group to be.
You can also make a group (like guest) inherit the permissions of another group, however, it is usually easiest to just make the GUESTS group your base group and any higher ranks inherit from that group.
If you have more questions, feel free to join our discord (or irc).
As for initiating an action on login, you can follow the scripting tutorial here.
https://github.com/ForgeEssentials/ForgeEssentials/wiki/JS-Scripting
Unless you want to do something fancy however (like award a rank to a player after a certain amount of time, etc) you should be fine sticking to the permissions system.
As for checking for login events, try registering a Event of FePlayerEvent and checking getEventType().
Specifically, look for the "ClientHandshakeEstablished" event.
it looks like that event is called when the player first joins the server.
JavaScript/TypeScript are a bit outside of my knowledge. I know some other languages but not these two, yet. Going to do some research on all of it to try to establish a general knowledge base. Thank you for your guidance. Any general direction/location you can send me so I may learn a bit more. I'd like to get some JavaScript under my belt.. Looking to eventually build my own mods for my server. Thanks again.
Also, would you mind if, when I come up with something, I send it to you, and you tell me if I made mistakes? If you have time.
If you have questions, please ask on our discord.
You will get much faster responses there!