mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Add description text to some values.
This commit is contained in:
parent
24ebb19e11
commit
af29fd666b
9 changed files with 56 additions and 28 deletions
|
|
@ -12,7 +12,9 @@ import xyz.alexcrea.cuanvil.gui.config.settings.EnchantCostSettingsGui;
|
|||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
|
|
@ -50,7 +52,10 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSe
|
|||
|
||||
return EnchantCostSettingsGui.enchantCostFactory(prettyKey + " Level Cost", this,
|
||||
SECTION_NAME + '.' + key, ConfigHolder.DEFAULT_CONFIG,
|
||||
null,
|
||||
Arrays.asList(
|
||||
"\u00A77How many level should " + prettyKey,
|
||||
"\u00A77cost when applied by book or by another item."
|
||||
),
|
||||
0, 255,
|
||||
rarity.getItemValue(), rarity.getBookValue(),
|
||||
1, 10, 50);
|
||||
|
|
@ -67,11 +72,20 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSe
|
|||
ItemMeta itemMeta = item.getItemMeta();
|
||||
assert itemMeta != null;
|
||||
|
||||
// Prepare lore
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("\u00A77Item Cost: \u00A7e" + itemCost);
|
||||
lore.add("\u00A77Book Cost: \u00A7e" + bookCost);
|
||||
|
||||
List<String> displayLore = factory.getDisplayLore();
|
||||
if(!displayLore.isEmpty()){
|
||||
lore.add("");
|
||||
lore.addAll(displayLore);
|
||||
}
|
||||
|
||||
// Edit name and lore
|
||||
itemMeta.setDisplayName(itemName);
|
||||
itemMeta.setLore(Arrays.asList(
|
||||
"\u00A77Item Cost: \u00A7e" + itemCost,
|
||||
"\u00A77Book Cost: \u00A7e" + bookCost));
|
||||
itemMeta.setLore(lore);
|
||||
|
||||
item.setItemMeta(itemMeta);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
|||
import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui;
|
||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
|
|
@ -37,7 +38,9 @@ public class EnchantLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsG
|
|||
|
||||
return IntSettingsGui.intFactory(prettyKey + " Level Limit", this,
|
||||
SECTION_NAME + '.' + key, ConfigHolder.DEFAULT_CONFIG,
|
||||
null,
|
||||
Collections.singletonList(
|
||||
"\u00A77Maximum applied level of " + prettyKey
|
||||
),
|
||||
0, 255,
|
||||
enchant.getMaxLevel(),
|
||||
1, 5, 10, 50, 100);
|
||||
|
|
|
|||
|
|
@ -27,19 +27,19 @@ import java.util.function.Consumer;
|
|||
public class UnitRepairElementListGui extends SettingGuiListConfigGui<String, DoubleSettingGui.DoubleSettingFactory> implements ElementMappedToListGui {
|
||||
|
||||
private final GuiItem parentItem;
|
||||
private final Material material;
|
||||
private final Material parentMaterial;
|
||||
private final UnitRepairConfigGui parentGui;
|
||||
private final String materialName;
|
||||
|
||||
private boolean shouldWork = true;
|
||||
public UnitRepairElementListGui(@NotNull Material material,
|
||||
public UnitRepairElementListGui(@NotNull Material parentMaterial,
|
||||
@NotNull UnitRepairConfigGui parentGui,
|
||||
@NotNull GuiItem parentItem) {
|
||||
super("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(material.name().toLowerCase()) + " \u00A7rUnit repair");
|
||||
super("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(parentMaterial.name().toLowerCase()) + " \u00A7rUnit repair");
|
||||
this.parentItem = parentItem;
|
||||
this.material = material;
|
||||
this.parentMaterial = parentMaterial;
|
||||
this.parentGui = parentGui;
|
||||
this.materialName = CasedStringUtil.snakeToUpperSpacedCase(material.name().toLowerCase());
|
||||
this.materialName = CasedStringUtil.snakeToUpperSpacedCase(parentMaterial.name().toLowerCase());
|
||||
|
||||
GuiGlobalItems.addBackItem(this.backgroundPane, parentGui);
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ public class UnitRepairElementListGui extends SettingGuiListConfigGui<String, Do
|
|||
player.sendMessage("\u00A7cThis item can't be damaged, so it can't be repaired.");
|
||||
return;
|
||||
}
|
||||
if(type == this.material){
|
||||
if(type == this.parentMaterial){
|
||||
player.sendMessage("\u00A7cItem can't repair something of the same type.");
|
||||
return;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ public class UnitRepairElementListGui extends SettingGuiListConfigGui<String, Do
|
|||
String materialName = type.name().toLowerCase();
|
||||
|
||||
// Add new material
|
||||
ConfigHolder.UNIT_REPAIR_HOLDER.getConfig().set(material.name().toLowerCase()+"."+materialName,0.25);
|
||||
ConfigHolder.UNIT_REPAIR_HOLDER.getConfig().set(parentMaterial.name().toLowerCase()+"."+materialName,0.25);
|
||||
|
||||
MetricsUtil.INSTANCE.notifyChange(ConfigHolder.UNIT_REPAIR_HOLDER, "");
|
||||
if (GuiSharedConstant.TEMPORARY_DO_SAVE_TO_DISK_EVERY_CHANGE) {
|
||||
|
|
@ -92,7 +92,7 @@ public class UnitRepairElementListGui extends SettingGuiListConfigGui<String, Do
|
|||
|
||||
// Update gui
|
||||
updateValueForGeneric(materialName, true);
|
||||
this.parentGui.updateValueForGeneric(this.material, true);
|
||||
this.parentGui.updateValueForGeneric(this.parentMaterial, true);
|
||||
|
||||
|
||||
// Display material edit setting
|
||||
|
|
@ -111,12 +111,17 @@ public class UnitRepairElementListGui extends SettingGuiListConfigGui<String, Do
|
|||
|
||||
@Override
|
||||
protected DoubleSettingGui.DoubleSettingFactory createFactory(String materialName) {
|
||||
String materialDisplayName = CasedStringUtil.snakeToUpperSpacedCase(materialName);
|
||||
|
||||
return DoubleSettingGui.doubleFactory(
|
||||
"\u00A70%\u00A78" +CasedStringUtil.snakeToUpperSpacedCase(materialName)+" Repair",
|
||||
"\u00A70%\u00A78" + materialDisplayName +" Repair",
|
||||
this,
|
||||
material.name().toLowerCase()+"."+materialName,
|
||||
this.parentMaterial.name().toLowerCase()+"."+materialName,
|
||||
ConfigHolder.UNIT_REPAIR_HOLDER,
|
||||
null,
|
||||
Arrays.asList(
|
||||
"\u00A77Click here to change how many \u00A7e% \u00A77of \u00A7a" + materialDisplayName,
|
||||
"\u00A77Should get repaired by \u00A7e"+this.materialName
|
||||
),
|
||||
2,
|
||||
true, true,
|
||||
0,
|
||||
|
|
@ -139,7 +144,7 @@ public class UnitRepairElementListGui extends SettingGuiListConfigGui<String, Do
|
|||
return keys;
|
||||
}
|
||||
|
||||
ConfigurationSection materialSection = ConfigHolder.UNIT_REPAIR_HOLDER.getConfig().getConfigurationSection(material.name().toLowerCase());
|
||||
ConfigurationSection materialSection = ConfigHolder.UNIT_REPAIR_HOLDER.getConfig().getConfigurationSection(parentMaterial.name().toLowerCase());
|
||||
if(materialSection == null){
|
||||
return keys;
|
||||
}
|
||||
|
|
@ -156,7 +161,7 @@ public class UnitRepairElementListGui extends SettingGuiListConfigGui<String, Do
|
|||
@Override
|
||||
public void updateGuiValues() {
|
||||
super.updateGuiValues();
|
||||
this.parentGui.updateValueForGeneric(this.material, true);
|
||||
this.parentGui.updateValueForGeneric(this.parentMaterial, true);
|
||||
}
|
||||
|
||||
// ElementMappedToListGui methods
|
||||
|
|
|
|||
|
|
@ -98,7 +98,10 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
|||
this.minBeforeActiveSettingFactory = IntSettingsGui.intFactory(
|
||||
"\u00A78Minimum enchantment count",
|
||||
this, this.enchantConflict + ".maxEnchantmentBeforeConflict", ConfigHolder.CONFLICT_HOLDER,
|
||||
null,
|
||||
Arrays.asList(
|
||||
"\u00A77Minimum enchantment count set to X mean only X enchantment can be put",
|
||||
"\u00A77on an item before the conflict is active."
|
||||
),
|
||||
0, 255, 0, 1
|
||||
);
|
||||
|
||||
|
|
@ -201,15 +204,15 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
|||
ItemMeta groupMeta = groupItem.getItemMeta();
|
||||
assert groupMeta != null;
|
||||
|
||||
groupMeta.setDisplayName("\u00A7aSelect excluded \u00A73Groups \u00A7aSettings");
|
||||
groupMeta.setDisplayName("\u00A7aSelect Excluded \u00A73Groups \u00A7aSettings");
|
||||
groupMeta.setLore(groupLore);
|
||||
|
||||
groupItem.setItemMeta(groupMeta);
|
||||
|
||||
this.groupSettingItem.setItem(groupItem); // Just in case
|
||||
|
||||
|
||||
this.pane.bindItem('M', this.minBeforeActiveSettingFactory.getItem(Material.COMMAND_BLOCK));
|
||||
this.pane.bindItem('M', this.minBeforeActiveSettingFactory.getItem(Material.COMMAND_BLOCK,
|
||||
"Minimum Enchantment Count"));
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
|||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7eReset to default value");
|
||||
meta.setLore(Collections.singletonList("\u00A77Default value is " + displayValue(holder.defaultVal)));
|
||||
meta.setLore(Collections.singletonList("\u00A77Default value is \u00A7e" + displayValue(holder.defaultVal)));
|
||||
item.setItemMeta(meta);
|
||||
returnToDefault = new GuiItem(item, event -> {
|
||||
event.setCancelled(true);
|
||||
|
|
|
|||
|
|
@ -117,8 +117,8 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
|||
|
||||
meta.setDisplayName("\u00A7eReset to default value");
|
||||
meta.setLore(Arrays.asList(
|
||||
"\u00A77Default item value is: " + holder.defaultVal,
|
||||
"\u00A77Default book value is: " + holder.defaultBookVal));
|
||||
"\u00A77Default item value is: \u00A7e" + holder.defaultVal,
|
||||
"\u00A77Default book value is: \u00A7e" + holder.defaultBookVal));
|
||||
item.setItemMeta(meta);
|
||||
returnToDefault = new GuiItem(item, event -> {
|
||||
event.setCancelled(true);
|
||||
|
|
@ -330,6 +330,9 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
|||
return new EnchantCostSettingsGui(this, nowItem);
|
||||
}
|
||||
|
||||
public List<String> getDisplayLore() {
|
||||
return this.displayLore;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ public class IntSettingsGui extends AbstractSettingGui {
|
|||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7eReset to default value");
|
||||
meta.setLore(Collections.singletonList("\u00A77Default value is: " + holder.defaultVal));
|
||||
meta.setLore(Collections.singletonList("\u00A77Default value is \u00A7e" + holder.defaultVal));
|
||||
item.setItemMeta(meta);
|
||||
returnToDefault = new GuiItem(item, event -> {
|
||||
event.setCancelled(true);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class ItemSettingGui extends AbstractSettingGui {
|
|||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("\u00A7eReset to default value");
|
||||
meta.setLore(Collections.singletonList("\u00A77Default value is: " + holder.defaultVal));
|
||||
meta.setLore(Collections.singletonList("\u00A77Default value is \u00A7e" + holder.defaultVal));
|
||||
item.setItemMeta(meta);
|
||||
returnToDefault = new GuiItem(item, event -> {
|
||||
event.setCancelled(true);
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Materia
|
|||
ItemMeta meta = item.getItemMeta();
|
||||
|
||||
if(meta == null) return item;
|
||||
meta.setDisplayName("\u00A7f" + CasedStringUtil.snakeToUpperSpacedCase(material.name()));
|
||||
meta.setDisplayName("\u00A7a" + CasedStringUtil.snakeToUpperSpacedCase(material.name().toLowerCase()));
|
||||
meta.setLore(Collections.singletonList("\u00A77Click here to remove this material from the list"));
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue