Rename MenuData to MenuSettings

This commit is contained in:
filoghost 2020-06-07 12:57:12 +02:00
parent 85bdcd6408
commit 8dc0a5dcdd
3 changed files with 15 additions and 14 deletions

View File

@ -36,7 +36,7 @@ import me.filoghost.chestcommands.config.Settings;
import me.filoghost.chestcommands.config.yaml.PluginConfig;
import me.filoghost.chestcommands.internal.BoundItem;
import me.filoghost.chestcommands.internal.ExtendedIconMenu;
import me.filoghost.chestcommands.internal.MenuData;
import me.filoghost.chestcommands.internal.MenuSettings;
import me.filoghost.chestcommands.listener.CommandListener;
import me.filoghost.chestcommands.listener.InventoryListener;
import me.filoghost.chestcommands.listener.JoinListener;
@ -198,7 +198,7 @@ public class ChestCommands extends JavaPlugin {
continue;
}
MenuData data = MenuParser.loadMenuData(menuConfig, errorCollector);
MenuSettings data = MenuParser.loadMenuData(menuConfig, errorCollector);
ExtendedIconMenu iconMenu = MenuParser.loadMenu(menuConfig, data.getTitle(), data.getRows(), errorCollector);
menuManager.registerMenu(menuConfig.getFileName(), data.getCommands(), iconMenu, errorCollector);

View File

@ -20,21 +20,22 @@ import me.filoghost.chestcommands.action.Action;
import java.util.List;
public class MenuData {
public class MenuSettings {
// Required data
private String title;
private int rows;
// Required settings
private final String title;
private final int rows;
// Optional data
// Optional settings
private String[] commands;
private Material boundMaterial;
private short boundDataValue;
private ClickType clickType;
private List<Action> openActions;
private int refreshTenths;
public MenuData(String title, int rows) {
private Material boundMaterial;
private short boundDataValue;
private ClickType clickType;
public MenuSettings(String title, int rows) {
this.title = title;
this.rows = rows;
boundDataValue = -1; // -1 = any

View File

@ -28,7 +28,7 @@ import me.filoghost.chestcommands.config.yaml.PluginConfig;
import me.filoghost.chestcommands.exception.FormatException;
import me.filoghost.chestcommands.internal.ClickType;
import me.filoghost.chestcommands.internal.ExtendedIconMenu;
import me.filoghost.chestcommands.internal.MenuData;
import me.filoghost.chestcommands.internal.MenuSettings;
import me.filoghost.chestcommands.parser.IconParser.Coords;
import me.filoghost.chestcommands.util.ErrorCollector;
import me.filoghost.chestcommands.util.FormatUtils;
@ -82,7 +82,7 @@ public class MenuParser {
/**
* Reads all the settings of a menu. It will never return a null title, even if not set.
*/
public static MenuData loadMenuData(PluginConfig config, ErrorCollector errorCollector) {
public static MenuSettings loadMenuData(PluginConfig config, ErrorCollector errorCollector) {
String title = FormatUtils.addColors(config.getString(Nodes.MENU_NAME));
int rows;
@ -108,7 +108,7 @@ public class MenuParser {
errorCollector.addError("The menu \"" + config.getFileName() + "\" doesn't have a the number of rows set, it will have 6 rows by default.");
}
MenuData menuData = new MenuData(title, rows);
MenuSettings menuData = new MenuSettings(title, rows);
List<String> triggeringCommands = ConfigUtil.getStringListOrInlineList(config, ";", Nodes.MENU_COMMANDS);
if (triggeringCommands != null) {