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