Skip to content

Commit 3a78769

Browse files
committed
Add ResourceKey#of(Key)
1 parent cbf8f6f commit 3a78769

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/org/spongepowered/api/ResourceKey.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,17 @@ static ResourceKey of(final PluginContainer plugin, final String value) {
131131
return Sponge.game().factoryProvider().provide(Factory.class).of(Objects.requireNonNull(plugin, "plugin"), Objects.requireNonNull(value, "value"));
132132
}
133133

134+
/**
135+
* Creates a resource key.
136+
*
137+
* @param key The Key
138+
* @return A new resource key
139+
*/
140+
static ResourceKey of(final Key key) {
141+
Objects.requireNonNull(key, "key");
142+
return ResourceKey.of(key.namespace(), key.value());
143+
}
144+
134145
/**
135146
* Resolves a resource key from a string.
136147
*

0 commit comments

Comments
 (0)