Enchanted book and Colored StringBuilder

This commit is contained in:
LeoDog896 2021-01-15 22:03:44 -05:00
parent fec05d6838
commit 5419530125
3 changed files with 8 additions and 5 deletions

View File

@ -19,7 +19,10 @@ import java.util.regex.Pattern;
*/
public class ColoredText extends JsonMessage {
// the raw text
/**
* The raw text StringBuilder
* Its a single StringBuilder instance for easier and faster concenation
*/
private final StringBuilder message = new StringBuilder();
/**

View File

@ -1,6 +1,5 @@
package net.minestom.server.item;
import net.minestom.server.chat.ColoredText;
import net.minestom.server.chat.JsonMessage;
public class ItemDisplay {

View File

@ -1,17 +1,18 @@
package net.minestom.server.item.metadata;
import it.unimi.dsi.fastutil.objects.Object2ShortMap;
import it.unimi.dsi.fastutil.objects.Object2ShortOpenHashMap;
import net.minestom.server.item.Enchantment;
import net.minestom.server.utils.NBTUtils;
import org.jetbrains.annotations.NotNull;
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class EnchantedBookMeta extends ItemMeta {
private final Map<Enchantment, Short> storedEnchantmentMap = new HashMap<>();
private final Object2ShortMap<Enchantment> storedEnchantmentMap = new Object2ShortOpenHashMap<>();
/**
* Gets the stored enchantment map.
@ -45,7 +46,7 @@ public class EnchantedBookMeta extends ItemMeta {
* @param enchantment the enchantment type
*/
public void removeStoredEnchantment(@NotNull Enchantment enchantment) {
this.storedEnchantmentMap.remove(enchantment);
this.storedEnchantmentMap.removeShort(enchantment);
}
/**