mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-23 08:31:49 +01:00
Use getGameProfile().getName() for player name on Fabric
This commit is contained in:
parent
fa1ec4f4f6
commit
28f3f356cc
@ -21,6 +21,7 @@ import io.netty.channel.local.LocalAddress;
|
||||
import io.netty.channel.unix.DomainSocketAddress;
|
||||
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.net.*;
|
||||
import java.util.Optional;
|
||||
@ -45,12 +46,12 @@ public class FabricPlayerData implements PlatformPlayerData {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return player.getNameForScoreboard();
|
||||
return player.getGameProfile().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getDisplayName() {
|
||||
return Optional.of(player.getDisplayName().getString());
|
||||
return Optional.ofNullable(player.getDisplayName()).map(Text::getString);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,7 @@
|
||||
package net.playeranalytics.plan.gathering.listeners.events.mixin;
|
||||
|
||||
import com.djrapitops.plan.commands.use.*;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
@ -58,7 +59,7 @@ public abstract class ServerCommandSourceMixin implements CMDSender {
|
||||
|
||||
@Override
|
||||
public Optional<String> getPlayerName() {
|
||||
return getPlayer().map(ServerPlayerEntity::getNameForScoreboard);
|
||||
return getPlayer().map(ServerPlayerEntity::getGameProfile).map(GameProfile::getName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user