mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-26 20:27:38 +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.
|
||||
*/
|
||||
public static EcoEnchant getByKey(NamespacedKey key) {
|
||||
Optional<EcoEnchant> matching = getAll().stream().filter(enchant -> enchant.getKey().equals(key)).findFirst();
|
||||
return matching.orElse(null);
|
||||
for (EcoEnchant ecoEnchant : getAll()) {
|
||||
if(ecoEnchant.getKey().equals(key)) return ecoEnchant;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user