Jump to content

[1.7.10] Good event to stop a login?


Shamu

Recommended Posts

Hey all,

I currently have PlayerLoggedInEvent for a whitelist mod I made. Only problem with this is it still shows the "X logged in" on the server to all of the players. This allows people to spam the chat when they try to connect.

 

Basically I'm catching people when they log in then kicking them if they aren't on the list. This seems very inefficient to me, but I haven't found an alternate at this point. I've looked in other mods that featured some sort of whitelist and they all seem to be doing roughly the same thing, maybe a different event but similar and still have the problem that the player connects before getting kicked.

The vanilla whitelist doesn't have this happen and seems to fire when they first attempt to make a connection to the server. During this phase I can see the UUID of a player and their Username but can't find how/if I can interact with them and essentially cancel their connection request and shoot back a message.

I don't want to add people to the vanilla whitelist because that also seems not quite right.

 

So, Is there an event that fires when a player attempts to connect, or is there a way to register a connection handler that I can intercept connections before the server sees them?

 

Also dealing with people crashing when getting kicked but only if there are X number of mods in the client.. but that is something for another day, since I don't even know the limit of mods before a crash happens.

Link to comment
Share on other sites

Well, there's this:

 

FMLNetworkEvent.ServerConnectionFromClientEvent Fired at the server when a client is about to connect

 

Which MAY work. The server would store the list, and if the client is "owned" by a non-whitelisted identity, then you may be able to kick said person using this event.

Link to comment
Share on other sites

Well, there's this:

 

FMLNetworkEvent.ServerConnectionFromClientEvent Fired at the server when a client is about to connect

 

Which MAY work. The server would store the list, and if the client is "owned" by a non-whitelisted identity, then you may be able to kick said person using this event.

 

Hm, I can't seem to find a way to grab the player from that event. Might be my lack of knowledge, but it just doesn't seem like it.

It does fire before the player joins.. so if there is a way this would be optimal.

Thank you though!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.