diff --git a/api/src/main/java/lol/pyr/znpcsplus/api/ZApi.java b/api/src/main/java/lol/pyr/znpcsplus/api/ZApi.java index 0ecda85..edd5a25 100644 --- a/api/src/main/java/lol/pyr/znpcsplus/api/ZApi.java +++ b/api/src/main/java/lol/pyr/znpcsplus/api/ZApi.java @@ -1,7 +1,7 @@ package lol.pyr.znpcsplus.api; -import lol.pyr.znpcsplus.api.npc.NPCRegistry; +import lol.pyr.znpcsplus.api.npc.NpcRegistry; public interface ZApi { - NPCRegistry getNPCRegistry(); + NpcRegistry getNpcRegistry(); } diff --git a/api/src/main/java/lol/pyr/znpcsplus/api/npc/NPC.java b/api/src/main/java/lol/pyr/znpcsplus/api/npc/Npc.java similarity index 78% rename from api/src/main/java/lol/pyr/znpcsplus/api/npc/NPC.java rename to api/src/main/java/lol/pyr/znpcsplus/api/npc/Npc.java index a8f0628..ff91d1c 100644 --- a/api/src/main/java/lol/pyr/znpcsplus/api/npc/NPC.java +++ b/api/src/main/java/lol/pyr/znpcsplus/api/npc/Npc.java @@ -3,6 +3,6 @@ package lol.pyr.znpcsplus.api.npc; import lol.pyr.znpcsplus.api.hologram.Hologram; import lol.pyr.znpcsplus.api.entity.PropertyHolder; -public interface NPC extends PropertyHolder { +public interface Npc extends PropertyHolder { Hologram getHologram(); } diff --git a/api/src/main/java/lol/pyr/znpcsplus/api/npc/NPCEntry.java b/api/src/main/java/lol/pyr/znpcsplus/api/npc/NpcEntry.java similarity index 84% rename from api/src/main/java/lol/pyr/znpcsplus/api/npc/NPCEntry.java rename to api/src/main/java/lol/pyr/znpcsplus/api/npc/NpcEntry.java index 95ec02d..caad7d6 100644 --- a/api/src/main/java/lol/pyr/znpcsplus/api/npc/NPCEntry.java +++ b/api/src/main/java/lol/pyr/znpcsplus/api/npc/NpcEntry.java @@ -1,7 +1,7 @@ package lol.pyr.znpcsplus.api.npc; -public interface NPCEntry { - NPC getNpc(); +public interface NpcEntry { + Npc getNpc(); boolean isProcessed(); void setProcessed(boolean value); diff --git a/api/src/main/java/lol/pyr/znpcsplus/api/npc/NPCRegistry.java b/api/src/main/java/lol/pyr/znpcsplus/api/npc/NpcRegistry.java similarity index 55% rename from api/src/main/java/lol/pyr/znpcsplus/api/npc/NPCRegistry.java rename to api/src/main/java/lol/pyr/znpcsplus/api/npc/NpcRegistry.java index 98c360b..1e0aa0a 100644 --- a/api/src/main/java/lol/pyr/znpcsplus/api/npc/NPCRegistry.java +++ b/api/src/main/java/lol/pyr/znpcsplus/api/npc/NpcRegistry.java @@ -5,10 +5,10 @@ import org.bukkit.World; import java.util.Collection; -public interface NPCRegistry { - Collection all(); +public interface NpcRegistry { + Collection all(); Collection ids(); - NPCEntry create(String id, World world, NPCType type, ZLocation location); - NPCEntry get(String id); + NpcEntry create(String id, World world, NpcType type, ZLocation location); + NpcEntry get(String id); void delete(String id); -} \ No newline at end of file +} diff --git a/api/src/main/java/lol/pyr/znpcsplus/api/npc/NPCType.java b/api/src/main/java/lol/pyr/znpcsplus/api/npc/NpcType.java similarity index 82% rename from api/src/main/java/lol/pyr/znpcsplus/api/npc/NPCType.java rename to api/src/main/java/lol/pyr/znpcsplus/api/npc/NpcType.java index 4cc9a3f..855251e 100644 --- a/api/src/main/java/lol/pyr/znpcsplus/api/npc/NPCType.java +++ b/api/src/main/java/lol/pyr/znpcsplus/api/npc/NpcType.java @@ -8,14 +8,14 @@ import lol.pyr.znpcsplus.api.entity.EntityProperty; import java.util.*; -public class NPCType { - private final static Map BY_NAME = new HashMap<>(); +public class NpcType { + private final static Map BY_NAME = new HashMap<>(); - public static Collection values() { + public static Collection values() { return BY_NAME.values(); } - public static NPCType byName(String name) { + public static NpcType byName(String name) { return BY_NAME.get(name.toUpperCase()); } @@ -24,7 +24,7 @@ public class NPCType { private final String name; private final double hologramOffset; - private NPCType(String name, EntityType type, double hologramOffset, Set> allowedProperties) { + private NpcType(String name, EntityType type, double hologramOffset, Set> allowedProperties) { this.name = name.toUpperCase(); this.type = type; this.hologramOffset = hologramOffset; @@ -47,29 +47,29 @@ public class NPCType { return allowedProperties; } - private static NPCType define(Builder builder) { + private static NpcType define(Builder builder) { return define(builder.build()); } - private static NPCType define(NPCType type) { + private static NpcType define(NpcType type) { BY_NAME.put(type.getName(), type); return type; } - public static final NPCType PLAYER = define( + public static final NpcType PLAYER = define( new Builder("player", EntityTypes.PLAYER) .addProperties(EntityProperty.SKIN, EntityProperty.SKIN_LAYERS) .setHologramOffset(-0.45D)); - public static final NPCType CREEPER = define( + public static final NpcType CREEPER = define( new Builder("creeper", EntityTypes.CREEPER) .setHologramOffset(-0.6D)); - public static final NPCType ZOMBIE = define( + public static final NpcType ZOMBIE = define( new Builder("zombie", EntityTypes.ZOMBIE) .setHologramOffset(-0.3D)); - public static final NPCType SKELETON = define( + public static final NpcType SKELETON = define( new Builder("skeleton", EntityTypes.SKELETON) .setHologramOffset(-0.3D)); @@ -100,7 +100,7 @@ public class NPCType { return this; } - public NPCType build() { + public NpcType build() { if (globalProperties) { allowedProperties.add(EntityProperty.FIRE); allowedProperties.add(EntityProperty.INVISIBLE); @@ -108,7 +108,7 @@ public class NPCType { if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) allowedProperties.add(EntityProperty.GLOW); } - return new NPCType(name, type, hologramOffset, new HashSet<>(allowedProperties)); + return new NpcType(name, type, hologramOffset, new HashSet<>(allowedProperties)); } } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/ZNPCsApi.java b/plugin/src/main/java/lol/pyr/znpcsplus/ZNPCsApi.java deleted file mode 100644 index 65439c6..0000000 --- a/plugin/src/main/java/lol/pyr/znpcsplus/ZNPCsApi.java +++ /dev/null @@ -1,12 +0,0 @@ -package lol.pyr.znpcsplus; - -import lol.pyr.znpcsplus.api.ZApi; -import lol.pyr.znpcsplus.api.npc.NPCRegistry; -import lol.pyr.znpcsplus.npc.NPCRegistryImpl; - -public class ZNPCsApi implements ZApi { - @Override - public NPCRegistry getNPCRegistry() { - return NPCRegistryImpl.get(); - } -} diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsApi.java b/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsApi.java new file mode 100644 index 0000000..b557943 --- /dev/null +++ b/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsApi.java @@ -0,0 +1,12 @@ +package lol.pyr.znpcsplus; + +import lol.pyr.znpcsplus.api.ZApi; +import lol.pyr.znpcsplus.api.npc.NpcRegistry; +import lol.pyr.znpcsplus.npc.NpcRegistryImpl; + +public class ZNpcsApi implements ZApi { + @Override + public NpcRegistry getNpcRegistry() { + return NpcRegistryImpl.get(); + } +} diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/ZNPCsPlus.java b/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java similarity index 88% rename from plugin/src/main/java/lol/pyr/znpcsplus/ZNPCsPlus.java rename to plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java index 5c00af9..e82dcaf 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/ZNPCsPlus.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/ZNpcsPlus.java @@ -8,14 +8,14 @@ import lol.pyr.director.adventure.command.CommandManager; import lol.pyr.director.adventure.command.MultiCommand; import lol.pyr.znpcsplus.api.ZApiProvider; import lol.pyr.znpcsplus.api.entity.EntityProperty; -import lol.pyr.znpcsplus.api.npc.NPCType; +import lol.pyr.znpcsplus.api.npc.NpcType; import lol.pyr.znpcsplus.config.Configs; import lol.pyr.znpcsplus.interaction.InteractionPacketListener; import lol.pyr.znpcsplus.interaction.types.ConsoleCommandAction; import lol.pyr.znpcsplus.interaction.types.MessageAction; -import lol.pyr.znpcsplus.npc.NPCEntryImpl; -import lol.pyr.znpcsplus.npc.NPCImpl; -import lol.pyr.znpcsplus.npc.NPCRegistryImpl; +import lol.pyr.znpcsplus.npc.NpcEntryImpl; +import lol.pyr.znpcsplus.npc.NpcImpl; +import lol.pyr.znpcsplus.npc.NpcRegistryImpl; import lol.pyr.znpcsplus.scheduling.FoliaScheduler; import lol.pyr.znpcsplus.scheduling.SpigotScheduler; import lol.pyr.znpcsplus.scheduling.TaskScheduler; @@ -24,7 +24,7 @@ import lol.pyr.znpcsplus.skin.cache.SkinCacheCleanTask; import lol.pyr.znpcsplus.skin.descriptor.FetchingDescriptor; import lol.pyr.znpcsplus.skin.descriptor.MirrorDescriptor; import lol.pyr.znpcsplus.skin.descriptor.PrefetchedDescriptor; -import lol.pyr.znpcsplus.tasks.NPCVisibilityTask; +import lol.pyr.znpcsplus.tasks.NpcVisibilityTask; import lol.pyr.znpcsplus.updater.UpdateChecker; import lol.pyr.znpcsplus.updater.UpdateNotificationListener; import lol.pyr.znpcsplus.user.User; @@ -46,7 +46,7 @@ import java.io.File; import java.io.IOException; import java.util.logging.Logger; -public class ZNPCsPlus extends JavaPlugin { +public class ZNpcsPlus extends JavaPlugin { public static Logger LOGGER; public static File PLUGIN_FOLDER; public static File PATH_FOLDER; @@ -127,12 +127,12 @@ public class ZNPCsPlus extends JavaPlugin { registerCommands(); log(ChatColor.WHITE + " * Starting tasks..."); - new NPCVisibilityTask(); + new NpcVisibilityTask(); new SkinCacheCleanTask(); new UserListener(this); if (Configs.config().checkForUpdates()) new UpdateNotificationListener(this, new UpdateChecker(this)); - ZApiProvider.register(new ZNPCsApi()); + ZApiProvider.register(new ZNpcsApi()); enabled = true; log(ChatColor.WHITE + " * Loading complete! (" + (System.currentTimeMillis() - before) + "ms)"); log(""); @@ -143,10 +143,10 @@ public class ZNPCsPlus extends JavaPlugin { int z = 0; World world = Bukkit.getWorld("world"); if (world == null) world = Bukkit.getWorlds().get(0); - for (NPCType type : NPCType.values()) { - NPCEntryImpl entry = NPCRegistryImpl.get().create("debug_npc" + (z * wrap + x), world, type, new ZLocation(x * 3, 200, z * 3, 0, 0)); + for (NpcType type : NpcType.values()) { + NpcEntryImpl entry = NpcRegistryImpl.get().create("debug_npc" + (z * wrap + x), world, type, new ZLocation(x * 3, 200, z * 3, 0, 0)); entry.setProcessed(true); - NPCImpl npc = entry.getNpc(); + NpcImpl npc = entry.getNpc(); if (type.getType() == EntityTypes.PLAYER) { SkinCache.fetchByName("Notch").thenAccept(skin -> npc.setProperty(EntityProperty.SKIN, new PrefetchedDescriptor(skin))); npc.setProperty(EntityProperty.INVISIBLE, true); @@ -159,13 +159,13 @@ public class ZNPCsPlus extends JavaPlugin { z++; } } - NPCEntryImpl entry = NPCRegistryImpl.get().create("debug_npc" + (z * wrap + x), world, NPCType.byName("player"), new ZLocation(x * 3, 200, z * 3, 0, 0)); + NpcEntryImpl entry = NpcRegistryImpl.get().create("debug_npc" + (z * wrap + x), world, NpcType.byName("player"), new ZLocation(x * 3, 200, z * 3, 0, 0)); entry.setProcessed(true); - NPCImpl npc = entry.getNpc(); + NpcImpl npc = entry.getNpc(); npc.setProperty(EntityProperty.SKIN, new FetchingDescriptor("jeb_")); npc.addAction(new MessageAction(1000L, "Hi, I'm jeb!")); x++; - entry = NPCRegistryImpl.get().create("debug_npc" + (z * wrap + x), world, NPCType.byName("player"), new ZLocation(x * 3, 200, z * 3, 0, 0)); + entry = NpcRegistryImpl.get().create("debug_npc" + (z * wrap + x), world, NpcType.byName("player"), new ZLocation(x * 3, 200, z * 3, 0, 0)); entry.setProcessed(true); npc = entry.getNpc(); npc.setProperty(EntityProperty.SKIN, new MirrorDescriptor()); diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/command/CreateCommand.java b/plugin/src/main/java/lol/pyr/znpcsplus/command/CreateCommand.java index 9157ee0..d127831 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/command/CreateCommand.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/command/CreateCommand.java @@ -3,12 +3,12 @@ package lol.pyr.znpcsplus.command; 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.npc.NPCRegistryImpl; +import lol.pyr.znpcsplus.npc.NpcRegistryImpl; public class CreateCommand implements CommandHandler { @Override public void run(CommandContext context) throws CommandExecutionException { String id = context.popString(); - NPCRegistryImpl.get().get(id); + NpcRegistryImpl.get().get(id); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/config/Configs.java b/plugin/src/main/java/lol/pyr/znpcsplus/config/Configs.java index 832e803..e58daab 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/config/Configs.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/config/Configs.java @@ -1,6 +1,6 @@ package lol.pyr.znpcsplus.config; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import space.arim.dazzleconf.ConfigurationFactory; import space.arim.dazzleconf.ConfigurationOptions; import space.arim.dazzleconf.error.ConfigFormatSyntaxException; @@ -40,13 +40,13 @@ public class Configs { config = configHelper.reloadConfigData(); messages = messagesHelper.reloadConfigData(); } catch (IOException e) { - ZNPCsPlus.LOGGER.severe("Couldn't open config file!"); + ZNpcsPlus.LOGGER.severe("Couldn't open config file!"); e.printStackTrace(); } catch (ConfigFormatSyntaxException e) { - ZNPCsPlus.LOGGER.severe("Invalid config syntax!"); + ZNpcsPlus.LOGGER.severe("Invalid config syntax!"); e.printStackTrace(); } catch (InvalidConfigException e) { - ZNPCsPlus.LOGGER.severe("Invalid config value!"); + ZNpcsPlus.LOGGER.severe("Invalid config value!"); e.printStackTrace(); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/InteractionPacketListener.java b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/InteractionPacketListener.java index 5b211df..0979469 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/InteractionPacketListener.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/InteractionPacketListener.java @@ -4,9 +4,9 @@ import com.github.retrooper.packetevents.event.PacketListener; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; -import lol.pyr.znpcsplus.npc.NPCEntryImpl; -import lol.pyr.znpcsplus.npc.NPCImpl; -import lol.pyr.znpcsplus.npc.NPCRegistryImpl; +import lol.pyr.znpcsplus.npc.NpcEntryImpl; +import lol.pyr.znpcsplus.npc.NpcImpl; +import lol.pyr.znpcsplus.npc.NpcRegistryImpl; import lol.pyr.znpcsplus.user.User; import org.bukkit.entity.Player; @@ -20,11 +20,11 @@ public class InteractionPacketListener implements PacketListener { User user = User.get(player); if (!user.canInteract()) return; - NPCEntryImpl entry = NPCRegistryImpl.get().getByEntityId(packet.getEntityId()); + NpcEntryImpl entry = NpcRegistryImpl.get().getByEntityId(packet.getEntityId()); if (entry == null || !entry.isProcessed()) return; - NPCImpl npc = entry.getNpc(); + NpcImpl npc = entry.getNpc(); - for (NPCAction action : npc.getActions()) { + for (NpcAction action : npc.getActions()) { if (action.getCooldown() > 0 && !user.actionCooldownCheck(action)) continue; action.run(player); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NPCActionDeserializer.java b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NPCActionDeserializer.java deleted file mode 100644 index 957ed09..0000000 --- a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NPCActionDeserializer.java +++ /dev/null @@ -1,6 +0,0 @@ -package lol.pyr.znpcsplus.interaction; - -@FunctionalInterface -interface NPCActionDeserializer { - NPCAction deserialize(long delay, String argument); -} \ No newline at end of file diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NPCAction.java b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NpcAction.java similarity index 83% rename from plugin/src/main/java/lol/pyr/znpcsplus/interaction/NPCAction.java rename to plugin/src/main/java/lol/pyr/znpcsplus/interaction/NpcAction.java index f498e36..eb2e0ba 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NPCAction.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NpcAction.java @@ -4,12 +4,12 @@ import org.bukkit.entity.Player; import java.util.UUID; -public abstract class NPCAction { +public abstract class NpcAction { private final UUID id; private final long delay; protected final String argument; - protected NPCAction(long delay, String argument) { + protected NpcAction(long delay, String argument) { this.id = UUID.randomUUID(); this.delay = delay; this.argument = argument; diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NpcActionDeserializer.java b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NpcActionDeserializer.java new file mode 100644 index 0000000..ff6d029 --- /dev/null +++ b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NpcActionDeserializer.java @@ -0,0 +1,6 @@ +package lol.pyr.znpcsplus.interaction; + +@FunctionalInterface +interface NpcActionDeserializer { + NpcAction deserialize(long delay, String argument); +} diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NPCActionType.java b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NpcActionType.java similarity index 61% rename from plugin/src/main/java/lol/pyr/znpcsplus/interaction/NPCActionType.java rename to plugin/src/main/java/lol/pyr/znpcsplus/interaction/NpcActionType.java index 80d8d60..b92a4ef 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NPCActionType.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/NpcActionType.java @@ -2,20 +2,20 @@ package lol.pyr.znpcsplus.interaction; import lol.pyr.znpcsplus.interaction.types.*; -public enum NPCActionType implements NPCActionDeserializer { +public enum NpcActionType implements NpcActionDeserializer { CONSOLE_CMD(ConsoleCommandAction::new), MESSAGE(MessageAction::new), PLAYER_CMD(PlayerCommandAction::new), SERVER(SwitchServerAction::new); - private final NPCActionDeserializer deserializer; + private final NpcActionDeserializer deserializer; - NPCActionType(NPCActionDeserializer deserializer) { + NpcActionType(NpcActionDeserializer deserializer) { this.deserializer = deserializer; } @Override - public NPCAction deserialize(long delay, String str) { + public NpcAction deserialize(long delay, String str) { return deserializer.deserialize(delay, str); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/ConsoleCommandAction.java b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/ConsoleCommandAction.java index 66eaf34..d466bb9 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/ConsoleCommandAction.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/ConsoleCommandAction.java @@ -1,12 +1,12 @@ package lol.pyr.znpcsplus.interaction.types; -import lol.pyr.znpcsplus.ZNPCsPlus; -import lol.pyr.znpcsplus.interaction.NPCAction; +import lol.pyr.znpcsplus.ZNpcsPlus; +import lol.pyr.znpcsplus.interaction.NpcAction; import me.clip.placeholderapi.PlaceholderAPI; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -public class ConsoleCommandAction extends NPCAction { +public class ConsoleCommandAction extends NpcAction { public ConsoleCommandAction(long delay, String argument) { super(delay, argument); } @@ -14,6 +14,6 @@ public class ConsoleCommandAction extends NPCAction { @Override public void run(Player player) { String cmd = argument.replace("{player}", player.getName()).replace("{uuid}", player.getUniqueId().toString()); - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ZNPCsPlus.PLACEHOLDERS_SUPPORTED ? PlaceholderAPI.setPlaceholders(player, cmd) : cmd); + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ZNpcsPlus.PLACEHOLDERS_SUPPORTED ? PlaceholderAPI.setPlaceholders(player, cmd) : cmd); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/MessageAction.java b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/MessageAction.java index 93860a4..b19d03e 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/MessageAction.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/MessageAction.java @@ -1,12 +1,12 @@ package lol.pyr.znpcsplus.interaction.types; -import lol.pyr.znpcsplus.ZNPCsPlus; -import lol.pyr.znpcsplus.interaction.NPCAction; +import lol.pyr.znpcsplus.ZNpcsPlus; +import lol.pyr.znpcsplus.interaction.NpcAction; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.entity.Player; -public class MessageAction extends NPCAction { +public class MessageAction extends NpcAction { private final Component message; public MessageAction(long delay, String argument) { @@ -16,6 +16,6 @@ public class MessageAction extends NPCAction { @Override public void run(Player player) { - ZNPCsPlus.ADVENTURE.player(player).sendMessage(message); + ZNpcsPlus.ADVENTURE.player(player).sendMessage(message); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/PlayerCommandAction.java b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/PlayerCommandAction.java index 85ad43c..c928bad 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/PlayerCommandAction.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/PlayerCommandAction.java @@ -1,12 +1,12 @@ package lol.pyr.znpcsplus.interaction.types; -import lol.pyr.znpcsplus.ZNPCsPlus; -import lol.pyr.znpcsplus.interaction.NPCAction; +import lol.pyr.znpcsplus.ZNpcsPlus; +import lol.pyr.znpcsplus.interaction.NpcAction; import me.clip.placeholderapi.PlaceholderAPI; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -public class PlayerCommandAction extends NPCAction { +public class PlayerCommandAction extends NpcAction { public PlayerCommandAction(long delay, String argument) { super(delay, argument); } @@ -14,6 +14,6 @@ public class PlayerCommandAction extends NPCAction { @Override public void run(Player player) { String cmd = argument.replace("{player}", player.getName()).replace("{uuid}", player.getUniqueId().toString()); - Bukkit.dispatchCommand(player, ZNPCsPlus.PLACEHOLDERS_SUPPORTED ? PlaceholderAPI.setPlaceholders(player, cmd) : cmd); + Bukkit.dispatchCommand(player, ZNpcsPlus.PLACEHOLDERS_SUPPORTED ? PlaceholderAPI.setPlaceholders(player, cmd) : cmd); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/SwitchServerAction.java b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/SwitchServerAction.java index b814e10..c872a08 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/SwitchServerAction.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/interaction/types/SwitchServerAction.java @@ -1,16 +1,16 @@ package lol.pyr.znpcsplus.interaction.types; -import lol.pyr.znpcsplus.ZNPCsPlus; -import lol.pyr.znpcsplus.interaction.NPCAction; +import lol.pyr.znpcsplus.ZNpcsPlus; +import lol.pyr.znpcsplus.interaction.NpcAction; import org.bukkit.entity.Player; -public class SwitchServerAction extends NPCAction { +public class SwitchServerAction extends NpcAction { public SwitchServerAction(long delay, String argument) { super(delay, argument); } @Override public void run(Player player) { - ZNPCsPlus.BUNGEE_UTILS.sendPlayerToServer(player, argument); + ZNpcsPlus.BUNGEE_UTILS.sendPlayerToServer(player, argument); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/MetadataFactory.java b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/MetadataFactory.java index 35e1bd2..8007187 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/metadata/MetadataFactory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/metadata/MetadataFactory.java @@ -3,7 +3,7 @@ package lol.pyr.znpcsplus.metadata; import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.manager.server.ServerVersion; import com.github.retrooper.packetevents.protocol.entity.data.EntityData; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import lol.pyr.znpcsplus.util.LazyLoader; import net.kyori.adventure.text.Component; @@ -42,7 +42,7 @@ public interface MetadataFactory { if (v.isNewerThan(version)) continue; if (!factories.containsKey(v)) continue; MetadataFactory f = factories.get(v).get(); - ZNPCsPlus.debug("Using MetadataFactory Version " + v.name() + " (" + f.getClass().getName() + ")"); + ZNpcsPlus.debug("Using MetadataFactory Version " + v.name() + " (" + f.getClass().getName() + ")"); return f; } throw new RuntimeException("Unsupported version!"); diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NPCEntryImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcEntryImpl.java similarity index 82% rename from plugin/src/main/java/lol/pyr/znpcsplus/npc/NPCEntryImpl.java rename to plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcEntryImpl.java index 712a6f1..4c1deb4 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NPCEntryImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcEntryImpl.java @@ -1,20 +1,20 @@ package lol.pyr.znpcsplus.npc; -import lol.pyr.znpcsplus.api.npc.NPCEntry; +import lol.pyr.znpcsplus.api.npc.NpcEntry; -public class NPCEntryImpl implements NPCEntry { - private final NPCImpl npc; +public class NpcEntryImpl implements NpcEntry { + private final NpcImpl npc; private boolean process = false; private boolean save = false; private boolean modify = false; - public NPCEntryImpl(NPCImpl npc) { + public NpcEntryImpl(NpcImpl npc) { this.npc = npc; } @Override - public NPCImpl getNpc() { + public NpcImpl getNpc() { return npc; } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NPCImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcImpl.java similarity index 84% rename from plugin/src/main/java/lol/pyr/znpcsplus/npc/NPCImpl.java rename to plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcImpl.java index ed3134b..c15b919 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NPCImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcImpl.java @@ -1,10 +1,11 @@ package lol.pyr.znpcsplus.npc; import lol.pyr.znpcsplus.api.entity.EntityProperty; -import lol.pyr.znpcsplus.api.npc.NPCType; +import lol.pyr.znpcsplus.api.npc.NpcType; +import lol.pyr.znpcsplus.api.npc.Npc; import lol.pyr.znpcsplus.entity.PacketEntity; import lol.pyr.znpcsplus.hologram.HologramImpl; -import lol.pyr.znpcsplus.interaction.NPCAction; +import lol.pyr.znpcsplus.interaction.NpcAction; import lol.pyr.znpcsplus.util.Viewable; import lol.pyr.znpcsplus.util.ZLocation; import org.bukkit.Bukkit; @@ -13,18 +14,18 @@ import org.bukkit.entity.Player; import java.util.*; -public class NPCImpl extends Viewable implements lol.pyr.znpcsplus.api.npc.NPC { +public class NpcImpl extends Viewable implements Npc { private final Set viewers = new HashSet<>(); private final String worldName; private PacketEntity entity; private ZLocation location; - private NPCType type; + private NpcType type; private final HologramImpl hologram; private final Map, Object> propertyMap = new HashMap<>(); - private final Set actions = new HashSet<>(); + private final Set actions = new HashSet<>(); - protected NPCImpl(World world, NPCType type, ZLocation location) { + protected NpcImpl(World world, NpcType type, ZLocation location) { this.worldName = world.getName(); this.type = type; this.location = location; @@ -32,14 +33,14 @@ public class NPCImpl extends Viewable implements lol.pyr.znpcsplus.api.npc.NPC { hologram = new HologramImpl(location.withY(location.getY() + type.getHologramOffset())); } - public void setType(NPCType type) { + public void setType(NpcType type) { UNSAFE_hideAll(); this.type = type; entity = new PacketEntity(this, type.getType(), entity.getLocation()); UNSAFE_showAll(); } - public NPCType getType() { + public NpcType getType() { return type; } @@ -103,11 +104,11 @@ public class NPCImpl extends Viewable implements lol.pyr.znpcsplus.api.npc.NPC { _refreshMeta(); } - public Collection getActions() { + public Collection getActions() { return Collections.unmodifiableSet(actions); } - public void addAction(NPCAction action) { + public void addAction(NpcAction action) { actions.add(action); } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NPCRegistryImpl.java b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcRegistryImpl.java similarity index 64% rename from plugin/src/main/java/lol/pyr/znpcsplus/npc/NPCRegistryImpl.java rename to plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcRegistryImpl.java index d6d4e48..0948c80 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/npc/NPCRegistryImpl.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/npc/NpcRegistryImpl.java @@ -1,7 +1,7 @@ package lol.pyr.znpcsplus.npc; -import lol.pyr.znpcsplus.api.npc.NPCRegistry; -import lol.pyr.znpcsplus.api.npc.NPCType; +import lol.pyr.znpcsplus.api.npc.NpcRegistry; +import lol.pyr.znpcsplus.api.npc.NpcType; import lol.pyr.znpcsplus.util.ZLocation; import org.bukkit.World; @@ -10,28 +10,28 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -public class NPCRegistryImpl implements NPCRegistry { - private final static NPCRegistryImpl registry = new NPCRegistryImpl(); +public class NpcRegistryImpl implements NpcRegistry { + private final static NpcRegistryImpl registry = new NpcRegistryImpl(); - public static NPCRegistryImpl get() { + public static NpcRegistryImpl get() { return registry; } - private NPCRegistryImpl() { + private NpcRegistryImpl() { if (registry != null) throw new UnsupportedOperationException("This class can only be instanciated once!"); } - private final Map npcMap = new HashMap<>(); + private final Map npcMap = new HashMap<>(); - public NPCEntryImpl get(String id) { + public NpcEntryImpl get(String id) { return npcMap.get(id.toUpperCase()); } - public Collection all() { + public Collection all() { return Collections.unmodifiableCollection(npcMap.values()); } - public NPCEntryImpl getByEntityId(int id) { + public NpcEntryImpl getByEntityId(int id) { return all().stream().filter(entry -> entry.getNpc().getEntity().getEntityId() == id).findFirst().orElse(null); } @@ -40,11 +40,11 @@ public class NPCRegistryImpl implements NPCRegistry { } @Override - public NPCEntryImpl create(String id, World world, NPCType type, ZLocation location) { + public NpcEntryImpl create(String id, World world, NpcType type, ZLocation location) { id = id.toUpperCase(); if (npcMap.containsKey(id)) throw new IllegalArgumentException("An npc with the id " + id + " already exists!"); - NPCImpl npc = new NPCImpl(world, type, location); - NPCEntryImpl entry = new NPCEntryImpl(npc); + NpcImpl npc = new NpcImpl(world, type, location); + NpcEntryImpl entry = new NpcEntryImpl(npc); npcMap.put(id, entry); return entry; } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/packets/PacketFactory.java b/plugin/src/main/java/lol/pyr/znpcsplus/packets/PacketFactory.java index f1d434c..1f5711f 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/packets/PacketFactory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/packets/PacketFactory.java @@ -3,7 +3,7 @@ package lol.pyr.znpcsplus.packets; import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.manager.server.ServerVersion; import com.github.retrooper.packetevents.protocol.entity.data.EntityData; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import lol.pyr.znpcsplus.entity.PacketEntity; import lol.pyr.znpcsplus.api.entity.PropertyHolder; import lol.pyr.znpcsplus.util.LazyLoader; @@ -37,7 +37,7 @@ public interface PacketFactory { if (v.isNewerThan(version)) continue; if (!factories.containsKey(v)) continue; PacketFactory f = factories.get(v).get(); - ZNPCsPlus.debug("Using PacketFactory Version " + v.name() + " (" + f.getClass().getName() + ")"); + ZNpcsPlus.debug("Using PacketFactory Version " + v.name() + " (" + f.getClass().getName() + ")"); return f; } throw new RuntimeException("Unsupported version!"); diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java index 4d1e731..cd4c0a6 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/packets/V1_8Factory.java @@ -10,7 +10,7 @@ import com.github.retrooper.packetevents.protocol.player.UserProfile; import com.github.retrooper.packetevents.util.Vector3d; import com.github.retrooper.packetevents.wrapper.PacketWrapper; import com.github.retrooper.packetevents.wrapper.play.server.*; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import lol.pyr.znpcsplus.api.entity.PropertyHolder; import lol.pyr.znpcsplus.api.entity.EntityProperty; import lol.pyr.znpcsplus.entity.PacketEntity; @@ -36,7 +36,7 @@ public class V1_8Factory implements PacketFactory { sendPacket(player, new WrapperPlayServerSpawnPlayer(entity.getEntityId(), entity.getUuid(), location.toVector3d(), location.getYaw(), location.getPitch(), Collections.emptyList())); sendAllMetadata(player, entity, properties); - ZNPCsPlus.SCHEDULER.runLaterAsync(() -> removeTabPlayer(player, entity), 60); + ZNpcsPlus.SCHEDULER.runLaterAsync(() -> removeTabPlayer(player, entity), 60); }); } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/reflection/ReflectionLazyLoader.java b/plugin/src/main/java/lol/pyr/znpcsplus/reflection/ReflectionLazyLoader.java index ab9cc3b..1c92a4a 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/reflection/ReflectionLazyLoader.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/reflection/ReflectionLazyLoader.java @@ -1,7 +1,7 @@ package lol.pyr.znpcsplus.reflection; import lol.pyr.znpcsplus.util.VersionUtil; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import java.util.ArrayList; import java.util.List; @@ -50,9 +50,9 @@ public abstract class ReflectionLazyLoader { } private void warn(String message) { - ZNPCsPlus.LOGGER.warning("[Reflection] " + message); + ZNpcsPlus.LOGGER.warning("[Reflection] " + message); } protected abstract T load() throws Exception; protected void printDebugInfo(Consumer logger) {} -} \ No newline at end of file +} diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/skin/cache/SkinCacheCleanTask.java b/plugin/src/main/java/lol/pyr/znpcsplus/skin/cache/SkinCacheCleanTask.java index 7b935b3..99c2b25 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/skin/cache/SkinCacheCleanTask.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/skin/cache/SkinCacheCleanTask.java @@ -1,11 +1,11 @@ package lol.pyr.znpcsplus.skin.cache; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import org.bukkit.scheduler.BukkitRunnable; public class SkinCacheCleanTask extends BukkitRunnable { public SkinCacheCleanTask() { - ZNPCsPlus.SCHEDULER.runDelayedTimerAsync(this, 1200, 1200); + ZNpcsPlus.SCHEDULER.runDelayedTimerAsync(this, 1200, 1200); } @Override diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/skin/descriptor/FetchingDescriptor.java b/plugin/src/main/java/lol/pyr/znpcsplus/skin/descriptor/FetchingDescriptor.java index 6a01aa7..616c2bb 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/skin/descriptor/FetchingDescriptor.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/skin/descriptor/FetchingDescriptor.java @@ -1,6 +1,6 @@ package lol.pyr.znpcsplus.skin.descriptor; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import lol.pyr.znpcsplus.api.skin.SkinDescriptor; import lol.pyr.znpcsplus.skin.BaseSkinDescriptor; import lol.pyr.znpcsplus.skin.Skin; @@ -33,7 +33,7 @@ public class FetchingDescriptor implements BaseSkinDescriptor, SkinDescriptor { } private String papi(Player player) { - if (ZNPCsPlus.PLACEHOLDERS_SUPPORTED) return PlaceholderAPI.setPlaceholders(player, name); + if (ZNpcsPlus.PLACEHOLDERS_SUPPORTED) return PlaceholderAPI.setPlaceholders(player, name); return name; } } diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/tasks/NPCVisibilityTask.java b/plugin/src/main/java/lol/pyr/znpcsplus/tasks/NpcVisibilityTask.java similarity index 65% rename from plugin/src/main/java/lol/pyr/znpcsplus/tasks/NPCVisibilityTask.java rename to plugin/src/main/java/lol/pyr/znpcsplus/tasks/NpcVisibilityTask.java index aaadcc1..19f9037 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/tasks/NPCVisibilityTask.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/tasks/NpcVisibilityTask.java @@ -1,25 +1,25 @@ package lol.pyr.znpcsplus.tasks; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import lol.pyr.znpcsplus.config.Configs; -import lol.pyr.znpcsplus.npc.NPCEntryImpl; -import lol.pyr.znpcsplus.npc.NPCImpl; -import lol.pyr.znpcsplus.npc.NPCRegistryImpl; +import lol.pyr.znpcsplus.npc.NpcEntryImpl; +import lol.pyr.znpcsplus.npc.NpcImpl; +import lol.pyr.znpcsplus.npc.NpcRegistryImpl; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.NumberConversions; -public class NPCVisibilityTask extends BukkitRunnable { - public NPCVisibilityTask() { - ZNPCsPlus.SCHEDULER.runDelayedTimerAsync(this, 60L, 10L); +public class NpcVisibilityTask extends BukkitRunnable { + public NpcVisibilityTask() { + ZNpcsPlus.SCHEDULER.runDelayedTimerAsync(this, 60L, 10L); } public void run() { double distSq = NumberConversions.square(Configs.config().viewDistance()); - for (NPCEntryImpl entry : NPCRegistryImpl.get().all()) { + for (NpcEntryImpl entry : NpcRegistryImpl.get().all()) { if (!entry.isProcessed()) continue; - NPCImpl npc = entry.getNpc(); + NpcImpl npc = entry.getNpc(); for (Player player : Bukkit.getOnlinePlayers()) { boolean inRange = (player.getWorld() == npc.getWorld() && player.getLocation().distanceSquared(npc.getLocation().toBukkitLocation(npc.getWorld())) <= distSq); if (!inRange && npc.isShown(player)) npc.hide(player); diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/updater/UpdateChecker.java b/plugin/src/main/java/lol/pyr/znpcsplus/updater/UpdateChecker.java index 5caf7d7..eec4e2e 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/updater/UpdateChecker.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/updater/UpdateChecker.java @@ -1,6 +1,6 @@ package lol.pyr.znpcsplus.updater; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import me.robertlit.spigotresources.api.Resource; import me.robertlit.spigotresources.api.SpigotResourcesAPI; import org.bukkit.scheduler.BukkitRunnable; @@ -12,13 +12,13 @@ public class UpdateChecker extends BukkitRunnable { public final static int RESOURCE_ID = 109380; public final static String DOWNLOAD_LINK = "https://www.spigotmc.org/resources/znpcsplus.109380/"; - private final ZNPCsPlus plugin; + private final ZNpcsPlus plugin; private Status status = Status.UNKNOWN; private String newestVersion = "N/A"; - public UpdateChecker(ZNPCsPlus plugin) { + public UpdateChecker(ZNpcsPlus plugin) { this.plugin = plugin; - ZNPCsPlus.SCHEDULER.runDelayedTimerAsync(this, 5L, 6000L); + ZNpcsPlus.SCHEDULER.runDelayedTimerAsync(this, 5L, 6000L); } public void run() { @@ -34,8 +34,8 @@ public class UpdateChecker extends BukkitRunnable { } private void notifyConsole() { - ZNPCsPlus.LOGGER.warning("Version " + getLatestVersion() + " of " + plugin.getDescription().getName() + " is available now!"); - ZNPCsPlus.LOGGER.warning("Download it at " + UpdateChecker.DOWNLOAD_LINK); + ZNpcsPlus.LOGGER.warning("Version " + getLatestVersion() + " of " + plugin.getDescription().getName() + " is available now!"); + ZNpcsPlus.LOGGER.warning("Download it at " + UpdateChecker.DOWNLOAD_LINK); } private int versionToNumber(String version) { diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/updater/UpdateNotificationListener.java b/plugin/src/main/java/lol/pyr/znpcsplus/updater/UpdateNotificationListener.java index c7110f6..1f77a3d 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/updater/UpdateNotificationListener.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/updater/UpdateNotificationListener.java @@ -1,6 +1,6 @@ package lol.pyr.znpcsplus.updater; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.format.NamedTextColor; @@ -10,10 +10,10 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; public class UpdateNotificationListener implements Listener { - private final ZNPCsPlus plugin; + private final ZNpcsPlus plugin; private final UpdateChecker updateChecker; - public UpdateNotificationListener(ZNPCsPlus plugin, UpdateChecker updateChecker) { + public UpdateNotificationListener(ZNpcsPlus plugin, UpdateChecker updateChecker) { this.plugin = plugin; this.updateChecker = updateChecker; plugin.getServer().getPluginManager().registerEvents(this, plugin); @@ -25,7 +25,7 @@ public class UpdateNotificationListener implements Listener { if (updateChecker.getStatus() != UpdateChecker.Status.UPDATE_NEEDED) return; Bukkit.getScheduler().runTaskLater(plugin, () -> { if (!event.getPlayer().isOnline()) return; - ZNPCsPlus.ADVENTURE.player(event.getPlayer()) + ZNpcsPlus.ADVENTURE.player(event.getPlayer()) .sendMessage(Component.text(plugin.getDescription().getName() + " v" + updateChecker.getLatestVersion() + " is available now!", NamedTextColor.GOLD).appendNewline() .append(Component.text("Click this message to open the Spigot page (CLICK)", NamedTextColor.YELLOW)).clickEvent(ClickEvent.openUrl(UpdateChecker.DOWNLOAD_LINK))); }, 100L); diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/user/User.java b/plugin/src/main/java/lol/pyr/znpcsplus/user/User.java index 7fc90a6..4c24de1 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/user/User.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/user/User.java @@ -1,6 +1,6 @@ package lol.pyr.znpcsplus.user; -import lol.pyr.znpcsplus.interaction.NPCAction; +import lol.pyr.znpcsplus.interaction.NpcAction; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -28,7 +28,7 @@ public class User { } private final UUID uuid; - private long lastNPCInteraction; + private long lastNpcInteraction; private final Map actionCooldownMap = new HashMap<>(); public User(UUID uuid) { @@ -40,8 +40,8 @@ public class User { } public boolean canInteract() { - if (System.currentTimeMillis() - lastNPCInteraction > 100L) { - lastNPCInteraction = System.currentTimeMillis(); + if (System.currentTimeMillis() - lastNpcInteraction > 100L) { + lastNpcInteraction = System.currentTimeMillis(); return true; } return false; @@ -51,7 +51,7 @@ public class User { return uuid; } - public boolean actionCooldownCheck(NPCAction action) { + public boolean actionCooldownCheck(NpcAction action) { UUID id = action.getUuid(); if (System.currentTimeMillis() - actionCooldownMap.getOrDefault(id, 0L) >= action.getCooldown()) { actionCooldownMap.put(id, System.currentTimeMillis()); diff --git a/plugin/src/main/java/lol/pyr/znpcsplus/user/UserListener.java b/plugin/src/main/java/lol/pyr/znpcsplus/user/UserListener.java index 42b4d09..1f633f2 100644 --- a/plugin/src/main/java/lol/pyr/znpcsplus/user/UserListener.java +++ b/plugin/src/main/java/lol/pyr/znpcsplus/user/UserListener.java @@ -1,6 +1,6 @@ package lol.pyr.znpcsplus.user; -import lol.pyr.znpcsplus.ZNPCsPlus; +import lol.pyr.znpcsplus.ZNpcsPlus; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -8,7 +8,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; public class UserListener implements Listener { - public UserListener(ZNPCsPlus plugin) { + public UserListener(ZNpcsPlus plugin) { Bukkit.getPluginManager().registerEvents(this, plugin); } diff --git a/plugin/src/main/resources/plugin.yml b/plugin/src/main/resources/plugin.yml index ac46bf9..829910f 100644 --- a/plugin/src/main/resources/plugin.yml +++ b/plugin/src/main/resources/plugin.yml @@ -2,7 +2,7 @@ name: ZNPCsPlus authors: - Pyr (Pyr#6969) -main: lol.pyr.znpcsplus.ZNPCsPlus +main: lol.pyr.znpcsplus.ZNpcsPlus load: POSTWORLD version: ${version}