Derived settings are also initially setup for the default values now.

This also avoids some code duplication for these default values.
master
blablubbabc 2020-11-25 02:34:22 +01:00
parent c193160c51
commit 5499cbdcc7
1 changed files with 16 additions and 8 deletions

View File

@ -473,22 +473,27 @@ public class Settings {
// Stores derived settings which get setup after loading the config.
public static class DerivedSettings {
public static ItemData namingItemData = new ItemData(Material.AIR);
public static ItemData namingItemData;
// Button items:
public static ItemData nameButtonItem = new ItemData(Material.AIR);
public static ItemData containerButtonItem = new ItemData(Material.AIR);
public static ItemData deleteButtonItem = new ItemData(Material.AIR);
public static ItemData hireButtonItem = new ItemData(Material.AIR);
public static ItemData nameButtonItem;
public static ItemData containerButtonItem;
public static ItemData deleteButtonItem;
public static ItemData hireButtonItem;
public static ItemData deleteVillagerButtonItem = new ItemData(Material.AIR);
public static ItemData villagerInventoryButtonItem = new ItemData(Material.AIR);
public static ItemData deleteVillagerButtonItem;
public static ItemData villagerInventoryButtonItem;
public static Pattern shopNamePattern = Pattern.compile("^[A-Za-z0-9 ]{3,32}$");
public static Pattern shopNamePattern;
// Sorted in descending order:
public static final List<MaxShopsPermission> maxShopsPermissions = new ArrayList<>();
static {
// Initial setup of default values:
setup();
}
// Gets called after the config has been loaded:
private static void setup() {
// Ignore display name (which is used for specifying the new shopkeeper name):
@ -530,6 +535,9 @@ public class Settings {
}
Collections.sort(maxShopsPermissions, Collections.reverseOrder()); // Descending order
}
private DerivedSettings() {
}
}
// Shop creation item: