Skip to content

Commit

Permalink
Added %headblocks_hasHead_<name>%
Browse files Browse the repository at this point in the history
  • Loading branch information
AerWyn81 committed Dec 13, 2024
1 parent a6a9dba commit a2fb49e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id("java")
}

version = "2.6.11"
version = "2.6.13"

allprojects {
repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,28 @@ public String onRequest(OfflinePlayer player, @NotNull String identifier) {
}
}

// %headblocks_hasHead_uuid%
// %headblocks_hasHead_<uuid|name>%
if (identifier.contains("hasHead")) {
var str = identifier.split("_");

try {
var hUUID = UUID.fromString(str[str.length - 1]);
return String.valueOf(StorageService.hasHead(player.getUniqueId(), hUUID));
} catch (Exception ignored) { }

try {
var name = identifier.replace("hasHead_", "");
name = name.replaceAll("_", " ").trim();

var head = HeadService.getHeadByName(name);

if (head == null) {
return "Unknown head " + name;
}

return String.valueOf(StorageService.hasHead(player.getUniqueId(), head.getUuid()));
} catch (Exception ignored) {
}
}

// %headblocks_order_<previous|current|next>%
Expand Down

0 comments on commit a2fb49e

Please sign in to comment.