File tree Expand file tree Collapse file tree
bukkit/src/main/java/com/github/games647/fastlogin/bukkit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ public void onEnable() {
120120
121121 if (isPluginInstalled ("floodgate" )) {
122122 if (getConfig ().getBoolean ("floodgatePrefixWorkaround" )){
123- ProtocolLibrary .getProtocolManager ().addPacketListener (new ManualNameChange (this ));
123+ ProtocolLibrary .getProtocolManager ().addPacketListener (new ManualNameChange (this , floodgateService ));
124124 logger .info ("Floodgate prefix injection workaround has been enabled." );
125125 logger .info ("If you have problems joining the server, try disabling it in the configuration." );
126126 } else {
Original file line number Diff line number Diff line change 3030import com .comphenix .protocol .events .PacketEvent ;
3131import com .comphenix .protocol .wrappers .WrappedGameProfile ;
3232import com .github .games647 .fastlogin .bukkit .FastLoginBukkit ;
33+ import com .github .games647 .fastlogin .core .hooks .bedrock .FloodgateService ;
3334
3435import org .geysermc .floodgate .api .FloodgateApi ;
3536
4546 */
4647public class ManualNameChange extends PacketAdapter {
4748
48- public ManualNameChange (FastLoginBukkit plugin ) {
49+ private final FloodgateService floodgate ;
50+
51+ public ManualNameChange (FastLoginBukkit plugin , FloodgateService floodgate ) {
4952 super (params ()
5053 .plugin (plugin )
5154 .types (START ));
5255
5356 this .plugin = plugin ;
57+ this .floodgate = floodgate ;
5458 }
5559
5660 @ Override
5761 public void onPacketReceiving (PacketEvent packetEvent ) {
5862 PacketContainer packet = packetEvent .getPacket ();
5963 WrappedGameProfile originalProfile = packet .getGameProfiles ().read (0 );
64+
65+ if (floodgate .getBedrockPlayer (originalProfile .getName ()) == null ) {
66+ //not a Floodgate player, no need to add a prefix
67+ return ;
68+ }
69+
6070 packet .setMeta ("original_name" , originalProfile .getName ());
6171 String prefixedName = FloodgateApi .getInstance ().getPlayerPrefix () + originalProfile .getName ();
6272 WrappedGameProfile updatedProfile = originalProfile .withName (prefixedName );
You can’t perform that action at this time.
0 commit comments