tab list fix
This commit is contained in:
@@ -8,11 +8,13 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
@Mixin(PlayerListEntry.class)
|
@Mixin(PlayerListEntry.class)
|
||||||
public abstract class TabListMixin {
|
public abstract class TabListMixin {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private Text displayName;
|
private GameProfile profile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author HexLeo
|
* @author HexLeo
|
||||||
@@ -22,11 +24,11 @@ public abstract class TabListMixin {
|
|||||||
@Overwrite
|
@Overwrite
|
||||||
@Nullable
|
@Nullable
|
||||||
public Text getDisplayName() {
|
public Text getDisplayName() {
|
||||||
String name = (displayName != null)
|
GameProfile profile = ((PlayerListEntry) (Object) this).getProfile();
|
||||||
? displayName.getString()
|
String name = profile.getName();
|
||||||
: ((PlayerListEntry) (Object) this).getProfile().getName();
|
String uuid = profile.getId().toString().replaceAll("-", "");
|
||||||
|
|
||||||
return Text.literal(
|
return Text.literal(
|
||||||
SaturnSocket.playerNames.containsKey(name) ? "" + name : name
|
SaturnSocket.players.containsKey(uuid) ? "" + name : name);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user