2023-10-29 17:02:58 +01:00
From d0f2a03e3eae67f9385a46706668c87fc327af94 Mon Sep 17 00:00:00 2001
2017-08-10 18:41:17 +02:00
From: phenomax <phenomax@revayd.net>
Date: Thu, 10 Aug 2017 18:41:17 +0200
Subject: [PATCH] Providing access to the player's LoginResult on LoginEvent
diff --git a/api/src/main/java/net/md_5/bungee/api/event/LoginEvent.java b/api/src/main/java/net/md_5/bungee/api/event/LoginEvent.java
2023-10-29 17:02:58 +01:00
index 4c09efff..46517e03 100644
2017-08-10 18:41:17 +02:00
--- a/api/src/main/java/net/md_5/bungee/api/event/LoginEvent.java
+++ b/api/src/main/java/net/md_5/bungee/api/event/LoginEvent.java
2023-10-29 17:02:58 +01:00
@@ -8,6 +8,7 @@ import net.md_5.bungee.api.chat.BaseComponent;
2017-08-10 18:41:17 +02:00
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.plugin.Cancellable;
+import net.md_5.bungee.connection.LoginResult; // Waterfall: Parse LoginResult object to new constructor of LoginEvent
2018-01-07 18:04:30 +01:00
2017-08-10 18:41:17 +02:00
/**
* Event called to represent a player logging in.
2023-10-29 17:02:58 +01:00
@@ -26,6 +27,13 @@ public class LoginEvent extends AsyncEvent<LoginEvent> implements Cancellable
* Message to use when kicking if this event is canceled.
2017-08-10 18:41:17 +02:00
*/
2023-10-29 17:02:58 +01:00
private BaseComponent reason;
2017-08-10 18:41:17 +02:00
+ // Waterfall start - adding the LoginResult variable to provide access to it, when calling the login event
+ /**
+ * The player's login result containing his textures
+ */
+ private LoginResult loginResult;
+ // Waterfall end
+
/**
* Connection attempting to login.
*/
2023-10-29 17:02:58 +01:00
@@ -37,6 +45,15 @@ public class LoginEvent extends AsyncEvent<LoginEvent> implements Cancellable
2017-08-10 18:41:17 +02:00
this.connection = connection;
}
2018-01-07 18:04:30 +01:00
2017-08-10 18:41:17 +02:00
+ // Waterfall start - adding new constructor for LoginResult
+ public LoginEvent(PendingConnection connection, Callback<LoginEvent> done, LoginResult loginResult)
+ {
+ super( done );
+ this.connection = connection;
+ this.loginResult = loginResult;
+ }
+ // Waterfall end
+
/**
* @return reason to be displayed
2023-10-29 17:02:58 +01:00
* @deprecated use component methods instead
2017-08-10 18:41:17 +02:00
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/LoginResult.java b/api/src/main/java/net/md_5/bungee/connection/LoginResult.java
similarity index 100%
rename from proxy/src/main/java/net/md_5/bungee/connection/LoginResult.java
rename to api/src/main/java/net/md_5/bungee/connection/LoginResult.java
diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
2023-10-29 17:02:58 +01:00
index 300d90f4..ecaab6bd 100644
2017-08-10 18:41:17 +02:00
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
2023-10-29 17:02:58 +01:00
@@ -613,7 +613,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
2017-08-10 18:41:17 +02:00
};
2018-01-07 18:04:30 +01:00
2017-08-10 18:41:17 +02:00
// fire login event
- bungee.getPluginManager().callEvent( new LoginEvent( InitialHandler.this, complete ) );
+ bungee.getPluginManager().callEvent( new LoginEvent( InitialHandler.this, complete, this.getLoginProfile() ) ); // Waterfall: Parse LoginResult object to new constructor of LoginEvent
}
2018-01-07 18:04:30 +01:00
2023-09-29 15:47:25 +02:00
private void finish2()
2018-01-07 18:04:30 +01:00
--
2023-09-21 12:33:23 +02:00
2.42.0
2017-08-10 18:41:17 +02:00