mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-29 03:21:34 +01:00
Use map
This commit is contained in:
parent
6e2cfa8b2e
commit
2e07af2b80
@ -25,7 +25,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
// for lack of a better name
|
||||
public final class NBTUtils {
|
||||
@ -102,12 +101,9 @@ public final class NBTUtils {
|
||||
nbt.set(listName, NBT.List(
|
||||
NBTType.TAG_Compound,
|
||||
enchantmentMap.entrySet().stream()
|
||||
.map(entry ->
|
||||
NBT.Compound(n -> {
|
||||
n.setShort("lvl", entry.getValue());
|
||||
n.setString("id", entry.getKey().name());
|
||||
})
|
||||
)
|
||||
.map(entry -> NBT.Compound(Map.of(
|
||||
"lvl", NBT.Short(entry.getValue()),
|
||||
"id", NBT.String(entry.getKey().name()))))
|
||||
.toList()
|
||||
));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user