mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-11-02 16:49:31 +01:00
70 lines
3.0 KiB
Diff
70 lines
3.0 KiB
Diff
From 4fd06e8257c663bd26e05a05e4787954fd7b76f8 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index fa507753..a13eba79 100644
|
|
--- 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
|
|
@@ -10,6 +10,7 @@ import net.md_5.bungee.api.chat.BaseComponent;
|
|
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
|
|
|
|
/**
|
|
* Event called to represent a player logging in.
|
|
@@ -29,6 +30,14 @@ public class LoginEvent extends AsyncEvent<LoginEvent> implements Cancellable
|
|
*/
|
|
@Setter(AccessLevel.NONE)
|
|
private BaseComponent[] cancelReasonComponents;
|
|
+
|
|
+ // 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.
|
|
*/
|
|
@@ -40,6 +49,15 @@ public class LoginEvent extends AsyncEvent<LoginEvent> implements Cancellable
|
|
this.connection = connection;
|
|
}
|
|
|
|
+ // 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
|
|
* @deprecated Use component methods instead.
|
|
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
|
|
index 5ba336d5..b1c086bf 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
|
|
@@ -549,7 +549,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|
};
|
|
|
|
// 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
|
|
}
|
|
|
|
@Override
|
|
--
|
|
2.20.1
|
|
|