Adds a response message when a setting has been changed, and adds some coloring
This commit is contained in:
parent
64617accf8
commit
1dea0f6c6a
@ -12,7 +12,7 @@ public class BlackSmithCommand implements CommandExecutor {
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label,
|
||||
@NotNull String[] args) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.knarcraft.blacksmith.config.NPCSetting;
|
||||
import net.knarcraft.blacksmith.trait.BlacksmithTrait;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
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) {
|
||||
NPC npc = CitizensAPI.getDefaultNPCSelector().getSelected(sender);
|
||||
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;
|
||||
}
|
||||
BlacksmithTrait blacksmithTrait = npc.getTrait(BlacksmithTrait.class);
|
||||
@ -24,10 +25,11 @@ public class NPCSettingCommand implements CommandExecutor {
|
||||
String commandName = npcSetting.getCommandName();
|
||||
if (commandName.equalsIgnoreCase(args[0])) {
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage("Current value of " + commandName + ": " +
|
||||
sender.sendMessage(ChatColor.GREEN + "Current value of " + commandName + ": " +
|
||||
blacksmithTrait.getSettings().getRawValue(npcSetting));
|
||||
} else {
|
||||
blacksmithTrait.getSettings().changeSetting(npcSetting, args[1]);
|
||||
sender.sendMessage(ChatColor.GREEN + npcSetting.name() + " set to " + args[1]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user