Restricts raw value output to messages
This commit is contained in:
parent
7bf9e062a2
commit
9ffd788e29
@ -69,17 +69,23 @@ public class BlackSmithConfigCommand implements CommandExecutor {
|
||||
//TODO: See if there's a way to remove this duplication
|
||||
String rawValue;
|
||||
String correctCommandName;
|
||||
boolean printRawValue = false;
|
||||
if (detectedGlobalSetting != null) {
|
||||
rawValue = String.valueOf(settings.getRawValue(detectedGlobalSetting));
|
||||
correctCommandName = detectedGlobalSetting.getCommandName();
|
||||
} else if (detectedNPCSetting != null) {
|
||||
rawValue = String.valueOf(settings.getRawValue(detectedNPCSetting));
|
||||
correctCommandName = detectedNPCSetting.getCommandName();
|
||||
if (detectedNPCSetting.getPath().startsWith("defaults.messages")) {
|
||||
printRawValue = true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
displaySuccessMessage(sender, Message.getCurrentValueMessage(correctCommandName, rawValue));
|
||||
if (printRawValue) {
|
||||
sender.sendMessage("Raw value: " + rawValue.replace(ChatColor.COLOR_CHAR, '&'));
|
||||
}
|
||||
return true;
|
||||
} else if (args.length == 2 && isSpecialCase(commandName)) {
|
||||
if (displaySpecialCaseValue(args[1], sender, detectedGlobalSetting, settings)) {
|
||||
|
@ -60,7 +60,9 @@ public class BlackSmithEditCommand implements CommandExecutor {
|
||||
//Display the current value of the setting
|
||||
String rawValue = String.valueOf(blacksmithTrait.getSettings().getRawValue(npcSetting));
|
||||
displaySuccessMessage(sender, Message.getCurrentValueMessage(npcSetting.getCommandName(), rawValue));
|
||||
if (npcSetting.getPath().startsWith("defaults.messages")) {
|
||||
sender.sendMessage("Raw value: " + rawValue.replace(ChatColor.COLOR_CHAR, '&'));
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
boolean isValidType = TypeValidationHelper.isValid(npcSetting.getValueType(), newValue, sender);
|
||||
|
Loading…
Reference in New Issue
Block a user