api improvements

This commit is contained in:
Pyrbu 2023-05-21 16:41:38 +01:00
parent fa8247f285
commit fc87323d10
25 changed files with 111 additions and 57 deletions

@ -1,7 +1,11 @@
package lol.pyr.znpcsplus.api;
import lol.pyr.znpcsplus.api.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.api.npc.NpcRegistry;
import lol.pyr.znpcsplus.api.npc.NpcTypeRegistry;
public interface NpcApi {
NpcRegistry getNpcRegistry();
NpcTypeRegistry getNpcTypeRegistry();
EntityPropertyRegistry getPropertyRegistry();
}

@ -0,0 +1,6 @@
package lol.pyr.znpcsplus.api.entity;
public interface EntityPropertyRegistry {
EntityProperty<?> getByName(String name);
<T> EntityProperty<T> getByName(String name, Class<T> type);
}

@ -0,0 +1,4 @@
package lol.pyr.znpcsplus.api.event;
public class NpcDespawnEvent {
}

@ -0,0 +1,4 @@
package lol.pyr.znpcsplus.api.event;
public class NpcSpawnEvent {
}

@ -1,4 +1,11 @@
package lol.pyr.znpcsplus.api.npc;
import lol.pyr.znpcsplus.api.entity.EntityProperty;
import java.util.Set;
public interface NpcType {
String getName();
double getHologramOffset();
Set<EntityProperty<?>> getAllowedProperties();
}

@ -0,0 +1,5 @@
package lol.pyr.znpcsplus.api.npc;
public interface NpcTypeRegistry {
NpcType getByName(String name);
}

@ -1,18 +1,36 @@
package lol.pyr.znpcsplus;
import lol.pyr.znpcsplus.api.NpcApi;
import lol.pyr.znpcsplus.api.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.api.npc.NpcRegistry;
import lol.pyr.znpcsplus.api.npc.NpcTypeRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
import lol.pyr.znpcsplus.npc.NpcTypeRegistryImpl;
public class ZNPCsPlusApi implements NpcApi {
private final NpcRegistryImpl npcRegistry;
private final NpcTypeRegistryImpl typeRegistry;
private final EntityPropertyRegistryImpl propertyRegistry;
public ZNPCsPlusApi(NpcRegistryImpl npcRegistry) {
public ZNPCsPlusApi(NpcRegistryImpl npcRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry) {
this.npcRegistry = npcRegistry;
this.typeRegistry = typeRegistry;
this.propertyRegistry = propertyRegistry;
}
@Override
public NpcRegistry getNpcRegistry() {
return npcRegistry;
}
@Override
public NpcTypeRegistry getNpcTypeRegistry() {
return typeRegistry;
}
@Override
public EntityPropertyRegistry getPropertyRegistry() {
return propertyRegistry;
}
}

@ -22,7 +22,7 @@ import lol.pyr.znpcsplus.commands.storage.LoadAllCommand;
import lol.pyr.znpcsplus.commands.storage.SaveAllCommand;
import lol.pyr.znpcsplus.config.ConfigManager;
import lol.pyr.znpcsplus.entity.EntityPropertyImpl;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.interaction.ActionRegistry;
import lol.pyr.znpcsplus.interaction.InteractionPacketListener;
import lol.pyr.znpcsplus.metadata.*;
@ -109,11 +109,11 @@ public class ZNpcsPlus extends JavaPlugin {
MetadataFactory metadataFactory = setupMetadataFactory();
ConfigManager configManager = new ConfigManager(getDataFolder());
SkinCache skinCache = new SkinCache(configManager);
EntityPropertyRegistry propertyRegistry = new EntityPropertyRegistry(skinCache);
EntityPropertyRegistryImpl propertyRegistry = new EntityPropertyRegistryImpl(skinCache);
PacketFactory packetFactory = setupPacketFactory(scheduler, metadataFactory, propertyRegistry);
BungeeConnector bungeeConnector = new BungeeConnector(this);
ActionRegistry actionRegistry = new ActionRegistry();
NpcTypeRegistry typeRegistry = new NpcTypeRegistry();
NpcTypeRegistryImpl typeRegistry = new NpcTypeRegistryImpl();
NpcRegistryImpl npcRegistry = new NpcRegistryImpl(configManager, this, packetFactory, actionRegistry, scheduler, typeRegistry, propertyRegistry);
UserManager userManager = new UserManager();
@ -144,7 +144,7 @@ public class ZNpcsPlus extends JavaPlugin {
shutdownTasks.add(adventure::close);
if (configManager.getConfig().autoSaveEnabled()) shutdownTasks.add(npcRegistry::save);
NpcApiProvider.register(new ZNPCsPlusApi(npcRegistry));
NpcApiProvider.register(new ZNPCsPlusApi(npcRegistry, typeRegistry, propertyRegistry));
enabled = true;
log(ChatColor.WHITE + " * Loading complete! (" + (System.currentTimeMillis() - before) + "ms)");
log("");
@ -170,7 +170,7 @@ public class ZNpcsPlus extends JavaPlugin {
for (Runnable runnable : shutdownTasks) runnable.run();
}
private PacketFactory setupPacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, EntityPropertyRegistry propertyRegistry) {
private PacketFactory setupPacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, EntityPropertyRegistryImpl propertyRegistry) {
HashMap<ServerVersion, LazyLoader<? extends PacketFactory>> versions = new HashMap<>();
versions.put(ServerVersion.V_1_8, LazyLoader.of(() -> new V1_8PacketFactory(scheduler, metadataFactory, packetEvents, propertyRegistry)));
versions.put(ServerVersion.V_1_9, LazyLoader.of(() -> new V1_9PacketFactory(scheduler, metadataFactory, packetEvents, propertyRegistry)));
@ -209,7 +209,7 @@ public class ZNpcsPlus extends JavaPlugin {
}
private void registerCommands(NpcRegistryImpl npcRegistry, SkinCache skinCache, BukkitAudiences adventure, ActionRegistry actionRegistry, NpcTypeRegistry typeRegistry, EntityPropertyRegistry propertyRegistry) {
private void registerCommands(NpcRegistryImpl npcRegistry, SkinCache skinCache, BukkitAudiences adventure, ActionRegistry actionRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry) {
// TODO: make the messages better
Message<CommandContext> incorrectUsageMessage = context -> context.send(Component.text("Incorrect usage: /" + context.getUsage(), NamedTextColor.RED));
CommandManager manager = new CommandManager(this, adventure, incorrectUsageMessage);

@ -6,7 +6,7 @@ import lol.pyr.director.common.command.CommandExecutionException;
import lol.pyr.znpcsplus.npc.NpcEntryImpl;
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
import lol.pyr.znpcsplus.npc.NpcTypeImpl;
import lol.pyr.znpcsplus.npc.NpcTypeRegistry;
import lol.pyr.znpcsplus.npc.NpcTypeRegistryImpl;
import lol.pyr.znpcsplus.util.NpcLocation;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
@ -17,9 +17,9 @@ import java.util.List;
public class CreateCommand implements CommandHandler {
private final NpcRegistryImpl npcRegistry;
private final NpcTypeRegistry typeRegistry;
private final NpcTypeRegistryImpl typeRegistry;
public CreateCommand(NpcRegistryImpl npcRegistry, NpcTypeRegistry typeRegistry) {
public CreateCommand(NpcRegistryImpl npcRegistry, NpcTypeRegistryImpl typeRegistry) {
this.npcRegistry = npcRegistry;
this.typeRegistry = typeRegistry;
}

@ -3,6 +3,7 @@ package lol.pyr.znpcsplus.commands;
import lol.pyr.director.adventure.command.CommandContext;
import lol.pyr.director.adventure.command.CommandHandler;
import lol.pyr.director.common.command.CommandExecutionException;
import lol.pyr.znpcsplus.api.entity.EntityProperty;
import lol.pyr.znpcsplus.entity.EntityPropertyImpl;
import lol.pyr.znpcsplus.npc.NpcEntryImpl;
import lol.pyr.znpcsplus.npc.NpcImpl;
@ -37,7 +38,7 @@ public class PropertiesCommand implements CommandHandler {
public List<String> suggest(CommandContext context) throws CommandExecutionException {
if (context.argSize() == 1) return context.suggestCollection(npcRegistry.getModifiableIds());
if (context.argSize() == 2) return context.suggestStream(context.suggestionParse(0, NpcEntryImpl.class)
.getNpc().getType().getAllowedProperties().stream().map(EntityPropertyImpl::getName));
.getNpc().getType().getAllowedProperties().stream().map(EntityProperty::getName));
if (context.argSize() == 3) {
EntityPropertyImpl<?> property = context.suggestionParse(1, EntityPropertyImpl.class);
Class<?> type = property.getType();

@ -5,11 +5,11 @@ import lol.pyr.director.adventure.command.CommandContext;
import lol.pyr.director.adventure.command.CommandHandler;
import lol.pyr.director.common.command.CommandExecutionException;
import lol.pyr.znpcsplus.api.skin.SkinDescriptor;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.npc.NpcEntryImpl;
import lol.pyr.znpcsplus.npc.NpcImpl;
import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
import lol.pyr.znpcsplus.npc.NpcTypeRegistry;
import lol.pyr.znpcsplus.npc.NpcTypeRegistryImpl;
import lol.pyr.znpcsplus.skin.cache.SkinCache;
import lol.pyr.znpcsplus.skin.descriptor.FetchingDescriptor;
import lol.pyr.znpcsplus.skin.descriptor.MirrorDescriptor;
@ -23,10 +23,10 @@ import java.util.List;
public class SkinCommand implements CommandHandler {
private final SkinCache skinCache;
private final NpcRegistryImpl npcRegistry;
private final NpcTypeRegistry typeRegistry;
private final EntityPropertyRegistry propertyRegistry;
private final NpcTypeRegistryImpl typeRegistry;
private final EntityPropertyRegistryImpl propertyRegistry;
public SkinCommand(SkinCache skinCache, NpcRegistryImpl npcRegistry, NpcTypeRegistry typeRegistry, EntityPropertyRegistry propertyRegistry) {
public SkinCommand(SkinCache skinCache, NpcRegistryImpl npcRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry) {
this.skinCache = skinCache;
this.npcRegistry = npcRegistry;
this.typeRegistry = typeRegistry;

@ -12,9 +12,9 @@ import java.util.List;
public class TypeCommand implements CommandHandler {
private final NpcRegistryImpl registry;
private final NpcTypeRegistry typeRegistry;
private final NpcTypeRegistryImpl typeRegistry;
public TypeCommand(NpcRegistryImpl registry, NpcTypeRegistry typeRegistry) {
public TypeCommand(NpcRegistryImpl registry, NpcTypeRegistryImpl typeRegistry) {
this.registry = registry;
this.typeRegistry = typeRegistry;
}

@ -1,5 +1,6 @@
package lol.pyr.znpcsplus.entity;
import lol.pyr.znpcsplus.api.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.api.skin.SkinDescriptor;
import lol.pyr.znpcsplus.entity.serializers.BooleanPropertySerializer;
import lol.pyr.znpcsplus.entity.serializers.ComponentPropertySerializer;
@ -15,11 +16,11 @@ import java.util.List;
import java.util.Map;
@SuppressWarnings("unchecked")
public class EntityPropertyRegistry {
public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
private final Map<Class<?>, PropertySerializer<?>> serializerMap = new HashMap<>();
private final List<EntityPropertyImpl<?>> properties = new ArrayList<>();
public EntityPropertyRegistry(SkinCache skinCache) {
public EntityPropertyRegistryImpl(SkinCache skinCache) {
registerSerializer(new BooleanPropertySerializer());
registerSerializer(new ComponentPropertySerializer());
registerSerializer(new NamedTextColorPropertySerializer());

@ -4,7 +4,7 @@ import lol.pyr.znpcsplus.ZNpcsPlus;
import lol.pyr.znpcsplus.api.npc.NpcRegistry;
import lol.pyr.znpcsplus.api.npc.NpcType;
import lol.pyr.znpcsplus.config.ConfigManager;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.interaction.ActionRegistry;
import lol.pyr.znpcsplus.packets.PacketFactory;
import lol.pyr.znpcsplus.scheduling.TaskScheduler;
@ -23,7 +23,7 @@ public class NpcRegistryImpl implements NpcRegistry {
private final PacketFactory packetFactory;
private final ConfigManager configManager;
public NpcRegistryImpl(ConfigManager configManager, ZNpcsPlus plugin, PacketFactory packetFactory, ActionRegistry actionRegistry, TaskScheduler scheduler, NpcTypeRegistry typeRegistry, EntityPropertyRegistry propertyRegistry) {
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);
this.packetFactory = packetFactory;
this.configManager = configManager;

@ -3,12 +3,15 @@ package lol.pyr.znpcsplus.npc;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
import lol.pyr.znpcsplus.api.entity.EntityProperty;
import lol.pyr.znpcsplus.api.npc.NpcType;
import lol.pyr.znpcsplus.entity.EntityPropertyImpl;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import java.util.*;
import java.util.stream.Collectors;
public class NpcTypeImpl {
public class NpcTypeImpl implements NpcType {
private final EntityType type;
private final Set<EntityPropertyImpl<?>> allowedProperties;
private final String name;
@ -33,19 +36,19 @@ public class NpcTypeImpl {
return hologramOffset;
}
public Set<EntityPropertyImpl<?>> getAllowedProperties() {
return allowedProperties;
public Set<EntityProperty<?>> getAllowedProperties() {
return allowedProperties.stream().map(property -> (EntityProperty<?>) property).collect(Collectors.toSet());
}
protected static final class Builder {
private final EntityPropertyRegistry propertyRegistry;
private final EntityPropertyRegistryImpl propertyRegistry;
private final String name;
private final EntityType type;
private final List<EntityPropertyImpl<?>> allowedProperties = new ArrayList<>();
private boolean globalProperties = true;
private double hologramOffset = 0;
Builder(EntityPropertyRegistry propertyRegistry, String name, EntityType type) {
Builder(EntityPropertyRegistryImpl propertyRegistry, String name, EntityType type) {
this.propertyRegistry = propertyRegistry;
this.name = name;
this.type = type;

@ -4,7 +4,8 @@ import com.github.retrooper.packetevents.PacketEventsAPI;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.api.npc.NpcTypeRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import org.bukkit.plugin.Plugin;
import java.util.ArrayList;
@ -12,7 +13,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class NpcTypeRegistry {
public class NpcTypeRegistryImpl implements NpcTypeRegistry {
private final List<NpcTypeImpl> types = new ArrayList<>();
private NpcTypeImpl register(NpcTypeImpl.Builder builder) {
@ -24,7 +25,7 @@ public class NpcTypeRegistry {
return type;
}
public void registerDefault(PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistry propertyRegistry) {
public void registerDefault(PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistryImpl propertyRegistry) {
ServerVersion version = packetEvents.getServerManager().getVersion();
register(new NpcTypeImpl.Builder(propertyRegistry, "player", EntityTypes.PLAYER).setHologramOffset(-0.15D)

@ -3,7 +3,7 @@ package lol.pyr.znpcsplus.packets;
import com.github.retrooper.packetevents.PacketEventsAPI;
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import lol.pyr.znpcsplus.api.entity.PropertyHolder;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.entity.PacketEntity;
import lol.pyr.znpcsplus.metadata.MetadataFactory;
import lol.pyr.znpcsplus.scheduling.TaskScheduler;
@ -13,7 +13,7 @@ import org.bukkit.plugin.Plugin;
import java.util.Map;
public class V1_10PacketFactory extends V1_9PacketFactory {
public V1_10PacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistry propertyRegistry) {
public V1_10PacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistryImpl propertyRegistry) {
super(scheduler, metadataFactory, packetEvents, propertyRegistry);
}

@ -4,7 +4,7 @@ import com.github.retrooper.packetevents.PacketEventsAPI;
import com.github.retrooper.packetevents.util.Vector3d;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnEntity;
import lol.pyr.znpcsplus.api.entity.PropertyHolder;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.entity.PacketEntity;
import lol.pyr.znpcsplus.metadata.MetadataFactory;
import lol.pyr.znpcsplus.scheduling.TaskScheduler;
@ -15,7 +15,7 @@ import org.bukkit.plugin.Plugin;
import java.util.Optional;
public class V1_14PacketFactory extends V1_10PacketFactory {
public V1_14PacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistry propertyRegistry) {
public V1_14PacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistryImpl propertyRegistry) {
super(scheduler, metadataFactory, packetEvents, propertyRegistry);
}

@ -6,7 +6,7 @@ import com.github.retrooper.packetevents.protocol.player.GameMode;
import com.github.retrooper.packetevents.protocol.player.UserProfile;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoRemove;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.entity.PacketEntity;
import lol.pyr.znpcsplus.api.entity.PropertyHolder;
import lol.pyr.znpcsplus.metadata.MetadataFactory;
@ -19,7 +19,7 @@ import java.util.EnumSet;
import java.util.concurrent.CompletableFuture;
public class V1_19PacketFactory extends V1_14PacketFactory {
public V1_19PacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistry propertyRegistry) {
public V1_19PacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistryImpl propertyRegistry) {
super(scheduler, metadataFactory, packetEvents, propertyRegistry);
}

@ -12,7 +12,7 @@ import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import com.github.retrooper.packetevents.wrapper.play.server.*;
import lol.pyr.znpcsplus.api.entity.PropertyHolder;
import lol.pyr.znpcsplus.api.skin.SkinDescriptor;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.entity.PacketEntity;
import lol.pyr.znpcsplus.metadata.MetadataFactory;
import lol.pyr.znpcsplus.scheduling.TaskScheduler;
@ -30,9 +30,9 @@ public class V1_8PacketFactory implements PacketFactory {
protected final TaskScheduler scheduler;
protected final MetadataFactory metadataFactory;
protected final PacketEventsAPI<Plugin> packetEvents;
protected final EntityPropertyRegistry propertyRegistry;
protected final EntityPropertyRegistryImpl propertyRegistry;
public V1_8PacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistry propertyRegistry) {
public V1_8PacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistryImpl propertyRegistry) {
this.scheduler = scheduler;
this.metadataFactory = metadataFactory;
this.packetEvents = packetEvents;

@ -3,7 +3,7 @@ package lol.pyr.znpcsplus.packets;
import com.github.retrooper.packetevents.PacketEventsAPI;
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import lol.pyr.znpcsplus.api.entity.PropertyHolder;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.entity.PacketEntity;
import lol.pyr.znpcsplus.metadata.MetadataFactory;
import lol.pyr.znpcsplus.scheduling.TaskScheduler;
@ -13,7 +13,7 @@ import org.bukkit.plugin.Plugin;
import java.util.Map;
public class V1_9PacketFactory extends V1_8PacketFactory {
public V1_9PacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistry propertyRegistry) {
public V1_9PacketFactory(TaskScheduler scheduler, MetadataFactory metadataFactory, PacketEventsAPI<Plugin> packetEvents, EntityPropertyRegistryImpl propertyRegistry) {
super(scheduler, metadataFactory, packetEvents, propertyRegistry);
}

@ -5,15 +5,15 @@ import lol.pyr.director.adventure.parse.ParserType;
import lol.pyr.director.common.command.CommandExecutionException;
import lol.pyr.director.common.message.Message;
import lol.pyr.znpcsplus.entity.EntityPropertyImpl;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import java.util.Deque;
@SuppressWarnings("rawtypes")
public class EntityPropertyParser extends ParserType<EntityPropertyImpl/*<?>*/> {
private final EntityPropertyRegistry propertyRegistry;
private final EntityPropertyRegistryImpl propertyRegistry;
public EntityPropertyParser(Message<CommandContext> message, EntityPropertyRegistry propertyRegistry) {
public EntityPropertyParser(Message<CommandContext> message, EntityPropertyRegistryImpl propertyRegistry) {
super(message);
this.propertyRegistry = propertyRegistry;
}

@ -5,14 +5,14 @@ import lol.pyr.director.adventure.parse.ParserType;
import lol.pyr.director.common.command.CommandExecutionException;
import lol.pyr.director.common.message.Message;
import lol.pyr.znpcsplus.npc.NpcTypeImpl;
import lol.pyr.znpcsplus.npc.NpcTypeRegistry;
import lol.pyr.znpcsplus.npc.NpcTypeRegistryImpl;
import java.util.Deque;
public class NpcTypeParser extends ParserType<NpcTypeImpl> {
private final NpcTypeRegistry typeRegistry;
private final NpcTypeRegistryImpl typeRegistry;
public NpcTypeParser(Message<CommandContext> message, NpcTypeRegistry typeRegistry) {
public NpcTypeParser(Message<CommandContext> message, NpcTypeRegistryImpl typeRegistry) {
super(message);
this.typeRegistry = typeRegistry;
}

@ -2,9 +2,9 @@ package lol.pyr.znpcsplus.storage;
import lol.pyr.znpcsplus.ZNpcsPlus;
import lol.pyr.znpcsplus.config.ConfigManager;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.interaction.ActionRegistry;
import lol.pyr.znpcsplus.npc.NpcTypeRegistry;
import lol.pyr.znpcsplus.npc.NpcTypeRegistryImpl;
import lol.pyr.znpcsplus.packets.PacketFactory;
import lol.pyr.znpcsplus.storage.yaml.YamlStorage;
@ -13,10 +13,10 @@ import java.io.File;
public enum NpcStorageType {
YAML {
@Override
public NpcStorage create(ConfigManager configManager, ZNpcsPlus plugin, PacketFactory packetFactory, ActionRegistry actionRegistry, NpcTypeRegistry typeRegistry, EntityPropertyRegistry propertyRegistry) {
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 abstract NpcStorage create(ConfigManager configManager, ZNpcsPlus plugin, PacketFactory packetFactory, ActionRegistry actionRegistry, NpcTypeRegistry typeRegistry, EntityPropertyRegistry propertyRegistry);
public abstract NpcStorage create(ConfigManager configManager, ZNpcsPlus plugin, PacketFactory packetFactory, ActionRegistry actionRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry);
}

@ -2,12 +2,12 @@ package lol.pyr.znpcsplus.storage.yaml;
import lol.pyr.znpcsplus.config.ConfigManager;
import lol.pyr.znpcsplus.entity.EntityPropertyImpl;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistry;
import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
import lol.pyr.znpcsplus.hologram.HologramLine;
import lol.pyr.znpcsplus.interaction.ActionRegistry;
import lol.pyr.znpcsplus.npc.NpcEntryImpl;
import lol.pyr.znpcsplus.npc.NpcImpl;
import lol.pyr.znpcsplus.npc.NpcTypeRegistry;
import lol.pyr.znpcsplus.npc.NpcTypeRegistryImpl;
import lol.pyr.znpcsplus.packets.PacketFactory;
import lol.pyr.znpcsplus.storage.NpcStorage;
import lol.pyr.znpcsplus.util.NpcLocation;
@ -24,11 +24,11 @@ public class YamlStorage implements NpcStorage {
private final PacketFactory packetFactory;
private final ConfigManager configManager;
private final ActionRegistry actionRegistry;
private final NpcTypeRegistry typeRegistry;
private final EntityPropertyRegistry propertyRegistry;
private final NpcTypeRegistryImpl typeRegistry;
private final EntityPropertyRegistryImpl propertyRegistry;
private final File folder;
public YamlStorage(PacketFactory packetFactory, ConfigManager configManager, ActionRegistry actionRegistry, NpcTypeRegistry typeRegistry, EntityPropertyRegistry propertyRegistry, File folder) {
public YamlStorage(PacketFactory packetFactory, ConfigManager configManager, ActionRegistry actionRegistry, NpcTypeRegistryImpl typeRegistry, EntityPropertyRegistryImpl propertyRegistry, File folder) {
this.packetFactory = packetFactory;
this.configManager = configManager;
this.actionRegistry = actionRegistry;