SPIGOT-7171: Ability to get the IP/hostname players are requesting status of

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-10-28 20:19:11 +11:00
parent a8d96f30a4
commit 814c67ace8
5 changed files with 25 additions and 29 deletions

View File

@@ -317,7 +317,7 @@
- @Nullable
- public IChatBaseComponent canPlayerLogin(SocketAddress socketaddress, GameProfile gameprofile) {
+ // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer
+ public EntityPlayer canPlayerLogin(LoginListener loginlistener, GameProfile gameprofile, ProfilePublicKey profilepublickey, String hostname) {
+ public EntityPlayer canPlayerLogin(LoginListener loginlistener, GameProfile gameprofile, ProfilePublicKey profilepublickey) {
IChatMutableComponent ichatmutablecomponent;
- if (this.bans.isBanned(gameprofile)) {
@@ -349,7 +349,7 @@
+
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getLevel(World.OVERWORLD), gameprofile, profilepublickey);
+ Player player = entity.getBukkitEntity();
+ PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress());
+ PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress());
+
+ if (getBans().isBanned(gameprofile) && !getBans().get(gameprofile).hasExpired()) {
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);