diff --git a/src/main/java/io/github/znetworkw/znpcservers/commands/Command.java b/src/main/java/io/github/znetworkw/znpcservers/commands/Command.java index c75746bc..4bd1dfa6 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/commands/Command.java +++ b/src/main/java/io/github/znetworkw/znpcservers/commands/Command.java @@ -19,7 +19,7 @@ public class Command extends BukkitCommand { try { COMMAND_MAP = (CommandMap) CacheRegistry.BUKKIT_COMMAND_MAP.load().get(Bukkit.getServer()); } catch (IllegalAccessException exception) { - throw new IllegalStateException("can't access bukkit command map."); + throw new IllegalStateException("Unable to register Bukkit command map."); } } @@ -69,17 +69,17 @@ public Set getCommands() { public boolean execute(CommandSender sender, String commandLabel, String[] args) { Optional> subCommandOptional = this.subCommands.entrySet().stream().filter(command -> command.getKey().name().contentEquals((args.length > 0) ? args[0] : "")).findFirst(); if (subCommandOptional.isEmpty()) { - sender.sendMessage(ChatColor.RED + "can't find command: " + commandLabel + "."); + sender.sendMessage(ChatColor.RED + "Unable to locate the following command: " + commandLabel + "."); return false; } try { Map.Entry subCommand = subCommandOptional.get(); subCommand.getValue().execute(new io.github.znetworkw.znpcservers.commands.CommandSender(sender), loadArgs(subCommand.getKey(), Arrays.asList(args))); } catch (CommandExecuteException e) { - sender.sendMessage(ChatColor.RED + "can't execute command."); + sender.sendMessage(ChatColor.RED + "Cannot execute this command or this command execution has failed."); e.printStackTrace(); } catch (CommandPermissionException e) { - sender.sendMessage(ChatColor.RED + "no permission for run this command."); + sender.sendMessage(ChatColor.RED + "You do not have permission to execute this command."); } return true; } diff --git a/src/main/java/io/github/znetworkw/znpcservers/commands/CommandInvoker.java b/src/main/java/io/github/znetworkw/znpcservers/commands/CommandInvoker.java index 1bda263a..2f649635 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/commands/CommandInvoker.java +++ b/src/main/java/io/github/znetworkw/znpcservers/commands/CommandInvoker.java @@ -20,7 +20,7 @@ public void execute(CommandSender sender, Object command) throws CommandPermissi throw new CommandPermissionException("Only players may execute this command."); } if (this.permission.length() > 0 && !sender.getCommandSender().hasPermission(this.permission)) { - throw new CommandPermissionException("Insufficient permission."); + throw new CommandPermissionException("You cannot execute this command."); } try { this.commandMethod.invoke(this.command, sender, command); diff --git a/src/main/java/io/github/znetworkw/znpcservers/commands/CommandSender.java b/src/main/java/io/github/znetworkw/znpcservers/commands/CommandSender.java index 2aedc709..9908d9eb 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/commands/CommandSender.java +++ b/src/main/java/io/github/znetworkw/znpcservers/commands/CommandSender.java @@ -51,7 +51,7 @@ public void sendMessage(String message, Iterable hover) { public Player getPlayer() { if (this.type != SenderType.PLAYER) - throw new IllegalStateException("sender is not a player."); + throw new IllegalStateException("The following sender is not a player."); return (Player) getCommandSender(); } diff --git a/src/main/java/io/github/znetworkw/znpcservers/commands/list/DefaultCommand.java b/src/main/java/io/github/znetworkw/znpcservers/commands/list/DefaultCommand.java index 867d0e7c..4c0a0e2c 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/commands/list/DefaultCommand.java +++ b/src/main/java/io/github/znetworkw/znpcservers/commands/list/DefaultCommand.java @@ -47,15 +47,15 @@ public DefaultCommand() { @CommandInformation(arguments = {}, name = "", permission = "") public void defaultCommand(CommandSender sender, Map args) { sender.sendMessage("&6&m------------------------------------------"); - sender.sendMessage("&b&lZNPCS &8\u00BB &7ZNetwork"); - sender.sendMessage("&6https://www.spigotmc.org/resources/znpcs.80940"); + sender.sendMessage("&b&lZNPCS &8\u00BB &7ZNetwork & Pyr"); + sender.sendMessage("&6https://www.spigotmc.org/resources/znpcsplus.109380/"); Objects.requireNonNull(sender); getCommands().forEach(sender::sendMessage); - sender.sendMessage(ChatColor.DARK_GRAY + "Hover over the commands to see help for the command."); + sender.sendMessage(ChatColor.DARK_GRAY + "Hover over the commands to view command arguments."); sender.sendMessage("&6&m------------------------------------------"); } - @CommandInformation(arguments = {"id", "type", "name"}, name = "create", permission = "znpcs.cmd.create", help = {" &f&l* &e/znpcs create PLAYER Qentin"}) + @CommandInformation(arguments = {"id", "type", "name"}, name = "create", permission = "znpcs.cmd.create", help = {" &f&l* &e/znpcs create PLAYER Steve"}) public void createNPC(CommandSender sender, Map args) { if (args.size() < 3) { Configuration.MESSAGES.sendMessage(sender.getCommandSender(), ConfigurationValue.INCORRECT_USAGE); @@ -116,7 +116,7 @@ public void list(CommandSender sender, Map args) { TextComponent textComponent2 = new TextComponent("[TELEPORT]"); textComponent2.setBold(true); textComponent2.setColor(ChatColor.DARK_GREEN); - textComponent2.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Click to teleport this npc!")) + textComponent2.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Click to teleport this NPC!")) .color(ChatColor.GREEN).create())); textComponent2.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/znpcs teleport " + npcModel @@ -126,7 +126,7 @@ public void list(CommandSender sender, Map args) { TextComponent textComponent3 = new TextComponent("[DELETE]"); textComponent3.setBold(true); textComponent3.setColor(ChatColor.DARK_RED); - textComponent3.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Click to delete this npc!")) + textComponent3.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, (new ComponentBuilder("Click to delete this NPC!")) .color(ChatColor.RED).create())); textComponent3.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/znpcs delete " + npcModel @@ -158,7 +158,7 @@ public void setSkin(CommandSender sender, Map args) { DO_APPLY_SKIN.apply(sender.getPlayer(), foundNPC, args.get("skin")); } - @CommandInformation(arguments = {"id", "slot"}, name = "equip", permission = "znpcs.cmd.equip", help = {" &f&l* &e/znpcs equip [HAND,OFFHAND,HELMET,CHESTPLATE,LEGGINGS,BOOTS]", "&8(You need to have the item in your hand.)"}) + @CommandInformation(arguments = {"id", "slot"}, name = "equip", permission = "znpcs.cmd.equip", help = {" &f&l* &e/znpcs equip [HAND/OFFHAND/HELMET/CHESTPLATE/LEGGINGS/BOOTS]", "&8(You need to have the item in your hand)."}) public void equip(CommandSender sender, Map args) { if (args.size() < 2) { Configuration.MESSAGES.sendMessage(sender.getCommandSender(), ConfigurationValue.INCORRECT_USAGE); @@ -251,7 +251,7 @@ public void changeType(CommandSender sender, Map args) { Configuration.MESSAGES.sendMessage(sender.getCommandSender(), ConfigurationValue.SUCCESS); } - @CommandInformation(arguments = {"add", "remove", "cooldown", "list"}, name = "action", isMultiple = true, permission = "znpcs.cmd.action", help = {" &f&l* &e/znpcs action add SERVER skywars", " &f&l* &e/znpcs action add CMD spawn", " &f&l* &e/znpcs action remove ", " &f&l* &e/znpcs action cooldown ", " &f&l* &e/znpcs action list "}) + @CommandInformation(arguments = {"add", "remove", "cooldown", "list"}, name = "action", isMultiple = true, permission = "znpcs.cmd.action", help = {" &f&l* &e/znpcs action add SERVER survival", " &f&l* &e/znpcs action add CMD spawn", " &f&l* &e/znpcs action remove ", " &f&l* &e/znpcs action cooldown ", " &f&l* &e/znpcs action list "}) public void action(CommandSender sender, Map args) { if (args.size() < 1) { Configuration.MESSAGES.sendMessage(sender.getCommandSender(), ConfigurationValue.INCORRECT_USAGE); @@ -445,7 +445,7 @@ public void path(CommandSender sender, Map args) { return; } if (znpcUser.isHasPath()) { - sender.getPlayer().sendMessage(ChatColor.RED + "You already have a path creator active, to remove it use /znpcs path exit."); + sender.getPlayer().sendMessage(ChatColor.RED + "You already have a path creator active! To remove it, type " + ChatColor.WHITE + "/znpcs path exit" + ChatColor.RED + "."); return; } NPCPath.AbstractTypeWriter.forCreation(pathName, znpcUser, NPCPath.AbstractTypeWriter.TypeWriter.MOVEMENT); @@ -481,7 +481,7 @@ public void teleport(CommandSender sender, Map args) { sender.getPlayer().teleport(foundNPC.getLocation()); } - @CommandInformation(arguments = {"id", "height"}, name = "height", permission = "znpcs.cmd.height", help = {" &f&l* &e/znpcs height 2", "&8Add more height to the hologram of the npc"}) + @CommandInformation(arguments = {"id", "height"}, name = "height", permission = "znpcs.cmd.height", help = {" &f&l* &e/znpcs height 2", "&8Set a greater or lesser distance of a hologram from the NPC."}) public void changeHologramHeight(CommandSender sender, Map args) { if (args.size() < 2) { Configuration.MESSAGES.sendMessage(sender.getCommandSender(), ConfigurationValue.INCORRECT_USAGE); @@ -507,7 +507,7 @@ public void changeHologramHeight(CommandSender sender, Map args) Configuration.MESSAGES.sendMessage(sender.getCommandSender(), ConfigurationValue.SUCCESS); } - @CommandInformation(arguments = {"create", "remove", "gui", "set"}, name = "conversation", isMultiple = true, permission = "znpcs.cmd.conversation", help = {" &f&l* &e/znpcs conversation create first", " &f&l* &e/znpcs conversation remove first", " &f&l* &e/znpcs conversation set first [CLICK:RADIUS]", " &f&l* &e/znpcs conversation gui &8(&7Open a gui to manage the conversations&8)", "&8RADIUS: &7it is activated when the player is near the npc", "&8CLICK: &7it is activated when the player interacts with the npc"}) + @CommandInformation(arguments = {"create", "remove", "gui", "set"}, name = "conversation", isMultiple = true, permission = "znpcs.cmd.conversation", help = {" &f&l* &e/znpcs conversation create first", " &f&l* &e/znpcs conversation remove first", " &f&l* &e/znpcs conversation set first [CLICK/RADIUS]", " &f&l* &e/znpcs conversation gui &8(&7Opens a GUI to manage conversations&8)", "&8RADIUS: &7Activates when the player is near the NPC", "&8CLICK: &7Activates when the player interacts with the NPC"}) public void conversations(CommandSender sender, Map args) { if (args.size() < 1) { Configuration.MESSAGES.sendMessage(sender.getCommandSender(), ConfigurationValue.INCORRECT_USAGE); diff --git a/src/main/java/io/github/znetworkw/znpcservers/commands/list/inventory/ConversationGUI.java b/src/main/java/io/github/znetworkw/znpcservers/commands/list/inventory/ConversationGUI.java index 049e4c41..27b4418d 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/commands/list/inventory/ConversationGUI.java +++ b/src/main/java/io/github/znetworkw/znpcservers/commands/list/inventory/ConversationGUI.java @@ -119,7 +119,7 @@ public void update() { }); } this.addItem(ItemStackBuilder.forMaterial(Material.EMERALD).setName(ChatColor.AQUA + "ADD A NEW ACTION").setLore("&7click here...").build(), this.getRows() - 5, clickEvent -> { - Utils.sendTitle(this.getPlayer(), "&d&lADD ACTION", "&7Type the action..."); + Utils.sendTitle(this.getPlayer(), "&d&lADD ACTION", "&7Type the new action..."); EventService.addService(ZUser.find(this.getPlayer()), AsyncPlayerChatEvent.class).addConsumer(event -> { if (ConfigurationConstants.NPC_CONVERSATIONS.contains(this.conversation) && this.conversation.getTexts().contains(this.conversationKey)) { List stringList = SPACE_SPLITTER.splitToList(event.getMessage()); diff --git a/src/main/java/io/github/znetworkw/znpcservers/configuration/Configuration.java b/src/main/java/io/github/znetworkw/znpcservers/configuration/Configuration.java index 3e8366a7..d60cedf1 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/configuration/Configuration.java +++ b/src/main/java/io/github/znetworkw/znpcservers/configuration/Configuration.java @@ -34,7 +34,7 @@ protected Configuration(String name) { } private Configuration(String name, Path path) { - if (!path.getFileName().toString().endsWith(".json")) throw new IllegalStateException("invalid configuration format for: " + path.getFileName()); + if (!path.getFileName().toString().endsWith(".json")) throw new IllegalStateException("Invalid configuration format for: " + path.getFileName()); this.name = name; this.path = path; this.configurationValues = ConfigurationValue.VALUES_BY_NAME.get(name).stream().collect(Collectors.toMap((c) -> c, ConfigurationValue::getValue)); @@ -54,7 +54,7 @@ protected void onLoad() { } } catch (NoSuchFileException ignored) { } catch (IOException ex) { - throw new IllegalStateException("Failed to read config: " + this.name); + throw new IllegalStateException("Failed to read configuration: " + this.name); } } @@ -62,7 +62,7 @@ public void save() { try (Writer writer = Files.newBufferedWriter(this.path, CHARSET)) { ZNPCsPlus.GSON.toJson(this.configurationValues.size() == 1 ? this.configurationValues.values().iterator().next() : this.configurationValues, writer); } catch (IOException ex) { - throw new IllegalStateException("Failed to save config: " + this.name); + throw new IllegalStateException("Failed to save configuration: " + this.name); } } diff --git a/src/main/java/io/github/znetworkw/znpcservers/configuration/ConfigurationValue.java b/src/main/java/io/github/znetworkw/znpcservers/configuration/ConfigurationValue.java index b4b1510d..d19dc0e1 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/configuration/ConfigurationValue.java +++ b/src/main/java/io/github/znetworkw/znpcservers/configuration/ConfigurationValue.java @@ -22,35 +22,35 @@ public enum ConfigurationValue { LINE_SPACING("config", 0.3D, Double.class), ANIMATION_RGB("config", Boolean.FALSE, Boolean.class), NO_PERMISSION("messages", "&cYou do not have permission to execute this command.", String.class), - SUCCESS("messages", "&aDone!", String.class), - INCORRECT_USAGE("messages", "&cThe arguements you specified are not valid, do &f/znpcs help&c for assistance and examples.", String.class), + SUCCESS("messages", "&aSuccess!", String.class), + INCORRECT_USAGE("messages", "&cThe arguments you specified are invalid. Type &f/znpcs help&c for examples.", String.class), COMMAND_NOT_FOUND("messages", "&cThe command you specified does not exist!", String.class), - COMMAND_ERROR("messages", "&cThere was an error executing the command, see the console for more information.", String.class), - INVALID_NUMBER("messages", "&cHey!, The inserted number/id does not look like a number, please use integer values only!", String.class), - NPC_NOT_FOUND("messages", "&cHey!, I couldn't find a npc with this id!", String.class), - TOO_FEW_ARGUMENTS("messages", "&cThis command does not have enough arguements, do &f/znpcs help&c for assistance and examples.", String.class), - PATH_START("messages", "&aDone, now walk where you want the npc to walk towards, when finished type &f/znpcs path exit", String.class), - EXIT_PATH("messages", "&cYou have exited the waypoint creation.", String.class), + COMMAND_ERROR("messages", "&cAn error occurred when executing this command. See console for more information.", String.class), + INVALID_NUMBER("messages", "&cThe ID you have specified is invalid. Please use positive integers only!", String.class), + NPC_NOT_FOUND("messages", "&cNo NPCs could be found with this ID!", String.class), + TOO_FEW_ARGUMENTS("messages", "&cThis command does not contain enough arguments. Type &f/znpcs help&c or view our documentation for a list/examples of existing arguments.", String.class), + PATH_START("messages", "&aSuccess! Move to create a path for your NPC. When finished, type &f/znpcs path exit&c to exit path creation.", String.class), + EXIT_PATH("messages", "&cYou have exited path creation.", String.class), PATH_FOUND("messages", "&cThere is already a path with this name.", String.class), - NPC_FOUND("messages", "&cThere is already an NPC with this id.", String.class), - NO_PATH_FOUND("messages", "&cNo path found.", String.class), - NO_SKIN_FOUND("messages", "&cSkin not found.", String.class), - NO_NPC_FOUND("messages", "&cNo npc found.", String.class), - NO_ACTION_FOUND("messages", "&cThis action was not valid! Check the wiki for valid action types.", String.class), - METHOD_NOT_FOUND("messages", "&cThis method was not found! Check the wiki for valid action types.", String.class), - INVALID_NAME_LENGTH("messages", "&cThe name you specified is too short or long, it must be in the range of (3 to 16) characters.", String.class), - UNSUPPORTED_ENTITY("messages", "&cThis entity type not available for your current version.", String.class), + NPC_FOUND("messages", "&cThere is already an NPC with this ID.", String.class), + NO_PATH_FOUND("messages", "&cThe path you have specified does not exist.", String.class), + NO_SKIN_FOUND("messages", "&cThe skin username/URL you have specified does not exist or is invalid.", String.class), + NO_NPC_FOUND("messages", "&cThe NPC you have specified does not exist.", String.class), + NO_ACTION_FOUND("messages", "&cThis action does not exist! Type &f/znpcs help&c or view our documentation for a list/examples of existing action types.", String.class), + METHOD_NOT_FOUND("messages", "&cThis method does not exist! Type &f/znpcs help&c or view our documentation for a list/examples of existing methods.", String.class), + INVALID_NAME_LENGTH("messages", "&cThe name you specified either too short or long. Please enter a positive integer of (3 to 16) characters.", String.class), + UNSUPPORTED_ENTITY("messages", "&cThis entity type not available in your current server version.", String.class), PATH_SET_INCORRECT_USAGE("messages", "&eUsage: &aset ", String.class), - ACTION_ADD_INCORRECT_USAGE("messages", "&eUsage: &a ", String.class), + ACTION_ADD_INCORRECT_USAGE("messages", "&eUsage: &a ", String.class), ACTION_DELAY_INCORRECT_USAGE("messages", "&eUsage: &a ", String.class), - CONVERSATION_SET_INCORRECT_USAGE("messages", "&cUsage: ", String.class), - NO_CONVERSATION_FOUND("messages", "&cThis conversation was not found.", String.class), + CONVERSATION_SET_INCORRECT_USAGE("messages", "&cUsage: ", String.class), + NO_CONVERSATION_FOUND("messages", "&cThe conversation you have specified does not exist!", String.class), CONVERSATION_FOUND("messages", "&cThere is already a conversation with this name.", String.class), - INVALID_SIZE("messages", "&cThe position cannot exceed the limit.", String.class), - FETCHING_SKIN("messages", "&aFetching skin for name: &f%s&a, wait...", String.class), + INVALID_SIZE("messages", "&cThe position you have specified cannot exceed the limit.", String.class), + FETCHING_SKIN("messages", "&aFetching skin for name: &f%s&a. Please wait...", String.class), CANT_GET_SKIN("messages", "&cCould not fetch skin for name: %s.", String.class), - GET_SKIN("messages", "&aSkin fetched!", String.class), - CONVERSATION_LIST("conversations", new ArrayList<>(), Conversation.class); + GET_SKIN("messages", "&aSkin successfully fetched!", String.class), + CONVERSATION_LIST("Conversations", new ArrayList<>(), Conversation.class); public static final Map> VALUES_BY_NAME;