mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-29 18:27:36 +02:00
@ -33,6 +33,8 @@ import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
|||||||
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
|
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
|
||||||
import com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService;
|
import com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.geysermc.floodgate.api.FloodgateApi;
|
import org.geysermc.floodgate.api.FloodgateApi;
|
||||||
|
|
||||||
import static com.comphenix.protocol.PacketType.Login.Client.START;
|
import static com.comphenix.protocol.PacketType.Login.Client.START;
|
||||||
@ -78,7 +80,15 @@ public class ManualNameChange extends PacketAdapter {
|
|||||||
|
|
||||||
packet.setMeta("original_name", originalProfile.getName());
|
packet.setMeta("original_name", originalProfile.getName());
|
||||||
String prefixedName = FloodgateApi.getInstance().getPlayerPrefix() + originalProfile.getName();
|
String prefixedName = FloodgateApi.getInstance().getPlayerPrefix() + originalProfile.getName();
|
||||||
WrappedGameProfile updatedProfile = originalProfile.withName(prefixedName);
|
setUsername(packet, prefixedName);
|
||||||
packet.getGameProfiles().write(0, updatedProfile);
|
}
|
||||||
|
|
||||||
|
private void setUsername(PacketContainer packet, String name) {
|
||||||
|
if (packet.getGameProfiles().size() > 0) {
|
||||||
|
WrappedGameProfile updatedProfile = new WrappedGameProfile(UUID.randomUUID(), name);
|
||||||
|
packet.getGameProfiles().write(0, updatedProfile);
|
||||||
|
} else {
|
||||||
|
packet.getStrings().write(0, name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user