9
0
mirror of https://github.com/Auxilor/EcoArmor.git synced 2025-12-28 03:19:25 +00:00

JSON refactoring

This commit is contained in:
Auxilor
2021-07-04 13:27:02 +02:00
parent 994da87e3f
commit 6d669178a9
2 changed files with 189 additions and 173 deletions

View File

@@ -57,7 +57,7 @@ public class Tier extends PluginDependent {
* If the crafting recipe is enabled.
*/
@Getter
private boolean enabled;
private boolean craftable;
/**
* The ItemStack of the crystal.
@@ -96,7 +96,7 @@ public class Tier extends PluginDependent {
* Update the tracker's crafting recipe.
*/
public void update() {
this.enabled = this.getConfig().getBool("crystalCraftable");
this.craftable = this.getConfig().getBool("crystal.craftable");
this.displayName = this.getConfig().getString("display");
this.requiredTiersForApplication = this.getConfig().getStrings("requiresTiers");
NamespacedKey key = this.getPlugin().getNamespacedKeyFactory().create("upgrade_crystal");
@@ -107,10 +107,10 @@ public class Tier extends PluginDependent {
PersistentDataContainer container = outMeta.getPersistentDataContainer();
container.set(key, PersistentDataType.STRING, name);
outMeta.setDisplayName(this.getConfig().getString("crystalName"));
outMeta.setDisplayName(this.getConfig().getString("crystal.name"));
List<String> lore = new ArrayList<>();
for (String loreLine : this.getConfig().getStrings("crystalLore")) {
for (String loreLine : this.getConfig().getStrings("crystal.lore")) {
lore.add(Display.PREFIX + StringUtils.translate(loreLine));
}
outMeta.setLore(lore);
@@ -131,13 +131,13 @@ public class Tier extends PluginDependent {
));
}
if (this.isEnabled()) {
if (this.isCraftable()) {
ItemStack recipeOut = out.clone();
recipeOut.setAmount(this.getConfig().getInt("recipeGiveAmount"));
recipeOut.setAmount(this.getConfig().getInt("crystal.giveAmount"));
ShapedCraftingRecipe.Builder builder = ShapedCraftingRecipe.builder(this.getPlugin(), "upgrade_crystal_" + name)
.setOutput(recipeOut);
List<String> recipeStrings = this.getConfig().getStrings("crystalRecipe");
List<String> recipeStrings = this.getConfig().getStrings("crystal.recipe");
new CustomItem(this.getPlugin().getNamespacedKeyFactory().create("upgrade_crystal_" + name), test -> {
if (test == null) {

View File

@@ -4,25 +4,27 @@
"name": "default",
"display": "&8&lDEFAULT",
"requiresTiers": [],
"crystalCraftable": false,
"crystalName": "&8Default Upgrade Crystal",
"crystalRecipe": [
"air",
"leather",
"air",
"leather",
"leather_chestplate",
"leather",
"air",
"leather",
"air"
],
"recipeGiveAmount": 1,
"crystalLore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&8&lDEFAULT"
],
"crystal": {
"craftable": false,
"name": "&8Default Upgrade Crystal",
"recipe": [
"air",
"leather",
"air",
"leather",
"leather_chestplate",
"leather",
"air",
"leather",
"air"
],
"giveAmount": 1,
"lore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&8&lDEFAULT"
]
},
"properties": {
"helmet": {
"armor": 1,
@@ -77,27 +79,29 @@
"requiresTiers": [
"default"
],
"crystalCraftable": true,
"crystalName": "&7Iron Upgrade Crystal",
"crystalRecipe": [
"air",
"iron_block",
"air",
"iron_block",
"leather_chestplate",
"iron_block",
"air",
"iron_block",
"air"
],
"recipeGiveAmount": 1,
"crystalLore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&7&lIRON",
"",
"&8&oRequires the armor to already have default tier"
],
"crystal": {
"craftable": true,
"name": "&7Iron Upgrade Crystal",
"recipe": [
"air",
"iron_block",
"air",
"iron_block",
"leather_chestplate",
"iron_block",
"air",
"iron_block",
"air"
],
"giveAmount": 1,
"lore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&7&lIRON",
"",
"&8&oRequires the armor to already have default tier"
]
},
"properties": {
"helmet": {
"armor": 2,
@@ -152,27 +156,29 @@
"requiresTiers": [
"iron"
],
"crystalCraftable": true,
"crystalName": "&bDiamond Upgrade Crystal",
"crystalRecipe": [
"air",
"diamond_block",
"air",
"diamond_block",
"ecoarmor:upgrade_crystal_iron",
"diamond_block",
"air",
"diamond_block",
"air"
],
"recipeGiveAmount": 1,
"crystalLore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&b&lDIAMOND",
"",
"&8&oRequires the armor to already have Iron tier"
],
"crystal": {
"craftable": true,
"name": "&bDiamond Upgrade Crystal",
"recipe": [
"air",
"diamond_block",
"air",
"diamond_block",
"ecoarmor:upgrade_crystal_iron",
"diamond_block",
"air",
"diamond_block",
"air"
],
"giveAmount": 1,
"lore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&b&lDIAMOND",
"",
"&8&oRequires the armor to already have Iron tier"
]
},
"properties": {
"helmet": {
"armor": 3,
@@ -227,27 +233,29 @@
"requiresTiers": [
"diamond"
],
"crystalCraftable": true,
"crystalName": "&cNetherite Upgrade Crystal",
"crystalRecipe": [
"air",
"netherite_ingot",
"air",
"netherite_ingot",
"ecoarmor:upgrade_crystal_diamond",
"netherite_ingot",
"air",
"netherite_ingot",
"air"
],
"recipeGiveAmount": 1,
"crystalLore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&c&lNETHERITE",
"",
"&8&oRequires the armor to already have Diamond tier"
],
"crystal": {
"craftable": true,
"name": "&cNetherite Upgrade Crystal",
"recipe": [
"air",
"netherite_ingot",
"air",
"netherite_ingot",
"ecoarmor:upgrade_crystal_diamond",
"netherite_ingot",
"air",
"netherite_ingot",
"air"
],
"giveAmount": 1,
"lore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&c&lNETHERITE",
"",
"&8&oRequires the armor to already have Diamond tier"
]
},
"properties": {
"helmet": {
"armor": 3,
@@ -303,27 +311,29 @@
"requiresTiers": [
"netherite"
],
"crystalCraftable": true,
"crystalName": "<GRADIENT:f953c6>Manyullyn Upgrade Crystal</GRADIENT:b91d73>",
"crystalRecipe": [
"ecoarmor:upgrade_crystal_netherite",
"enchanted_golden_apple",
"ecoarmor:upgrade_crystal_netherite",
"enchanted_golden_apple",
"ecoarmor:upgrade_crystal_netherite",
"enchanted_golden_apple",
"ecoarmor:upgrade_crystal_netherite",
"enchanted_golden_apple",
"ecoarmor:upgrade_crystal_netherite"
],
"recipeGiveAmount": 1,
"crystalLore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&d&k!!&r <GRADIENT:f953c6>&lMANYULLYN</GRADIENT:b91d73>&r &d&k!!&r",
"",
"&8&oRequires the armor to already have Netherite tier"
],
"crystal": {
"craftable": true,
"name": "<GRADIENT:f953c6>Manyullyn Upgrade Crystal</GRADIENT:b91d73>",
"recipe": [
"ecoarmor:upgrade_crystal_netherite",
"enchanted_golden_apple",
"ecoarmor:upgrade_crystal_netherite",
"enchanted_golden_apple",
"ecoarmor:upgrade_crystal_netherite",
"enchanted_golden_apple",
"ecoarmor:upgrade_crystal_netherite",
"enchanted_golden_apple",
"ecoarmor:upgrade_crystal_netherite"
],
"giveAmount": 1,
"lore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&d&k!!&r <GRADIENT:f953c6>&lMANYULLYN</GRADIENT:b91d73>&r &d&k!!&r",
"",
"&8&oRequires the armor to already have Netherite tier"
]
},
"properties": {
"helmet": {
"armor": 3,
@@ -378,27 +388,29 @@
"requiresTiers": [
"iron"
],
"crystalCraftable": true,
"crystalName": "&#0047abCobalt Upgrade Crystal",
"crystalRecipe": [
"air",
"obsidian",
"air",
"obsidian",
"ecoarmor:upgrade_crystal_iron",
"obsidian",
"air",
"obsidian",
"air"
],
"recipeGiveAmount": 1,
"crystalLore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&#0047ab&lCOBALT",
"",
"&8&oRequires the armor to already have Iron tier"
],
"crystal": {
"craftable": true,
"name": "&#0047abCobalt Upgrade Crystal",
"recipe": [
"air",
"obsidian",
"air",
"obsidian",
"ecoarmor:upgrade_crystal_iron",
"obsidian",
"air",
"obsidian",
"air"
],
"giveAmount": 1,
"lore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&#0047ab&lCOBALT",
"",
"&8&oRequires the armor to already have Iron tier"
]
},
"properties": {
"helmet": {
"armor": 3,
@@ -453,27 +465,29 @@
"requiresTiers": [
"cobalt"
],
"crystalCraftable": true,
"crystalName": "<GRADIENT:c7f1ff>Osmium upgrade crystal</GRADIENT:5c92ff>",
"crystalRecipe": [
"air",
"netherite_block",
"air",
"netherite_block",
"ecoarmor:upgrade_crystal_cobalt",
"netherite_block",
"air",
"netherite_block",
"air"
],
"recipeGiveAmount": 1,
"crystalLore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&b&k!!&r <GRADIENT:c7f1ff>&lOSMIUM</GRADIENT:5c92ff>&r &b&k!!",
"",
"&8&oRequires the armor to already have Cobalt tier"
],
"crystal": {
"craftable": true,
"name": "<GRADIENT:c7f1ff>Osmium upgrade crystal</GRADIENT:5c92ff>",
"recipe": [
"air",
"netherite_block",
"air",
"netherite_block",
"ecoarmor:upgrade_crystal_cobalt",
"netherite_block",
"air",
"netherite_block",
"air"
],
"giveAmount": 1,
"lore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&b&k!!&r <GRADIENT:c7f1ff>&lOSMIUM</GRADIENT:5c92ff>&r &b&k!!",
"",
"&8&oRequires the armor to already have Cobalt tier"
]
},
"properties": {
"helmet": {
"armor": 3,
@@ -528,27 +542,29 @@
"requiresTiers": [
"netherite"
],
"crystalCraftable": true,
"crystalName": "<GRADIENT:f79d00>Exotic Upgrade Crystal</GRADIENT:64f38c>",
"crystalRecipe": [
"ecoarmor:upgrade_crystal_netherite",
"turtle_egg",
"ecoarmor:upgrade_crystal_netherite",
"turtle_egg",
"ecoarmor:upgrade_crystal_cobalt",
"turtle_egg",
"ecoarmor:upgrade_crystal_netherite",
"turtle_egg",
"ecoarmor:upgrade_crystal_netherite"
],
"recipeGiveAmount": 1,
"crystalLore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&6&k!!&r <GRADIENT:f79d00>&lEXOTIC</GRADIENT:64f38c>&r &6&k!!&r",
"",
"&8&oRequires the armor to already have Netherite tier"
],
"crystal": {
"craftable": true,
"name": "<GRADIENT:f79d00>Exotic Upgrade Crystal</GRADIENT:64f38c>",
"recipe": [
"ecoarmor:upgrade_crystal_netherite",
"turtle_egg",
"ecoarmor:upgrade_crystal_netherite",
"turtle_egg",
"ecoarmor:upgrade_crystal_cobalt",
"turtle_egg",
"ecoarmor:upgrade_crystal_netherite",
"turtle_egg",
"ecoarmor:upgrade_crystal_netherite"
],
"giveAmount": 1,
"lore": [
"&8Drop this onto an armor piece",
"&8to set its tier to:",
"&6&k!!&r <GRADIENT:f79d00>&lEXOTIC</GRADIENT:64f38c>&r &6&k!!&r",
"",
"&8&oRequires the armor to already have Netherite tier"
]
},
"properties": {
"helmet": {
"armor": 3,