File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 3333import com .github .games647 .fastlogin .bukkit .FastLoginBukkit ;
3434import com .github .games647 .fastlogin .core .hooks .bedrock .FloodgateService ;
3535
36+ import java .util .UUID ;
37+
3638import org .geysermc .floodgate .api .FloodgateApi ;
3739
3840import static com .comphenix .protocol .PacketType .Login .Client .START ;
@@ -78,7 +80,15 @@ public void onPacketReceiving(PacketEvent packetEvent) {
7880
7981 packet .setMeta ("original_name" , originalProfile .getName ());
8082 String prefixedName = FloodgateApi .getInstance ().getPlayerPrefix () + originalProfile .getName ();
81- WrappedGameProfile updatedProfile = originalProfile .withName (prefixedName );
82- packet .getGameProfiles ().write (0 , updatedProfile );
83+ setUsername (packet , prefixedName );
84+ }
85+
86+ private void setUsername (PacketContainer packet , String name ) {
87+ if (packet .getGameProfiles ().size () > 0 ) {
88+ WrappedGameProfile updatedProfile = new WrappedGameProfile (UUID .randomUUID (), name );
89+ packet .getGameProfiles ().write (0 , updatedProfile );
90+ } else {
91+ packet .getStrings ().write (0 , name );
92+ }
8393 }
8494}
You can’t perform that action at this time.
0 commit comments