Make EnchantmentContainer iterable

This commit is contained in:
Pim van der Loos 2021-11-04 14:10:40 +01:00
parent 28522ccbf6
commit eec0d5452d
No known key found for this signature in database
GPG Key ID: C16F020ADAE6D5A8

View File

@ -9,9 +9,10 @@ import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class EnchantmentContainer
public class EnchantmentContainer implements Iterable<Map.Entry<Enchantment, Integer>>
{
private Map<Enchantment, Integer> enchantments;
@ -244,4 +245,10 @@ public class EnchantmentContainer
ret = ret.length() > 1 ? ret.substring(0, ret.length() - 2) : ret;
return ret + "]";
}
@Override
public Iterator<Map.Entry<Enchantment, Integer>> iterator()
{
return enchantments.entrySet().iterator();
}
}