Adds a response message when a setting has been changed, and adds some coloring
This commit is contained in:
		| @@ -12,7 +12,7 @@ public class BlackSmithCommand implements CommandExecutor { | |||||||
|     public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, |     public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, | ||||||
|                              @NotNull String[] args) { |                              @NotNull String[] args) { | ||||||
|         if (!sender.hasPermission("blacksmith.admin")) { |         if (!sender.hasPermission("blacksmith.admin")) { | ||||||
|             sender.sendMessage(ChatColor.RED + "You don't have the necessary permission for using this command."); |             sender.sendMessage(ChatColor.DARK_RED + "You don't have the necessary permission for using this command."); | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ import net.citizensnpcs.api.CitizensAPI; | |||||||
| import net.citizensnpcs.api.npc.NPC; | import net.citizensnpcs.api.npc.NPC; | ||||||
| import net.knarcraft.blacksmith.config.NPCSetting; | import net.knarcraft.blacksmith.config.NPCSetting; | ||||||
| import net.knarcraft.blacksmith.trait.BlacksmithTrait; | import net.knarcraft.blacksmith.trait.BlacksmithTrait; | ||||||
|  | import org.bukkit.ChatColor; | ||||||
| import org.bukkit.command.Command; | import org.bukkit.command.Command; | ||||||
| import org.bukkit.command.CommandExecutor; | import org.bukkit.command.CommandExecutor; | ||||||
| import org.bukkit.command.CommandSender; | import org.bukkit.command.CommandSender; | ||||||
| @@ -15,7 +16,7 @@ public class NPCSettingCommand implements CommandExecutor { | |||||||
|     public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { |     public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { | ||||||
|         NPC npc = CitizensAPI.getDefaultNPCSelector().getSelected(sender); |         NPC npc = CitizensAPI.getDefaultNPCSelector().getSelected(sender); | ||||||
|         if (npc == null || !npc.hasTrait(BlacksmithTrait.class)) { |         if (npc == null || !npc.hasTrait(BlacksmithTrait.class)) { | ||||||
|             sender.sendMessage("You must select an NPC before running this command"); |             sender.sendMessage(ChatColor.DARK_RED + "You must select an NPC before running this command"); | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         BlacksmithTrait blacksmithTrait = npc.getTrait(BlacksmithTrait.class); |         BlacksmithTrait blacksmithTrait = npc.getTrait(BlacksmithTrait.class); | ||||||
| @@ -24,10 +25,11 @@ public class NPCSettingCommand implements CommandExecutor { | |||||||
|             String commandName = npcSetting.getCommandName(); |             String commandName = npcSetting.getCommandName(); | ||||||
|             if (commandName.equalsIgnoreCase(args[0])) { |             if (commandName.equalsIgnoreCase(args[0])) { | ||||||
|                 if (args.length < 2) { |                 if (args.length < 2) { | ||||||
|                     sender.sendMessage("Current value of " + commandName + ": " + |                     sender.sendMessage(ChatColor.GREEN + "Current value of " + commandName + ": " + | ||||||
|                             blacksmithTrait.getSettings().getRawValue(npcSetting)); |                             blacksmithTrait.getSettings().getRawValue(npcSetting)); | ||||||
|                 } else { |                 } else { | ||||||
|                     blacksmithTrait.getSettings().changeSetting(npcSetting, args[1]); |                     blacksmithTrait.getSettings().changeSetting(npcSetting, args[1]); | ||||||
|  |                     sender.sendMessage(ChatColor.GREEN + npcSetting.name() + " set to " + args[1]); | ||||||
|                 } |                 } | ||||||
|                 return true; |                 return true; | ||||||
|             } |             } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user