3434
3535package net .elytrium .limboapi .injection .login ;
3636
37- import com .velocitypowered .api .event .PostOrder ;
3837import com .velocitypowered .api .event .Subscribe ;
39- import com .velocitypowered .api .event .connection .DisconnectEvent ;
40- import com .velocitypowered .api .event .connection .PreLoginEvent ;
4138import com .velocitypowered .api .event .player .GameProfileRequestEvent ;
4239import com .velocitypowered .api .event .player .PlayerChooseInitialServerEvent ;
4340import com .velocitypowered .api .event .player .ServerConnectedEvent ;
6865import java .lang .invoke .MethodType ;
6966import java .lang .reflect .Field ;
7067import java .net .InetSocketAddress ;
71- import java .util .ArrayList ;
72- import java .util .List ;
7368import java .util .Objects ;
7469import java .util .UUID ;
7570import net .elytrium .commons .utils .reflection .ReflectionException ;
@@ -92,7 +87,6 @@ public class LoginListener {
9287 private static final MethodHandle CONNECTED_PLAYER_CONSTRUCTOR ;
9388 private static final MethodHandle SPAWNED_FIELD ;
9489
95- private final List <String > onlineMode = new ArrayList <>();
9690 private final LimboAPI plugin ;
9791 private final VelocityServer server ;
9892
@@ -101,14 +95,6 @@ public LoginListener(LimboAPI plugin, VelocityServer server) {
10195 this .server = server ;
10296 }
10397
104- @ Subscribe (order = PostOrder .LAST )
105- public void hookPreLogin (PreLoginEvent event ) {
106- PreLoginEvent .PreLoginComponentResult result = event .getResult ();
107- if (!result .isForceOfflineMode () && (this .server .getConfiguration ().isOnlineMode () || result .isOnlineModeAllowed ())) {
108- this .onlineMode .add (event .getUsername ());
109- }
110- }
111-
11298 @ Subscribe
11399 public void hookInitialServer (PlayerChooseInitialServerEvent event ) {
114100 if (this .plugin .hasNextServer (event .getPlayer ())) {
@@ -118,11 +104,6 @@ public void hookInitialServer(PlayerChooseInitialServerEvent event) {
118104 this .plugin .setLimboJoined (event .getPlayer ());
119105 }
120106
121- @ Subscribe
122- public void onDisconnect (DisconnectEvent event ) {
123- this .onlineMode .remove (event .getPlayer ().getUsername ());
124- }
125-
126107 @ SuppressWarnings ("ConstantConditions" )
127108 public void hookLoginSession (GameProfileRequestEvent event ) throws Throwable {
128109 LoginInboundConnection inboundConnection = (LoginInboundConnection ) event .getConnection ();
@@ -178,7 +159,7 @@ public void hookLoginSession(GameProfileRequestEvent event) throws Throwable {
178159 event .getGameProfile (),
179160 connection ,
180161 inboundConnection .getVirtualHost ().orElse (null ),
181- this . onlineMode . contains ( event .getUsername () ),
162+ event .isOnlineMode ( ),
182163 playerKey
183164 );
184165 if (connection .getProtocolVersion ().compareTo (ProtocolVersion .MINECRAFT_1_20_2 ) >= 0 ) {
0 commit comments