mirror of
https://github.com/filoghost/ChestCommands.git
synced 2024-11-22 18:16:14 +01:00
Remove unneeded values from lang.yml
This commit is contained in:
parent
97fdba6e3e
commit
988d7207a3
@ -7,7 +7,6 @@ package me.filoghost.chestcommands.command;
|
||||
|
||||
import me.filoghost.chestcommands.ChestCommands;
|
||||
import me.filoghost.chestcommands.Permissions;
|
||||
import me.filoghost.chestcommands.config.Lang;
|
||||
import me.filoghost.chestcommands.menu.InternalIconMenu;
|
||||
import me.filoghost.chestcommands.menu.MenuManager;
|
||||
import me.filoghost.chestcommands.util.Utils;
|
||||
@ -120,13 +119,9 @@ public class CommandHandler extends CommandFramework {
|
||||
}
|
||||
|
||||
if (sender.getName().equalsIgnoreCase(target.getName())) {
|
||||
if (!Lang.open_menu.isEmpty()) {
|
||||
sender.sendMessage(Lang.open_menu.replace("{menu}", menuName));
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "Opening the menu " + menuName + ".");
|
||||
} else {
|
||||
if (!Lang.open_menu_others.isEmpty()) {
|
||||
sender.sendMessage(Lang.open_menu_others.replace("{menu}", menuName).replace("{player}", target.getName()));
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + "Opening the menu " + menuName + " to " + target.getName() + ".");
|
||||
}
|
||||
|
||||
menu.open(target);
|
||||
|
@ -20,8 +20,6 @@ public class Lang extends MappedConfig {
|
||||
public static String no_money = "&cYou need {money}$ for this.";
|
||||
public static String no_exp = "&cYou need {levels} XP levels for this.";
|
||||
public static String menu_not_found = "&cMenu not found! " + Errors.User.notifyStaffRequest;
|
||||
public static String open_menu = "&aOpening the menu \"{menu}\".";
|
||||
public static String open_menu_others = "&aOpening the menu \"{menu}\" to {player}.";
|
||||
public static String any = "any"; // Used in no_required_item when durability is not restrictive
|
||||
|
||||
}
|
||||
|
@ -37,9 +37,13 @@ public class Backup {
|
||||
Preconditions.checkArgument(fileToBackup.startsWith(dataFolder), "file is not inside data folder");
|
||||
Path destination = backupFolder.resolve(dataFolder.relativize(fileToBackup));
|
||||
Files.createDirectories(destination.getParent());
|
||||
|
||||
// Add backup file if no already present
|
||||
if (!Files.isRegularFile(destination)) {
|
||||
Files.copy(fileToBackup, destination);
|
||||
}
|
||||
|
||||
// Add README file if not already present
|
||||
if (!Files.isRegularFile(infoFile)) {
|
||||
Files.write(infoFile, Arrays.asList(
|
||||
"Files in this folders are copies of original configuration files that have been automatically upgraded.",
|
||||
|
@ -55,4 +55,12 @@ public abstract class YamlUpgradeTask extends UpgradeTask {
|
||||
}
|
||||
}
|
||||
|
||||
protected void replaceStringValue(Config settingsConfig, String node, String target, String replacement) {
|
||||
String value = settingsConfig.getString(node);
|
||||
if (value.contains(target)) {
|
||||
settingsConfig.setString(node, value.replace(target, replacement));
|
||||
setSaveRequired();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,17 +6,20 @@
|
||||
package me.filoghost.chestcommands.legacy.v4_0;
|
||||
|
||||
import me.filoghost.chestcommands.config.ConfigManager;
|
||||
import me.filoghost.chestcommands.legacy.upgrade.RegexUpgradeTask;
|
||||
import me.filoghost.chestcommands.legacy.upgrade.YamlUpgradeTask;
|
||||
import me.filoghost.commons.config.Config;
|
||||
|
||||
public class v4_0_LangUpgradeTask extends RegexUpgradeTask {
|
||||
public class v4_0_LangUpgradeTask extends YamlUpgradeTask {
|
||||
|
||||
public v4_0_LangUpgradeTask(ConfigManager configManager) {
|
||||
super(configManager.getRootDataFolder().resolve("lang.yml"));
|
||||
super(configManager.getConfigLoader("lang.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void computeRegexChanges() {
|
||||
replaceString("{datavalue}", "{durability}");
|
||||
public void computeYamlChanges(Config settingsConfig) {
|
||||
removeNode(settingsConfig, "open-menu");
|
||||
removeNode(settingsConfig, "open-menu-others");
|
||||
replaceStringValue(settingsConfig, "no-required-item", "{datavalue}", "{durability}");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user