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

View File

@ -53,19 +53,6 @@ public interface IOfflinePlayer extends Identified {
} }
@Nullable @Nullable
@Placeholder(value = "skin", relookup = "skin")
SkinInfo skinInfo(); 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 @NotNull
@Placeholder("name")
String username(); String username();
@Override @Override
@ApiStatus.NonExtendable @ApiStatus.NonExtendable
@Placeholder(value = "uuid", relookup = "uuid")
default @NotNull UUID uniqueId() { default @NotNull UUID uniqueId() {
return identity().uuid(); return identity().uuid();
} }

View File

@ -18,6 +18,10 @@
package com.discordsrv.common.abstraction.player.provider.model; 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 { public class SkinInfo {
private final String textureId; private final String textureId;
@ -28,10 +32,12 @@ public class SkinInfo {
this.model = model; this.model = model;
} }
@Placeholder("texture_id")
public String textureId() { public String textureId() {
return textureId; return textureId;
} }
@Placeholder("model")
public String model() { public String model() {
return model; return model;
} }