mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
add translation for more gui
This commit is contained in:
parent
7a92b94437
commit
dd8f145e12
14 changed files with 159 additions and 67 deletions
|
|
@ -2,6 +2,7 @@ package xyz.alexcrea.cuanvil.gui.config.global;
|
|||
|
||||
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
|
||||
import com.github.stefvanschie.inventoryframework.gui.type.util.Gui;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
|
@ -12,12 +13,14 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
|||
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
||||
import xyz.alexcrea.cuanvil.gui.config.list.elements.CustomRecipeSubSettingGui;
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||
import xyz.alexcrea.cuanvil.lang.Message;
|
||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||
import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe;
|
||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||
import xyz.alexcrea.cuanvil.util.ComponentUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRecipe,
|
||||
MappedGuiListConfigGui.LazyElement<CustomRecipeSubSettingGui>> {
|
||||
|
|
@ -31,7 +34,7 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
|||
|
||||
@NotNull
|
||||
public static CustomRecipeConfigGui getInstance() {
|
||||
if (INSTANCE == null) INSTANCE = new CustomRecipeConfigGui();
|
||||
if(INSTANCE == null) INSTANCE = new CustomRecipeConfigGui();
|
||||
|
||||
return INSTANCE;
|
||||
}
|
||||
|
|
@ -51,7 +54,7 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
|||
// Get base item to display
|
||||
ItemStack craftResultItem = recipe.getResultItem();
|
||||
ItemStack displayedItem;
|
||||
if (craftResultItem == null) {
|
||||
if(craftResultItem == null) {
|
||||
displayedItem = new ItemStack(Material.BARRIER);
|
||||
} else {
|
||||
displayedItem = craftResultItem.clone();
|
||||
|
|
@ -61,25 +64,31 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
|||
ItemMeta meta = displayedItem.getItemMeta();
|
||||
assert meta != null;
|
||||
|
||||
meta.setDisplayName("<yellow>" + CasedStringUtil.snakeToUpperSpacedCase(recipe.toString()) + " <white>Custom recipe");//TODO MESSAGE
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
|
||||
meta.setLore(getRecipeLore(recipe));
|
||||
ComponentUtil.INSTANCE.setMessageName(meta, MsgUI.INSTANCE.getCUSTOM_RECIPE_NAME());
|
||||
ComponentUtil.INSTANCE.applyLore(getRecipeLore(recipe), meta);
|
||||
|
||||
displayedItem.setItemMeta(meta);
|
||||
return displayedItem;
|
||||
}
|
||||
|
||||
private static @NotNull ArrayList<String> getRecipeLore(AnvilCustomRecipe recipe) {
|
||||
private static @NotNull List<Component> getRecipeLore(AnvilCustomRecipe recipe) {
|
||||
boolean shouldWork = recipe.validate();
|
||||
|
||||
ArrayList<String> lore = new ArrayList<>();//TODO MESSAGE
|
||||
lore.add("§7Is valid: §" + (shouldWork ? "aYes" : "cNo"));
|
||||
lore.add("§7Exact count: §" + (recipe.getExactCount() ? "aYes" : "cNo"));
|
||||
lore.add("§7Recipe Level Cost: §e" + recipe.getLevelCostPerCraft());
|
||||
lore.add("§7Recipe Linear Xp Cost: §e" + recipe.getXpCostPerCraft());
|
||||
if (recipe.getXpCostPerCraft() != 0) {
|
||||
lore.add("§7Exact Linear xp remove: §" + (recipe.getRemoveExactLinearXp() ? "aYes" : "cNo"));
|
||||
var shouldWorkMsg = MsgUI.INSTANCE.booleanMessage(shouldWork);
|
||||
var exactCount = MsgUI.INSTANCE.booleanMessage(recipe.getExactCount());
|
||||
|
||||
ArrayList<Component> lore = new ArrayList<>(MsgUI.INSTANCE.getCUSTOM_RECIPE_LORE_DEFAULT()
|
||||
.formatted(
|
||||
shouldWorkMsg,
|
||||
exactCount,
|
||||
recipe.getLevelCostPerCraft(),
|
||||
recipe.getXpCostPerCraft()
|
||||
));
|
||||
|
||||
if(recipe.getXpCostPerCraft() != 0) {
|
||||
var removeExact = MsgUI.INSTANCE.booleanMessage(recipe.getRemoveExactLinearXp());
|
||||
lore.addAll(MsgUI.INSTANCE.getCUSTOM_RECIPE_LORE_LINEAR().formatted(removeExact));
|
||||
}
|
||||
return lore;
|
||||
}
|
||||
|
|
@ -90,8 +99,8 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String genericDisplayedName() {
|
||||
return "custom recipe";//TODO MESSAGE
|
||||
protected Message genericDisplayedName() {
|
||||
return MsgUI.INSTANCE.getCUSTOM_RECIPE_GENERIC_NAME();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -107,7 +116,8 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
|||
|
||||
AnvilCustomRecipe.Companion.getDEFAULT_LEFT_ITEM_CONFIG(),
|
||||
AnvilCustomRecipe.Companion.getDEFAULT_RIGHT_ITEM_CONFIG(),
|
||||
AnvilCustomRecipe.Companion.getDEFAULT_RESULT_ITEM_CONFIG());
|
||||
AnvilCustomRecipe.Companion.getDEFAULT_RESULT_ITEM_CONFIG()
|
||||
);
|
||||
|
||||
ConfigHolder.CUSTOM_RECIPE_HOLDER.getRecipeManager().cleanAddNew(recipe);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
|||
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||
import xyz.alexcrea.cuanvil.util.ComponentUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
|
@ -37,9 +39,17 @@ public class EnchantConfigGui extends ChestGui implements ValueUpdatableGui {
|
|||
private EnchantConflictGui enchantConflictGui;
|
||||
private GroupConfigGui groupConfigGui;
|
||||
|
||||
private static String selectName(@NotNull Set<CAEnchantment> enchantments) {
|
||||
if(enchantments.size() == 1) {
|
||||
return enchantments.stream().findFirst().get().getPrettyName();
|
||||
}
|
||||
|
||||
return MsgUI.INSTANCE.getENCHANT_CONFIG_MULTIPLES_NAME().unformatted();
|
||||
}
|
||||
|
||||
public EnchantConfigGui(@NotNull Set<CAEnchantment> enchantments) {
|
||||
super(3,
|
||||
"Configuring Enchantments",
|
||||
MsgUI.INSTANCE.getENCHANT_CONFIG_TITLE().textHolder(selectName(enchantments)),
|
||||
CustomAnvil.instance);
|
||||
this.enchantments = enchantments;
|
||||
|
||||
|
|
@ -57,7 +67,7 @@ public class EnchantConfigGui extends ChestGui implements ValueUpdatableGui {
|
|||
ItemMeta displayMeta = displayItemstack.getItemMeta();
|
||||
assert displayMeta != null;
|
||||
|
||||
displayMeta.setDisplayName("§aConfiguring Enchantments:");
|
||||
ComponentUtil.INSTANCE.setMessageName(displayMeta, MsgUI.INSTANCE.getENCHANT_CONFIG_NAME(), selectName(enchantments));
|
||||
displayItemstack.setItemMeta(displayMeta);
|
||||
|
||||
// Set enchantments
|
||||
|
|
|
|||
|
|
@ -14,10 +14,11 @@ import xyz.alexcrea.cuanvil.group.IncludeGroup;
|
|||
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
||||
import xyz.alexcrea.cuanvil.gui.config.list.elements.EnchantConflictSubSettingGui;
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||
import xyz.alexcrea.cuanvil.lang.Message;
|
||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||
import xyz.alexcrea.cuanvil.util.ComponentUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGroup,
|
||||
|
|
@ -53,7 +54,7 @@ public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGr
|
|||
// Create new empty conflict and display it to the admin
|
||||
EnchantConflictGroup conflict = new EnchantConflictGroup(
|
||||
name,
|
||||
new IncludeGroup("new_group"),
|
||||
new IncludeGroup(MsgUI.INSTANCE.getENCHANTMENT_CONFLICT_DEFAULT_NEW().unformatted()),
|
||||
0);
|
||||
|
||||
ConfigHolder.CONFLICT_HOLDER.getConflictManager().addConflict(conflict);
|
||||
|
|
@ -81,12 +82,14 @@ public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGr
|
|||
assert meta != null;
|
||||
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
meta.setDisplayName("§e" + CasedStringUtil.snakeToUpperSpacedCase(conflict.toString()) + " §fConflict"); //TODO MESSAGE
|
||||
meta.setLore(Arrays.asList(//TODO MESSAGE
|
||||
"§7Enchantment count: §e" + conflict.getEnchants().size(),
|
||||
"§7Group count: §e" + conflict.getCantConflictGroup().getGroups().size(),
|
||||
"§7Min enchantments count: §e" + conflict.getMinBeforeBlock()
|
||||
));
|
||||
var name = CasedStringUtil.snakeToUpperSpacedCase(conflict.toString());
|
||||
|
||||
ComponentUtil.INSTANCE.setMessageName(meta, MsgUI.INSTANCE.getENCHANTMENT_CONFLICT_NAME(), name);
|
||||
ComponentUtil.INSTANCE.applyLore(MsgUI.INSTANCE.getENCHANTMENT_CONFLICT_LORE().formatted(
|
||||
conflict.getEnchants().size(),
|
||||
conflict.getCantConflictGroup().getGroups().size(),
|
||||
conflict.getMinBeforeBlock()
|
||||
), meta);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
|
|
@ -98,8 +101,8 @@ public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGr
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String genericDisplayedName() {
|
||||
return "conflict";//TODO MESSAGE
|
||||
protected Message genericDisplayedName() {
|
||||
return MsgUI.INSTANCE.getENCHANTMENT_CONFLICT_GENERIC_NAME();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui;
|
|||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
|
|
@ -53,6 +52,7 @@ public class EnchantLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsG
|
|||
String prettyKey = CasedStringUtil.snakeToUpperSpacedCase(key.replace(":", "_"));
|
||||
|
||||
var defaultValue = enchant.defaultMaxLevel();
|
||||
var defaultValueStr = String.valueOf(enchant.defaultMaxLevel());
|
||||
|
||||
return new IntSettingsGui.IntSettingFactory(
|
||||
MsgUI.INSTANCE.getENCHANTMENT_LEVEL_LIMIT_ELEMENT_TITLE(), parent,
|
||||
|
|
@ -69,12 +69,11 @@ public class EnchantLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsG
|
|||
|
||||
@Override
|
||||
public String valueDisplayName(IntSettingsGui.ValueDisplayType type, int value) {
|
||||
|
||||
if(value < 0) {
|
||||
return switch (type) {
|
||||
case CURRENT -> "Default (" + defaultValue + ")";
|
||||
case RESET -> String.valueOf(defaultValue);
|
||||
default -> "Default";
|
||||
case CURRENT -> MsgUI.INSTANCE.getSHARED_VALUED_DEFAULT().unformatted(defaultValueStr);
|
||||
case RESET -> defaultValueStr;
|
||||
default -> MsgUI.INSTANCE.getSHARED_DEFAULT().unformatted();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ import xyz.alexcrea.cuanvil.group.IncludeGroup;
|
|||
import xyz.alexcrea.cuanvil.group.ItemGroupManager;
|
||||
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
||||
import xyz.alexcrea.cuanvil.gui.config.list.elements.GroupConfigSubSettingGui;
|
||||
import xyz.alexcrea.cuanvil.lang.Message;
|
||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||
import xyz.alexcrea.cuanvil.util.LazyValue;
|
||||
import xyz.alexcrea.cuanvil.util.ComponentUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
public class GroupConfigGui extends MappedGuiListConfigGui<IncludeGroup, MappedGuiListConfigGui.LazyElement<GroupConfigSubSettingGui>> {
|
||||
|
|
@ -56,12 +56,19 @@ public class GroupConfigGui extends MappedGuiListConfigGui<IncludeGroup, MappedG
|
|||
assert meta != null;
|
||||
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
meta.setDisplayName("§e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName())+ " §fGroup");
|
||||
meta.setLore(Arrays.asList(
|
||||
"§7Number of selected groups : " + group.getGroups().size(),
|
||||
"§7Number of included material : " + group.getNonGroupInheritedMaterials().size(),
|
||||
"",
|
||||
"§7Total number of included material "+group.getMaterials().size()));
|
||||
ComponentUtil.INSTANCE.setMessageName(
|
||||
meta,
|
||||
MsgUI.INSTANCE.getMATERIAL_GROUP_NAME(),
|
||||
CasedStringUtil.snakeToUpperSpacedCase(group.getName())
|
||||
);
|
||||
ComponentUtil.INSTANCE.applyLore(
|
||||
MsgUI.INSTANCE.getMATERIAL_GROUP_LORE().formatted(
|
||||
group.getGroups().size(),
|
||||
group.getNonGroupInheritedMaterials().size(),
|
||||
group.getMaterials().size()
|
||||
),
|
||||
meta
|
||||
);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
|
|
@ -85,8 +92,8 @@ public class GroupConfigGui extends MappedGuiListConfigGui<IncludeGroup, MappedG
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String genericDisplayedName() {
|
||||
return "material group";
|
||||
protected Message genericDisplayedName() {
|
||||
return MsgUI.INSTANCE.getMATERIAL_GROUP_GENERIC_NAME();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
|||
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||
import xyz.alexcrea.cuanvil.util.ComponentUtil;
|
||||
import xyz.alexcrea.cuanvil.util.MaterialUtil;
|
||||
import xyz.alexcrea.cuanvil.util.UnitRepairUtil;
|
||||
|
||||
|
|
@ -27,10 +29,10 @@ public class ItemConfigGui extends ChestGui {
|
|||
private CustomRecipeConfigGui customRecipeConfigGui;
|
||||
|
||||
public ItemConfigGui(@NotNull Material display, @NotNull NamespacedKey material) {
|
||||
super(3,
|
||||
super(3, MsgUI.INSTANCE.getITEM_CONFIG_TITLE().textHolder(
|
||||
CasedStringUtil.snakeToUpperSpacedCase(
|
||||
material.getKey().toLowerCase()
|
||||
) + " Config",
|
||||
)),
|
||||
CustomAnvil.instance);
|
||||
|
||||
Pattern pattern = new Pattern(
|
||||
|
|
@ -47,7 +49,7 @@ public class ItemConfigGui extends ChestGui {
|
|||
ItemMeta displayMeta = displayItemstack.getItemMeta();
|
||||
assert displayMeta != null;
|
||||
|
||||
displayMeta.setDisplayName("§aConfiguring " + material);
|
||||
ComponentUtil.INSTANCE.applyLore(MsgUI.INSTANCE.getITEM_CONFIG_TITLE().formatted(material), displayMeta);
|
||||
displayItemstack.setItemMeta(displayMeta);
|
||||
pane.bindItem('D', new GuiItem(displayItemstack, GuiGlobalActions.stayInPlace, CustomAnvil.instance));
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
|||
import xyz.alexcrea.cuanvil.gui.config.ask.SelectItemTypeGui;
|
||||
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
||||
import xyz.alexcrea.cuanvil.gui.config.list.UnitRepairElementListGui;
|
||||
import xyz.alexcrea.cuanvil.lang.Message;
|
||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||
import xyz.alexcrea.cuanvil.util.MaterialUtil;
|
||||
|
|
@ -157,14 +158,14 @@ public class UnitRepairConfigGui extends
|
|||
return element;
|
||||
}
|
||||
|
||||
@Override // Not used in this implementation.
|
||||
protected String genericDisplayedName() {
|
||||
return "this function Should not be used.";
|
||||
@Override
|
||||
protected Message genericDisplayedName() {
|
||||
throw new RuntimeException("SHOULD NOT BE USED IN THIS IMPLEMENTATION");
|
||||
}
|
||||
|
||||
@Override // Not used in this implementation.
|
||||
@Override
|
||||
protected NamespacedKey createAndSaveNewEmptyGeneric(String name) {
|
||||
return null;
|
||||
throw new RuntimeException("SHOULD NOT BE USED IN THIS IMPLEMENTATION");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||
import xyz.alexcrea.cuanvil.lang.Message;
|
||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||
|
||||
|
|
@ -108,6 +107,6 @@ public abstract class MappedElementListConfigGui<T, S> extends ElementListConfig
|
|||
|
||||
protected abstract Consumer<String> prepareCreateItemConsumer(HumanEntity player);
|
||||
|
||||
protected abstract String genericDisplayedName();
|
||||
protected abstract Message genericDisplayedName();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public abstract class MappedGuiListConfigGui<T, S extends MappedGuiListConfigGui
|
|||
|
||||
protected abstract S newInstanceOfGui(T generic, GuiItem item);
|
||||
|
||||
protected abstract String genericDisplayedName();
|
||||
protected abstract Message genericDisplayedName();
|
||||
|
||||
protected abstract T createAndSaveNewEmptyGeneric(String name);
|
||||
|
||||
|
|
|
|||
|
|
@ -83,13 +83,13 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
|||
ItemMeta selectItemMeta = selectItem.getItemMeta();
|
||||
assert selectItemMeta != null;
|
||||
|
||||
ComponentUtil.INSTANCE.setMessageName(selectItemMeta, materialSelectionName, name);
|
||||
ComponentUtil.INSTANCE.setMessageName(selectItemMeta, materialSelectionName, name, null, null);
|
||||
|
||||
selectItem.setItemMeta(selectItemMeta);
|
||||
this.materialSelection = new GuiItem(selectItem, (event) -> {
|
||||
event.setCancelled(true);
|
||||
MaterialSelectSettingGui selectGui = new MaterialSelectSettingGui(this,
|
||||
materialSelectionName, name
|
||||
materialSelectionName, name//TODO MESSAGE maybe need (%page/%max_page)
|
||||
, this);
|
||||
selectGui.show(event.getWhoClicked());
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import org.jetbrains.annotations.NotNull;
|
|||
import xyz.alexcrea.cuanvil.gui.config.SelectMaterialContainer;
|
||||
import xyz.alexcrea.cuanvil.gui.config.ask.ConfirmActionGui;
|
||||
import xyz.alexcrea.cuanvil.gui.config.list.MappedElementListConfigGui;
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||
import xyz.alexcrea.cuanvil.lang.Message;
|
||||
|
|
@ -42,7 +41,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Namespa
|
|||
@NotNull Message title,
|
||||
@NotNull String param,
|
||||
@NotNull Gui backGui) {
|
||||
super(title, param);//TODO MESSAGE make param go down
|
||||
super(title, param);
|
||||
this.selector = selector;
|
||||
this.backGui = backGui;
|
||||
this.instantRemove = false;
|
||||
|
|
@ -306,7 +305,7 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Namespa
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String genericDisplayedName() {// Not Used
|
||||
protected Message genericDisplayedName() {// Not Used
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package xyz.alexcrea.cuanvil.lang
|
|||
import io.delilaheve.CustomAnvil
|
||||
import org.bukkit.configuration.ConfigurationSection
|
||||
import xyz.alexcrea.cuanvil.config.ConfigHolder
|
||||
import java.util.stream.Stream
|
||||
|
||||
object Lang {
|
||||
|
||||
|
|
@ -17,11 +16,13 @@ object Lang {
|
|||
}
|
||||
|
||||
fun reload(): Boolean {
|
||||
val previousLang = lang
|
||||
try {
|
||||
unsafeReload()
|
||||
return true
|
||||
} catch(e: Exception) {
|
||||
CustomAnvil.logError("Error loading language $langID", e, false)
|
||||
CustomAnvil.logError("Error loading language $langID. going back to ${lang.name}", e, false)
|
||||
lang = previousLang
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,15 @@ object MsgUI {
|
|||
val SHARED_GREEN_GET_ITEM = Message("shared.green-get-item", "name")
|
||||
val SHARED_YELLOW_GET_ITEM = Message("shared.yellow-get-item", "name")
|
||||
|
||||
val SHARED_FORMATED_YES = Message("shared.formated-yes")
|
||||
val SHARED_FORMATED_NO = Message("shared.formated-no")
|
||||
val SHARED_DEFAULT = Message("shared.default")
|
||||
val SHARED_VALUED_DEFAULT = Message("shared.valued-default", "value")
|
||||
|
||||
fun booleanMessage(bool: Boolean): Message {
|
||||
return if(bool) SHARED_FORMATED_YES else SHARED_FORMATED_NO
|
||||
}
|
||||
|
||||
val GLOBAL_ITEM_ITEM_LORE_PREFIX = Message("global-item.item-lore-prefix", "value")
|
||||
val GLOBAL_ITEM_ITEM_LORE_PREFIX_ALONE = Message("global-item.item-lore-prefix-alone", "value")
|
||||
|
||||
|
|
@ -37,6 +46,11 @@ object MsgUI {
|
|||
val UNIT_REPAIR_NEW_ELEMENT_SAME_TYPE = Message("unit-repair.element.new.same-type")
|
||||
|
||||
val CUSTOM_RECIPE_TITLE = Message("custom-recipe.title", null, "page", "max_page")
|
||||
val CUSTOM_RECIPE_NAME = Message("custom-recipe.name", "name")
|
||||
val CUSTOM_RECIPE_GENERIC_NAME = Message("custom-recipe.generic-name")
|
||||
val CUSTOM_RECIPE_LORE_DEFAULT = Message("custom-recipe.lore.default",
|
||||
"should_work", "exact_count", "per_craft_lv_cost", "per_craft_xp_cost")
|
||||
val CUSTOM_RECIPE_LORE_LINEAR = Message("custom-recipe.lore.linear", "exact_linear")
|
||||
|
||||
val CUSTOM_RECIPE_ELEMENT_EXACT_COUNT_TITLE = Message("custom-recipe.element.exact-count", null)
|
||||
val CUSTOM_RECIPE_ELEMENT_LINEAR_XP_TITLE = Message("custom-recipe.element.linear-xp.title", null)
|
||||
|
|
@ -72,6 +86,10 @@ object MsgUI {
|
|||
val ENCHANTMENT_MERGE_LIMIT_ELEMENT_DESCRIPTION = Message("enchant-merge-limit.element.description", "name")
|
||||
|
||||
val ENCHANTMENT_CONFLICT_TITLE = Message("enchant-conflict.title", null, "page", "max_page")
|
||||
val ENCHANTMENT_CONFLICT_GENERIC_NAME = Message("enchant-conflict.generic-name")
|
||||
val ENCHANTMENT_CONFLICT_NAME = Message("enchant-conflict.name", "name")
|
||||
val ENCHANTMENT_CONFLICT_LORE = Message("enchant-conflict.lore", "enchantment_count", "group_count", "min_count")
|
||||
val ENCHANTMENT_CONFLICT_DEFAULT_NEW = Message("enchant-conflict.default-new")
|
||||
val ENCHANTMENT_CONFLICT_ELEMENT_ENCHANTMENTS = Message("enchant-conflict.element.selected-enchantments", "group")
|
||||
val ENCHANTMENT_CONFLICT_ELEMENT_SUB_GROUPS = Message("enchant-conflict.element.selected-sub-groups", "group")
|
||||
|
||||
|
|
@ -84,7 +102,10 @@ object MsgUI {
|
|||
val ENCHANTMENT_CONFLICT_ELEMENT_MIN_BEFORE_COUNT_ITEM = Message("enchant-conflict.element.min-before-count.item")
|
||||
|
||||
val MATERIAL_GROUP_TITLE = Message("material-group.title", null, "page", "max_page")
|
||||
val MATERIAL_GROUP_ELEMENT_SELECTED_MATERIALS = Message("material-group.element.selected-materials", "group")
|
||||
val MATERIAL_GROUP_GENERIC_NAME = Message("material-group.generic-name")
|
||||
val MATERIAL_GROUP_NAME = Message("material-group.name", "name")
|
||||
val MATERIAL_GROUP_LORE = Message("material-group.lore", "groups", "materials", "size")
|
||||
val MATERIAL_GROUP_ELEMENT_SELECTED_MATERIALS = Message("material-group.element.selected-materials", "group", null, null)
|
||||
val MATERIAL_GROUP_ELEMENT_SELECTED_SUB_GROUPS = Message("material-group.element.selected-sub-groups", "group")
|
||||
|
||||
val MATERIAL_GROUP_ELEMENT_DELETE_TITLE = Message("material-group.element.delete.title", "type")
|
||||
|
|
@ -95,6 +116,13 @@ object MsgUI {
|
|||
val MATERIAL_SELECT_CONFIRM_TITLE = Message("material-select.new.confirm.title", "name")
|
||||
val MATERIAL_SELECT_CONFIRM_DESCRIPTION = Message("material-select.new.confirm.description", "name")
|
||||
|
||||
val ENCHANT_CONFIG_TITLE = Message("enchant-config.title", "name")
|
||||
val ENCHANT_CONFIG_NAME = Message("enchant-config.name", "name")
|
||||
val ENCHANT_CONFIG_MULTIPLES_NAME = Message("enchant-config.multiples-name")
|
||||
|
||||
val ITEM_CONFIG_TITLE = Message("item-config.title", "name")
|
||||
val ITEM_CONFIG_NAME = Message("item-config.name", "name")
|
||||
|
||||
/*
|
||||
* ------------------
|
||||
* Basic Config Gui
|
||||
|
|
@ -161,6 +189,4 @@ object MsgUI {
|
|||
val BASIC_WORK_PENALTY_EXPLAIN_SHARED = Message("basic-config.work-penalty.explanation.shared")
|
||||
val BASIC_WORK_PENALTY_EXPLAIN_EXCLUSIVE = Message("basic-config.work-penalty.explanation.exclusive")
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -103,13 +103,16 @@ command.reload:
|
|||
fail: "<red>Config was not able to be reloaded..."
|
||||
hard-fail: "<red>Hard fail, plugin disabled"
|
||||
|
||||
|
||||
config-ui.shared:
|
||||
no-permission: "<red>You do not have permission to edit the config"
|
||||
typed-config-title: "<yellow>%type <white>Config"
|
||||
click-to-change: "<gray>Click Here to change the value"
|
||||
green-get-item: "<green>%name"
|
||||
yellow-get-item: "<yellow>%name"
|
||||
formated-yes: "<green>Yes"
|
||||
formated-no: "<red>No"
|
||||
default: "Default"
|
||||
valued-default: "Default (%value)"
|
||||
|
||||
config-ui.global-item:
|
||||
item-lore-prefix: "<gray>value: %value"
|
||||
|
|
@ -154,6 +157,15 @@ config-ui.unit-repair:
|
|||
|
||||
config-ui.custom-recipe:
|
||||
title: "Custom Recipe Config <reset>(%page/%max_page)"
|
||||
generic-name: "custom recipe"
|
||||
name: "<yellow>%name <white>Custom recipe"
|
||||
lore:
|
||||
default:
|
||||
1: "<gray>Is valid: %should_work"
|
||||
2: "<gray>Exact count: %exact_count"
|
||||
3: "<gray>Recipe Level Cost: <yellow>%per_craft_lv_cost"
|
||||
4: "<gray>Recipe Linear Xp Cost: <yellow>%per_craft_xp_cost"
|
||||
linear: "<gray>Exact Linear xp remove: %exact_linear"
|
||||
element:
|
||||
exact-count: "<dark_gray>Exact count ?"
|
||||
linear-xp:
|
||||
|
|
@ -218,6 +230,13 @@ config-ui.enchant-merge-limit:
|
|||
|
||||
config-ui.enchant-conflict:
|
||||
title: "Conflict Config <reset>(%page/%max_page)"
|
||||
name: "<yellow>%name <white>Conflict"
|
||||
lore:
|
||||
1: "<gray>Enchantment count: <yellow>%enchantment_count"
|
||||
2: "<gray>Group count: <yellow>%group_count"
|
||||
3: "<gray>Min enchantments count: <yellow>%min_count"
|
||||
generic-name: "conflict"
|
||||
default-new: "new_group"
|
||||
element:
|
||||
selected-enchantments: "<yellow>%group<dark_purple>" # likely need page and max page
|
||||
selected-sub-groups: "<yellow>%group <red>Groups"
|
||||
|
|
@ -236,6 +255,13 @@ config-ui.enchant-conflict:
|
|||
|
||||
config-ui.material-group:
|
||||
title: "Group Config <reset>(%page/%max_page)"
|
||||
generic-name: "material group"
|
||||
name: "<yellow>%name <white>Group"
|
||||
lore:
|
||||
1: "<gray>Number of selected groups : %groups"
|
||||
2: "<gray>Number of included material : %materials"
|
||||
3: ""
|
||||
4: "<gray>Total number of included material %size"
|
||||
element:
|
||||
selected-materials: "<yellow>%group <red>Materials"
|
||||
selected-sub-groups: "<yellow>%group <red>Groups"
|
||||
|
|
@ -252,6 +278,15 @@ config-ui.material-select:
|
|||
title: "Remove %name"
|
||||
description: "<dark_gray>Confirm Remove %name from this list."
|
||||
|
||||
config-ui.enchant-config:
|
||||
title: "Configuring %name"
|
||||
name: "<green>Configuring %name:"
|
||||
multiples-name: "Enchantments"
|
||||
|
||||
config-ui.item-config:
|
||||
title: "%name Config"
|
||||
name: "<green>Configuring %name"
|
||||
|
||||
config-ui.basic-config:
|
||||
title: "<dark_gray>Basic Config"
|
||||
|
||||
|
|
@ -376,4 +411,4 @@ config-ui.basic-config.work-penalty:
|
|||
increasing: "<yellow>Increasing<gray>: will penalty be increased (in item)"
|
||||
additive: "<yellow>Additive<gray>: will penalty be added to the cost"
|
||||
shared: "<yellow>Shared<gray>: Vanilla, shared penalty. it will be kept from before the plugin installation."
|
||||
exclusive: "<yellow>Exclusive<gray>: Custom, per anvil use type penalty. it will be lost after plugin uninstallation"
|
||||
exclusive: "<yellow>Exclusive<gray>: Custom, per anvil use type penalty. it will be lost after plugin uninstallation"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue