Some changes to placeholders

This commit is contained in:
Vankka 2024-08-03 17:55:55 +03:00
parent 8058d6a3ff
commit 993b4e90f0
No known key found for this signature in database
GPG Key ID: 62E48025ED4E7EBB
4 changed files with 10 additions and 16 deletions

View File

@ -24,6 +24,7 @@
package com.discordsrv.api.player;
import com.discordsrv.api.component.MinecraftComponent;
import com.discordsrv.api.placeholder.annotation.Placeholder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -40,6 +41,7 @@ public interface DiscordSRVPlayer {
* @return the player's username
*/
@NotNull
@Placeholder("name")
String username();
/**
@ -47,6 +49,7 @@ public interface DiscordSRVPlayer {
* @return the player's unique id
*/
@NotNull
@Placeholder(value = "uuid", relookup = "uuid")
UUID uniqueId();
/**

View File

@ -53,19 +53,6 @@ public interface IOfflinePlayer extends Identified {
}
@Nullable
@Placeholder(value = "skin", relookup = "skin")
SkinInfo skinInfo();
@Placeholder("skin_texture_id")
@Nullable
default String skinTextureId() {
SkinInfo info = skinInfo();
return info != null ? info.textureId() : null;
}
@Placeholder("skin_model")
@Nullable
default String skinModel() {
SkinInfo info = skinInfo();
return info != null ? info.model() : null;
}
}

View File

@ -58,12 +58,10 @@ public interface IPlayer extends DiscordSRVPlayer, IOfflinePlayer, ICommandSende
}
@NotNull
@Placeholder("name")
String username();
@Override
@ApiStatus.NonExtendable
@Placeholder(value = "uuid", relookup = "uuid")
default @NotNull UUID uniqueId() {
return identity().uuid();
}

View File

@ -18,6 +18,10 @@
package com.discordsrv.common.abstraction.player.provider.model;
import com.discordsrv.api.placeholder.annotation.Placeholder;
import com.discordsrv.api.placeholder.annotation.PlaceholderPrefix;
@PlaceholderPrefix("skin_")
public class SkinInfo {
private final String textureId;
@ -28,10 +32,12 @@ public class SkinInfo {
this.model = model;
}
@Placeholder("texture_id")
public String textureId() {
return textureId;
}
@Placeholder("model")
public String model() {
return model;
}