From fbe04e97ed8710e734395cbbcb55376a68931bc8 Mon Sep 17 00:00:00 2001 From: R00tB33rMan <36140389+R00tB33rMan@users.noreply.github.com> Date: Thu, 20 Apr 2023 14:34:31 +0000 Subject: [PATCH] Various grammar fixes and enhanced readability --- .../znpcservers/commands/Command.java | 8 +++---- .../znpcservers/commands/CommandInvoker.java | 2 +- .../znpcservers/commands/CommandSender.java | 2 +- .../commands/list/DefaultCommand.java | 22 +++++++++---------- .../list/inventory/ConversationGUI.java | 2 +- .../configuration/Configuration.java | 6 ++--- 6 files changed, 21 insertions(+), 21 deletions(-) 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 c75746b..4bd1dfa 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 class Command extends BukkitCommand { 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 b7545f4..8c909e5 100644 --- a/src/main/java/io/github/znetworkw/znpcservers/commands/CommandInvoker.java +++ b/src/main/java/io/github/znetworkw/znpcservers/commands/CommandInvoker.java @@ -18,7 +18,7 @@ public class CommandInvoker { 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 2aedc70..9908d9e 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 class CommandSender { 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 867d0e7..4c0a0e2 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 class DefaultCommand extends Command { @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 class DefaultCommand extends Command { 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 class DefaultCommand extends Command { 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 class DefaultCommand extends Command { 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 class DefaultCommand extends Command { 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 class DefaultCommand extends Command { 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 class DefaultCommand extends Command { 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 class DefaultCommand extends Command { 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 049e4c4..27b4418 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 class ConversationGUI extends ZInventory { }); } 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 3e8366a..d60cedf 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 @@ public class Configuration { } 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 @@ public class Configuration { } } 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 class Configuration { 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); } }