Displays descriptions for each setting when displaying the value
This commit is contained in:
@ -10,6 +10,7 @@ import net.knarcraft.blacksmith.formatting.BlacksmithTranslatableMessage;
|
||||
import net.knarcraft.blacksmith.trait.CustomTrait;
|
||||
import net.knarcraft.blacksmith.util.InputParsingHelper;
|
||||
import net.knarcraft.blacksmith.util.TypeValidationHelper;
|
||||
import net.knarcraft.knarlib.formatting.StringFormatter;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -31,7 +32,7 @@ import static net.knarcraft.blacksmith.formatting.BlacksmithTranslatableMessage.
|
||||
*/
|
||||
public abstract class EditCommand<K extends CustomTrait<L>, L extends Setting> implements CommandExecutor {
|
||||
|
||||
protected Class<K> traitClass;
|
||||
protected final Class<K> traitClass;
|
||||
|
||||
public EditCommand(Class<K> traitClass) {
|
||||
this.traitClass = traitClass;
|
||||
@ -150,16 +151,22 @@ public abstract class EditCommand<K extends CustomTrait<L>, L extends Setting> i
|
||||
"been initialized! Please inform the developer!");
|
||||
return;
|
||||
}
|
||||
|
||||
StringFormatter formatter = BlacksmithPlugin.getStringFormatter();
|
||||
|
||||
// Display the description for how this setting is used
|
||||
formatter.displaySuccessMessage(sender, setting.getDescription());
|
||||
|
||||
String rawValue = String.valueOf(settings.getRawValue(setting));
|
||||
if (InputParsingHelper.isEmpty(rawValue)) {
|
||||
//Display the default value, if no custom value has been specified
|
||||
rawValue = String.valueOf(globalSettings.getRawValue(setting));
|
||||
BlacksmithPlugin.getStringFormatter().displaySuccessMessage(sender,
|
||||
formatter.displayNeutralMessage(sender,
|
||||
getCurrentValueMessage(setting.getCommandName(), rawValue));
|
||||
} else {
|
||||
//Add a marker if the value has been customized
|
||||
String marker = BlacksmithPlugin.translate(BlacksmithTranslatableMessage.SETTING_OVERRIDDEN_MARKER);
|
||||
BlacksmithPlugin.getStringFormatter().displaySuccessMessage(sender,
|
||||
formatter.displayNeutralMessage(sender,
|
||||
getCurrentValueMessage(setting.getCommandName(), rawValue) + marker);
|
||||
}
|
||||
if (setting.isMessage()) {
|
||||
|
Reference in New Issue
Block a user