mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-13 23:11:20 +01:00
Optimised getByKey
This commit is contained in:
parent
316c16030d
commit
3828a53025
@ -299,8 +299,10 @@ public class EcoEnchants {
|
|||||||
* @return The matching {@link EcoEnchant}, or null if not found.
|
* @return The matching {@link EcoEnchant}, or null if not found.
|
||||||
*/
|
*/
|
||||||
public static EcoEnchant getByKey(NamespacedKey key) {
|
public static EcoEnchant getByKey(NamespacedKey key) {
|
||||||
Optional<EcoEnchant> matching = getAll().stream().filter(enchant -> enchant.getKey().equals(key)).findFirst();
|
for (EcoEnchant ecoEnchant : getAll()) {
|
||||||
return matching.orElse(null);
|
if(ecoEnchant.getKey().equals(key)) return ecoEnchant;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user