diff --git a/api/build.gradle b/api/build.gradle index 30944ca..ce72828 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -5,9 +5,6 @@ plugins { dependencies { compileOnly "org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT" - compileOnly "net.kyori:adventure-platform-bukkit:4.3.0" - compileOnly "net.kyori:adventure-text-minimessage:4.13.1" - compileOnly "com.github.retrooper.packetevents:spigot:2.0.0-SNAPSHOT" } publishing { diff --git a/api/src/main/java/lol/pyr/znpcsplus/api/hologram/Hologram.java b/api/src/main/java/lol/pyr/znpcsplus/api/hologram/Hologram.java index a00a68b..7da2fa5 100644 --- a/api/src/main/java/lol/pyr/znpcsplus/api/hologram/Hologram.java +++ b/api/src/main/java/lol/pyr/znpcsplus/api/hologram/Hologram.java @@ -1,11 +1,9 @@ package lol.pyr.znpcsplus.api.hologram; -import net.kyori.adventure.text.Component; - public interface Hologram { - void addLine(Component line); - Component getLine(int index); + void addLine(String line); + String getLine(int index); void removeLine(int index); void clearLines(); - void insertLine(int index, Component line); + void insertLine(int index, String line); } diff --git a/api/src/main/java/lol/pyr/znpcsplus/util/NpcLocation.java b/api/src/main/java/lol/pyr/znpcsplus/util/NpcLocation.java index 470910f..30ee9ce 100644 --- a/api/src/main/java/lol/pyr/znpcsplus/util/NpcLocation.java +++ b/api/src/main/java/lol/pyr/znpcsplus/util/NpcLocation.java @@ -1,6 +1,5 @@ package lol.pyr.znpcsplus.util; -import com.github.retrooper.packetevents.util.Vector3d; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.util.NumberConversions; @@ -64,10 +63,6 @@ public class NpcLocation { return new NpcLocation(x, y, z, yaw, pitch); } - public Vector3d toVector3d() { - return new Vector3d(x, y, z); - } - private static final double _2PI = 2 * Math.PI; public Location lookingAt(Location loc) { diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java b/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java index a32f359..d0c32a0 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java @@ -114,7 +114,7 @@ public class ZNpcsPlus extends JavaPlugin { BungeeConnector bungeeConnector = new BungeeConnector(this); ActionRegistry actionRegistry = new ActionRegistry(); NpcTypeRegistryImpl typeRegistry = new NpcTypeRegistryImpl(); - NpcRegistryImpl npcRegistry = new NpcRegistryImpl(configManager, this, packetFactory, actionRegistry, scheduler, typeRegistry, propertyRegistry); + NpcRegistryImpl npcRegistry = new NpcRegistryImpl(configManager, this, packetFactory, actionRegistry, scheduler, typeRegistry, propertyRegistry, textSerializer); UserManager userManager = new UserManager(); log(ChatColor.WHITE + " * Registerring components..."); @@ -157,7 +157,7 @@ public class ZNpcsPlus extends JavaPlugin { NpcEntryImpl entry = npcRegistry.create("debug_npc_" + i, world, type, new NpcLocation(i * 3, 200, 0, 0, 0)); entry.setProcessed(true); NpcImpl npc = entry.getNpc(); - npc.getHologram().addLine(Component.text("Hello, World!")); + npc.getHologram().addLineComponent(Component.text("Hello, World!")); i++; } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/ListCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/ListCommand.java index 0cbe4df..a00cd74 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/ListCommand.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/ListCommand.java @@ -30,7 +30,7 @@ public class ListCommand implements CommandHandler { .append(Component.text(npc.getType().getName(), NamedTextColor.GREEN)) .append(Component.text(" | ", NamedTextColor.GRAY)) .append(Component.text("Name: ", NamedTextColor.GREEN)) - .append(npc.getHologram().getLine(0).color(NamedTextColor.GREEN)) + .append(npc.getHologram().getLineComponent(0).color(NamedTextColor.GREEN)) .append(Component.text(" | ", NamedTextColor.GRAY)) .append(Component.text("Location: " + npc.getWorldName() + " X:" + location.getBlockX() + " Y:" + location.getBlockY() + " Z:" + location.getBlockZ(), NamedTextColor.GREEN)) .append(Component.text(" | ", NamedTextColor.GRAY)) diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloAddCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloAddCommand.java index c61c78e..cf4ed32 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloAddCommand.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloAddCommand.java @@ -27,7 +27,7 @@ public class HoloAddCommand implements CommandHandler { context.setUsage(context.getLabel() + " holo add "); HologramImpl hologram = context.parse(NpcEntryImpl.class).getNpc().getHologram(); context.ensureArgsNotEmpty(); - hologram.addLine(textSerializer.deserialize(context.dumpAllArgs())); + hologram.addLineComponent(textSerializer.deserialize(context.dumpAllArgs())); context.send(Component.text("NPC line added!", NamedTextColor.GREEN)); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloInsertCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloInsertCommand.java index c909b79..7429410 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloInsertCommand.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloInsertCommand.java @@ -30,7 +30,7 @@ public class HoloInsertCommand implements CommandHandler { int line = context.parse(Integer.class); if (line < 0 || line >= hologram.getLines().size()) context.halt(Component.text("Invalid line number!", NamedTextColor.RED)); context.ensureArgsNotEmpty(); - hologram.insertLine(line, componentSerializer.deserialize(context.dumpAllArgs())); + hologram.insertLineComponent(line, componentSerializer.deserialize(context.dumpAllArgs())); context.send(Component.text("NPC line inserted!", NamedTextColor.GREEN)); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloSetCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloSetCommand.java index 098cae2..df3678a 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloSetCommand.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/commands/hologram/HoloSetCommand.java @@ -31,7 +31,7 @@ public class HoloSetCommand implements CommandHandler { if (line < 0 || line >= hologram.getLines().size()) context.halt(Component.text("Invalid line number!", NamedTextColor.RED)); context.ensureArgsNotEmpty(); hologram.removeLine(line); - hologram.insertLine(line, componentSerializer.deserialize(context.dumpAllArgs())); + hologram.insertLineComponent(line, componentSerializer.deserialize(context.dumpAllArgs())); context.send(Component.text("NPC line set!", NamedTextColor.GREEN)); } @@ -43,7 +43,7 @@ public class HoloSetCommand implements CommandHandler { if (context.argSize() == 2) return context.suggestStream(Stream.iterate(0, n -> n + 1) .limit(hologram.getLines().size()).map(String::valueOf)); if (context.argSize() == 3) return context.suggestLiteral(componentSerializer.serialize( - hologram.getLine(context.suggestionParse(1, Integer.class)))); + hologram.getLineComponent(context.suggestionParse(1, Integer.class)))); } return Collections.emptyList(); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/hologram/HologramImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/hologram/HologramImpl.java index d4514f4..0e768d4 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/hologram/HologramImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/hologram/HologramImpl.java @@ -6,6 +6,7 @@ import lol.pyr.znpcsplus.packets.PacketFactory; import lol.pyr.znpcsplus.util.Viewable; import lol.pyr.znpcsplus.util.NpcLocation; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.entity.Player; import java.util.ArrayList; @@ -15,28 +16,38 @@ import java.util.List; public class HologramImpl extends Viewable implements Hologram { private final ConfigManager configManager; private final PacketFactory packetFactory; + private final LegacyComponentSerializer textSerializer; private double offset = 0.0; private NpcLocation location; private final List lines = new ArrayList<>(); - public HologramImpl(ConfigManager configManager, PacketFactory packetFactory, NpcLocation location) { + public HologramImpl(ConfigManager configManager, PacketFactory packetFactory, LegacyComponentSerializer textSerializer, NpcLocation location) { this.configManager = configManager; this.packetFactory = packetFactory; + this.textSerializer = textSerializer; this.location = location; } - public void addLine(Component line) { + public void addLineComponent(Component line) { HologramLine newLine = new HologramLine(packetFactory, null, line); lines.add(newLine); relocateLines(); for (Player viewer : getViewers()) newLine.show(viewer.getPlayer()); } - public Component getLine(int index) { + public void addLine(String line) { + addLineComponent(textSerializer.deserialize(line)); + } + + public Component getLineComponent(int index) { return lines.get(index).getText(); } + public String getLine(int index) { + return textSerializer.serialize(getLineComponent(index)); + } + public void removeLine(int index) { HologramLine line = lines.remove(index); for (Player viewer : getViewers()) line.hide(viewer); @@ -52,13 +63,17 @@ public class HologramImpl extends Viewable implements Hologram { lines.clear(); } - public void insertLine(int index, Component line) { + public void insertLineComponent(int index, Component line) { HologramLine newLine = new HologramLine(packetFactory, null, line); lines.add(index, newLine); relocateLines(); for (Player viewer : getViewers()) newLine.show(viewer.getPlayer()); } + public void insertLine(int index, String line) { + insertLineComponent(index, textSerializer.deserialize(line)); + } + @Override protected void UNSAFE_show(Player player) { for (HologramLine line : lines) line.show(player); diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcImpl.java index e2850b8..f0c3a80 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcImpl.java @@ -10,6 +10,7 @@ import lol.pyr.znpcsplus.interaction.InteractionAction; import lol.pyr.znpcsplus.packets.PacketFactory; import lol.pyr.znpcsplus.util.NpcLocation; import lol.pyr.znpcsplus.util.Viewable; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; @@ -28,17 +29,17 @@ public class NpcImpl extends Viewable implements Npc { private final Map, Object> propertyMap = new HashMap<>(); private final List actions = new ArrayList<>(); - protected NpcImpl(ConfigManager configManager, World world, NpcTypeImpl type, NpcLocation location, PacketFactory packetFactory) { - this(configManager, packetFactory, world.getName(), type, location); + protected NpcImpl(ConfigManager configManager, LegacyComponentSerializer textSerializer, World world, NpcTypeImpl type, NpcLocation location, PacketFactory packetFactory) { + this(configManager, packetFactory, textSerializer, world.getName(), type, location); } - public NpcImpl(ConfigManager configManager, PacketFactory packetFactory, String world, NpcTypeImpl type, NpcLocation location) { + public NpcImpl(ConfigManager configManager, PacketFactory packetFactory, LegacyComponentSerializer textSerializer, String world, NpcTypeImpl type, NpcLocation location) { this.packetFactory = packetFactory; this.worldName = world; this.type = type; this.location = location; entity = new PacketEntity(packetFactory, this, type.getType(), location); - hologram = new HologramImpl(configManager, packetFactory, location.withY(location.getY() + type.getHologramOffset())); + hologram = new HologramImpl(configManager, packetFactory, textSerializer, location.withY(location.getY() + type.getHologramOffset())); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcRegistryImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcRegistryImpl.java index 05abef8..4ea617d 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcRegistryImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcRegistryImpl.java @@ -10,6 +10,7 @@ import lol.pyr.znpcsplus.packets.PacketFactory; import lol.pyr.znpcsplus.scheduling.TaskScheduler; import lol.pyr.znpcsplus.storage.NpcStorage; import lol.pyr.znpcsplus.util.NpcLocation; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.World; import java.util.Collection; @@ -22,9 +23,11 @@ public class NpcRegistryImpl implements NpcRegistry { private final NpcStorage storage; private final PacketFactory packetFactory; private final ConfigManager configManager; + private final LegacyComponentSerializer textSerializer; - public NpcRegistryImpl(ConfigManager configManager, ZNpcsPlus plugin, PacketFactory packetFactory, ActionRegistry actionRegistry, TaskScheduler scheduler, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry) { - storage = configManager.getConfig().storageType().create(configManager, plugin, packetFactory, actionRegistry, typeRegistry, propertyRegistry); + public NpcRegistryImpl(ConfigManager configManager, ZNpcsPlus plugin, PacketFactory packetFactory, ActionRegistry actionRegistry, TaskScheduler scheduler, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry, LegacyComponentSerializer textSerializer) { + this.textSerializer = textSerializer; + storage = configManager.getConfig().storageType().create(configManager, plugin, packetFactory, actionRegistry, typeRegistry, propertyRegistry, textSerializer); this.packetFactory = packetFactory; this.configManager = configManager; @@ -81,7 +84,7 @@ public class NpcRegistryImpl implements NpcRegistry { public NpcEntryImpl create(String id, World world, NpcTypeImpl type, NpcLocation location) { id = id.toLowerCase(); if (npcMap.containsKey(id)) throw new IllegalArgumentException("An npc with the id " + id + " already exists!"); - NpcImpl npc = new NpcImpl(configManager, world, type, location, packetFactory); + NpcImpl npc = new NpcImpl(configManager, textSerializer, world, type, location, packetFactory); NpcEntryImpl entry = new NpcEntryImpl(id, npc); npcMap.put(id, entry); return entry; diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_14PacketFactory.java b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_14PacketFactory.java index 53dbea9..5159583 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_14PacketFactory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_14PacketFactory.java @@ -23,7 +23,7 @@ public class V1_14PacketFactory extends V1_10PacketFactory { public void spawnEntity(Player player, PacketEntity entity, PropertyHolder properties) { NpcLocation location = entity.getLocation(); sendPacket(player, new WrapperPlayServerSpawnEntity(entity.getEntityId(), Optional.of(entity.getUuid()), entity.getType(), - location.toVector3d(), location.getPitch(), location.getYaw(), location.getYaw(), 0, Optional.of(new Vector3d()))); + npcLocationToVector(location), location.getPitch(), location.getYaw(), location.getYaw(), 0, Optional.of(new Vector3d()))); sendAllMetadata(player, entity, properties); createTeam(player, entity, properties); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8PacketFactory.java b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8PacketFactory.java index 142d15d..8b22ac0 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8PacketFactory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8PacketFactory.java @@ -45,7 +45,7 @@ public class V1_8PacketFactory implements PacketFactory { createTeam(player, entity, properties); NpcLocation location = entity.getLocation(); sendPacket(player, new WrapperPlayServerSpawnPlayer(entity.getEntityId(), - entity.getUuid(), location.toVector3d(), location.getYaw(), location.getPitch(), Collections.emptyList())); + entity.getUuid(), npcLocationToVector(location), location.getYaw(), location.getPitch(), Collections.emptyList())); sendPacket(player, new WrapperPlayServerEntityHeadLook(entity.getEntityId(), location.getYaw())); sendAllMetadata(player, entity, properties); scheduler.runLaterAsync(() -> removeTabPlayer(player, entity), 60); @@ -58,14 +58,18 @@ public class V1_8PacketFactory implements PacketFactory { EntityType type = entity.getType(); ClientVersion clientVersion = packetEvents.getServerManager().getVersion().toClientVersion(); sendPacket(player, type.getLegacyId(clientVersion) == -1 ? - new WrapperPlayServerSpawnLivingEntity(entity.getEntityId(), entity.getUuid(), type, location.toVector3d(), + new WrapperPlayServerSpawnLivingEntity(entity.getEntityId(), entity.getUuid(), type, npcLocationToVector(location), location.getYaw(), location.getPitch(), location.getPitch(), new Vector3d(), Collections.emptyList()) : - new WrapperPlayServerSpawnEntity(entity.getEntityId(), Optional.of(entity.getUuid()), entity.getType(), location.toVector3d(), + new WrapperPlayServerSpawnEntity(entity.getEntityId(), Optional.of(entity.getUuid()), entity.getType(), npcLocationToVector(location), location.getPitch(), location.getYaw(), location.getYaw(), 0, Optional.empty())); sendAllMetadata(player, entity, properties); createTeam(player, entity, properties); } + protected Vector3d npcLocationToVector(NpcLocation location) { + return new Vector3d(location.getX(), location.getY(), location.getZ()); + } + @Override public void destroyEntity(Player player, PacketEntity entity, PropertyHolder properties) { sendPacket(player, new WrapperPlayServerDestroyEntities(entity.getEntityId())); @@ -75,7 +79,7 @@ public class V1_8PacketFactory implements PacketFactory { @Override public void teleportEntity(Player player, PacketEntity entity) { NpcLocation location = entity.getLocation(); - sendPacket(player, new WrapperPlayServerEntityTeleport(entity.getEntityId(), location.toVector3d(), location.getYaw(), location.getPitch(), true)); + sendPacket(player, new WrapperPlayServerEntityTeleport(entity.getEntityId(), npcLocationToVector(location), location.getYaw(), location.getPitch(), true)); if (entity.getType() == EntityTypes.PLAYER) sendPacket(player, new WrapperPlayServerEntityHeadLook(entity.getEntityId(), location.getYaw())); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/storage/NpcStorageType.java b/plugin/src/main/java/lol/pyr/znpcsplus/storage/NpcStorageType.java index d970395..91ff9b7 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/storage/NpcStorageType.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/storage/NpcStorageType.java @@ -7,16 +7,17 @@ import lol.pyr.znpcsplus.interaction.ActionRegistry; import lol.pyr.znpcsplus.npc.NpcTypeRegistryImpl; import lol.pyr.znpcsplus.packets.PacketFactory; import lol.pyr.znpcsplus.storage.yaml.YamlStorage; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import java.io.File; public enum NpcStorageType { YAML { @Override - public NpcStorage create(ConfigManager configManager, ZNpcsPlus plugin, PacketFactory packetFactory, ActionRegistry actionRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry) { - return new YamlStorage(packetFactory, configManager, actionRegistry, typeRegistry, propertyRegistry, new File(plugin.getDataFolder(), "data")); + public NpcStorage create(ConfigManager configManager, ZNpcsPlus plugin, PacketFactory packetFactory, ActionRegistry actionRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry, LegacyComponentSerializer textSerializer) { + return new YamlStorage(packetFactory, configManager, actionRegistry, typeRegistry, propertyRegistry, textSerializer, new File(plugin.getDataFolder(), "data")); } }; - public abstract NpcStorage create(ConfigManager configManager, ZNpcsPlus plugin, PacketFactory packetFactory, ActionRegistry actionRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry); + public abstract NpcStorage create(ConfigManager configManager, ZNpcsPlus plugin, PacketFactory packetFactory, ActionRegistry actionRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry, LegacyComponentSerializer textSerializer); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/storage/yaml/YamlStorage.java b/plugin/src/main/java/lol/pyr/znpcsplus/storage/yaml/YamlStorage.java index c9db45a..7dd2d84 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/storage/yaml/YamlStorage.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/storage/yaml/YamlStorage.java @@ -12,6 +12,7 @@ import lol.pyr.znpcsplus.packets.PacketFactory; import lol.pyr.znpcsplus.storage.NpcStorage; import lol.pyr.znpcsplus.util.NpcLocation; import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; @@ -26,14 +27,16 @@ public class YamlStorage implements NpcStorage { private final ActionRegistry actionRegistry; private final NpcTypeRegistryImpl typeRegistry; private final EntityPropertyRegistryImpl propertyRegistry; + private final LegacyComponentSerializer textSerializer; private final File folder; - public YamlStorage(PacketFactory packetFactory, ConfigManager configManager, ActionRegistry actionRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry, File folder) { + public YamlStorage(PacketFactory packetFactory, ConfigManager configManager, ActionRegistry actionRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry, LegacyComponentSerializer textSerializer, File folder) { this.packetFactory = packetFactory; this.configManager = configManager; this.actionRegistry = actionRegistry; this.typeRegistry = typeRegistry; this.propertyRegistry = propertyRegistry; + this.textSerializer = textSerializer; this.folder = folder; if (!this.folder.exists()) this.folder.mkdirs(); } @@ -46,8 +49,8 @@ public class YamlStorage implements NpcStorage { List npcs = new ArrayList<>(); for (File file : files) if (file.isFile() && file.getName().toLowerCase().endsWith(".yml")) { YamlConfiguration config = YamlConfiguration.loadConfiguration(file); - NpcImpl npc = new NpcImpl(configManager, packetFactory, config.getString("world"), typeRegistry.getByName(config.getString("type")), - deserializeLocation(config.getConfigurationSection("location"))); + NpcImpl npc = new NpcImpl(configManager, packetFactory, textSerializer, config.getString("world"), + typeRegistry.getByName(config.getString("type")), deserializeLocation(config.getConfigurationSection("location"))); ConfigurationSection properties = config.getConfigurationSection("properties"); if (properties != null) { @@ -57,7 +60,7 @@ public class YamlStorage implements NpcStorage { } } npc.getHologram().setOffset(config.getDouble("hologram.offset", 0.0)); - for (String line : config.getStringList("hologram.lines")) npc.getHologram().addLine(MiniMessage.miniMessage().deserialize(line)); + for (String line : config.getStringList("hologram.lines")) npc.getHologram().addLineComponent(MiniMessage.miniMessage().deserialize(line)); for (String s : config.getStringList("actions")) npc.addAction(actionRegistry.deserialize(s)); NpcEntryImpl entry = new NpcEntryImpl(config.getString("id"), npc);