Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String -> UUID #7497

Merged
merged 13 commits into from
Feb 23, 2025
Prev Previous commit
Next Next commit
Remove the AnyValued for UUIDs and tests for parsing uuids
  • Loading branch information
Burbulinis committed Jan 22, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 636d9fd4c68ebb7958b8e1d2164f6bd36d0c0a99
13 changes: 1 addition & 12 deletions src/main/java/ch/njol/skript/classes/data/DefaultConverters.java
Original file line number Diff line number Diff line change
@@ -278,19 +278,8 @@ public void setAmount(Number amount) {
Converters.registerConverter(Script.class, Config.class, Script::getConfig);
Converters.registerConverter(Config.class, Node.class, Config::getMainNode);

// UUID -> String & AnyValued
// UUID -> String
Converters.registerConverter(UUID.class, String.class, UUID::toString);
Converters.registerConverter(UUID.class, AnyValued.class, uuid -> new AnyValued<String>() {
@Override
public String value() {
return uuid.toString();
}

@Override
public Class<String> valueType() {
return String.class;
}
});

// // Entity - String (UUID) // Very slow, thus disabled for now
// Converters.registerConverter(String.class, Entity.class, new Converter<String, Entity>() {
9 changes: 7 additions & 2 deletions src/test/skript/tests/syntaxes/expressions/ExprUUID.sk
Original file line number Diff line number Diff line change
@@ -9,8 +9,13 @@ test "uuid":
spawn a pig at test-location
set {_pig} to last spawned pig

set {_lookup} to entity from (uuid of {_pig})
assert {_lookup} is set with "Failed to look up entity"
set {_uuid} to uuid of {_pig}

set {_lookup} to entity from {_uuid}
assert {_lookup} is {_pig} with "Failed to look up pig"

set {_le pig} to {_uuid} parsed as entity
assert {_le pig} is {_pig} with "failed to parse uuid as entity"

delete entity within {_pig}

Loading