mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-11-01 08:39:31 +01:00
Add some more UUIDUtil methods
This commit is contained in:
parent
53ced9be86
commit
8058d6a3ff
@ -28,6 +28,7 @@ import com.discordsrv.common.config.main.AvatarProviderConfig;
|
||||
import com.discordsrv.common.feature.profile.Profile;
|
||||
import com.discordsrv.common.util.ComponentUtil;
|
||||
import com.discordsrv.common.util.GamePermissionUtil;
|
||||
import com.discordsrv.common.util.UUIDUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -82,9 +83,9 @@ public interface IPlayer extends DiscordSRVPlayer, IOfflinePlayer, ICommandSende
|
||||
|
||||
if (avatarConfig.autoDecideAvatarUrl) {
|
||||
// Offline mode
|
||||
if (uniqueId().version() == 3) avatarUrlTemplate = "https://cravatar.eu/helmavatar/%player_name%/128.png#%player_skin_texture_id%";
|
||||
if (UUIDUtil.isOffline(uniqueId())) avatarUrlTemplate = "https://cravatar.eu/helmavatar/%player_name%/128.png#%player_skin_texture_id%";
|
||||
// Bedrock
|
||||
else if (uniqueId().getLeastSignificantBits() == 0) avatarUrlTemplate = "https://api.tydiumcraft.net/skin?uuid=%player_uuid_short%&type=avatar&size=128";
|
||||
else if (UUIDUtil.isGeyser(uniqueId())) avatarUrlTemplate = "https://api.tydiumcraft.net/skin?uuid=%player_uuid_short%&type=avatar&size=128";
|
||||
}
|
||||
|
||||
if (avatarUrlTemplate == null) {
|
||||
|
@ -69,8 +69,7 @@ public abstract class AbstractPlayerProvider<T extends IPlayer, DT extends Disco
|
||||
this.allPlayers.add(player);
|
||||
discordSRV.scheduler().run(() -> discordSRV.eventBus().publish(new PlayerConnectedEvent(player, initial)));
|
||||
|
||||
if (uuid.getLeastSignificantBits() != 0 /* Not Geyser */
|
||||
&& uuid.version() == 3 /* Offline */) {
|
||||
if (UUIDUtil.isOffline(uuid) /* Offline */) {
|
||||
anyOffline.set(true);
|
||||
}
|
||||
}
|
||||
|
@ -56,4 +56,19 @@ public final class UUIDUtil {
|
||||
public static String toShort(@NotNull UUID uuid) {
|
||||
return uuid.toString().replace("-", "");
|
||||
}
|
||||
|
||||
@Placeholder("version")
|
||||
public static int getVersion(@NotNull UUID uuid) {
|
||||
return uuid.version();
|
||||
}
|
||||
|
||||
@Placeholder("isgeyser")
|
||||
public static boolean isGeyser(@NotNull UUID uuid) {
|
||||
return uuid.getLeastSignificantBits() == 0;
|
||||
}
|
||||
|
||||
@Placeholder("isoffline")
|
||||
public static boolean isOffline(@NotNull UUID uuid) {
|
||||
return !isGeyser(uuid) && uuid.version() == 3;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user