From f115d9e330126320a29e3cd72f5ad077de0cd566 Mon Sep 17 00:00:00 2001 From: Mateus Date: Sat, 23 Feb 2019 01:12:08 +0000 Subject: [PATCH] Version 2.2 final Sound command moved, cooldowns bug fixed. --- pom.xml | 6 +- .../mattmoreira/citizenscmd/CitizensCMD.java | 2 +- .../citizenscmd/commands/CMDAdd.java | 17 +++-- .../citizenscmd/commands/CMDHelp.java | 3 +- .../citizenscmd/commands/CMDSound.java | 69 ------------------- .../commands/base/CommandHandler.java | 2 + .../citizenscmd/listeners/NPCListener.java | 26 ++++--- .../mattmoreira/citizenscmd/utility/Util.java | 3 + 8 files changed, 38 insertions(+), 90 deletions(-) delete mode 100644 src/main/java/me/mattmoreira/citizenscmd/commands/CMDSound.java diff --git a/pom.xml b/pom.xml index 402e9c1..33d8504 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.mattmoreira.plugins citizens-cmd - 2.1 + 2.2 jar CitizensCMD @@ -86,7 +86,7 @@ org.spigotmc spigot-api - 1.13-R0.1-SNAPSHOT + 1.13.2-R0.1-SNAPSHOT provided @@ -103,7 +103,7 @@ me.clip placeholderapi - 2.9.1 + 2.9.2 provided diff --git a/src/main/java/me/mattmoreira/citizenscmd/CitizensCMD.java b/src/main/java/me/mattmoreira/citizenscmd/CitizensCMD.java index 0ea7669..7e24a58 100644 --- a/src/main/java/me/mattmoreira/citizenscmd/CitizensCMD.java +++ b/src/main/java/me/mattmoreira/citizenscmd/CitizensCMD.java @@ -229,7 +229,7 @@ public final class CitizensCMD extends JavaPlugin { */ private void registerCommands() { getCommand("npcmd").setExecutor(commandHandler); - Stream.of(new CMDHelp(this), new CMDAdd(this), new CMDCooldown(this), new CMDList(this), new CMDReload(this), new CMDRemove(this), new CMDEdit(this), new CMDPrice(this), new CMDSound()).forEach(commandHandler::register); + Stream.of(new CMDHelp(this), new CMDAdd(this), new CMDCooldown(this), new CMDList(this), new CMDReload(this), new CMDRemove(this), new CMDEdit(this), new CMDPrice(this)).forEach(commandHandler::register); } /** diff --git a/src/main/java/me/mattmoreira/citizenscmd/commands/CMDAdd.java b/src/main/java/me/mattmoreira/citizenscmd/commands/CMDAdd.java index 6f57f80..024d051 100644 --- a/src/main/java/me/mattmoreira/citizenscmd/commands/CMDAdd.java +++ b/src/main/java/me/mattmoreira/citizenscmd/commands/CMDAdd.java @@ -56,7 +56,6 @@ public class CMDAdd extends CommandBase { commandsArray[0] = commandsArray[0].replace("/", ""); for (int i = 0; i < commandsArray.length; i++) { - if (commandsArray[i].equalsIgnoreCase("-d")) { displayName = true; commandsArray[i] = ""; @@ -72,14 +71,22 @@ public class CMDAdd extends CommandBase { String finalString; - if (displayName) + if (displayName) { finalString = "{display} " + stringBuilder.toString().trim(); - else + } else finalString = stringBuilder.toString().trim(); - boolean finalLeft = left; + if (permission.equalsIgnoreCase("sound")) { + if (commandsArray.length < 2) { + finalString += " 1 1"; + } else { + if (commandsArray.length < 3) { + finalString += " 1"; + } + } + } - plugin.getDataHandler().addCommand(getSelectedNpcId(player), permission, finalString, player, finalLeft); + plugin.getDataHandler().addCommand(getSelectedNpcId(player), permission, finalString, player, left); } } diff --git a/src/main/java/me/mattmoreira/citizenscmd/commands/CMDHelp.java b/src/main/java/me/mattmoreira/citizenscmd/commands/CMDHelp.java index a5222a2..f6351a8 100644 --- a/src/main/java/me/mattmoreira/citizenscmd/commands/CMDHelp.java +++ b/src/main/java/me/mattmoreira/citizenscmd/commands/CMDHelp.java @@ -44,12 +44,11 @@ public class CMDHelp extends CommandBase { JSONMessage.create(color(HEADER)).send(player); JSONMessage.create(color(plugin.getLang().getUncoloredMessage(Path.HELP_VERSION) + " &c&o" + plugin.getDescription().getVersion())).send(player); JSONMessage.create(color(plugin.getLang().getUncoloredMessage(Path.HELP_INFO))).send(player); - JSONMessage.create(color("&3/npcmd &cadd &b &6 &d[-l]")).suggestCommand("/npcmd add ").tooltip(color(plugin.getLang().getUncoloredMessage(Path.HELP_DESCRIPTION_ADD) + "\n" + plugin.getLang().getUncoloredMessage(Path.HELP_EXAMPLE) + "\n&3&o/npcmd &c&oadd &b&ossentials.heal &6&oheal")).send(player); + JSONMessage.create(color("&3/npcmd &cadd &b &6 &d[-l]")).suggestCommand("/npcmd add ").tooltip(color(plugin.getLang().getUncoloredMessage(Path.HELP_DESCRIPTION_ADD) + "\n" + plugin.getLang().getUncoloredMessage(Path.HELP_EXAMPLE) + "\n&3&o/npcmd &c&oadd &b&ossentials.heal &6&oheal")).send(player); JSONMessage.create(color("&3/npcmd &ccooldown &6