mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-08-28 08:25:56 +02:00
Compare commits
7 commits
fbd3bf2eb2
...
fda211fe5b
| Author | SHA1 | Date | |
|---|---|---|---|
| fda211fe5b | |||
| 6e61ac815f | |||
| 8a00cc1f92 | |||
| 35e0b34ecf | |||
| 743fd5d891 | |||
| de86fe16ba | |||
| 948c49a719 |
40 changed files with 182 additions and 633 deletions
|
|
@ -112,26 +112,6 @@ object PlatformUtil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
|
||||||
} /**
|
|
||||||
* Try to send paper component to the player
|
|
||||||
*
|
|
||||||
* @param component The used component
|
|
||||||
* @return true if sent, else otherwise
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Try to set component lore of an item
|
|
||||||
*
|
|
||||||
* @param components The used component lore
|
|
||||||
* @return true if sent, else otherwise
|
|
||||||
*/
|
|
||||||
fun ItemMeta.setPaperLore(components: List<Component>): Boolean {
|
|
||||||
if(isPaper) {
|
|
||||||
this.lore(components)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,13 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
|
|
||||||
public abstract class AbstractAskGui extends ChestGui {
|
public abstract class AbstractAskGui extends ChestGui {
|
||||||
|
|
||||||
protected PatternPane pane;
|
protected PatternPane pane;
|
||||||
AbstractAskGui(int rows,
|
AbstractAskGui(int rows, @NotNull String name,
|
||||||
@NotNull Message name, @NotNull String param,
|
|
||||||
Gui backOnCancel){
|
Gui backOnCancel){
|
||||||
super(rows, name.textHolder(param), CustomAnvil.instance);
|
super(rows, name, CustomAnvil.instance);
|
||||||
|
|
||||||
Pattern pattern = getGuiPattern();
|
Pattern pattern = getGuiPattern();
|
||||||
this.pane = new PatternPane(0, 0, pattern.getLength(), pattern.getHeight(), pattern);
|
this.pane = new PatternPane(0, 0, pattern.getLength(), pattern.getHeight(), pattern);
|
||||||
|
|
|
||||||
|
|
@ -9,25 +9,21 @@ import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgError;
|
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||||
import xyz.alexcrea.cuanvil.util.ComponentUtil;
|
import xyz.alexcrea.cuanvil.util.MetricsUtil;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.util.Arrays;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class ConfirmActionGui extends AbstractAskGui {
|
public class ConfirmActionGui extends AbstractAskGui {
|
||||||
|
|
||||||
public ConfirmActionGui(@NotNull Message title, @NotNull String titleParam,
|
public ConfirmActionGui(@NotNull String title, String actionDescription,
|
||||||
@Nullable Message actionDescription, @NotNull String actionParam,
|
|
||||||
Gui backOnCancel, Gui backOnConfirm, Supplier<Boolean> onConfirm,
|
Gui backOnCancel, Gui backOnConfirm, Supplier<Boolean> onConfirm,
|
||||||
boolean permanent) {
|
boolean permanent) {
|
||||||
super(3, title, titleParam, backOnCancel);
|
super(3, title, backOnCancel);
|
||||||
|
|
||||||
// Save item
|
// Save item
|
||||||
this.pane.bindItem('S', new GuiItem(
|
this.pane.bindItem('S', new GuiItem(
|
||||||
|
|
@ -46,7 +42,8 @@ public class ConfirmActionGui extends AbstractAskGui {
|
||||||
try {
|
try {
|
||||||
success = onConfirm.get();
|
success = onConfirm.get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
CustomAnvil.Companion.logError(MsgError.INSTANCE.getCONFIRM_ACTION_GENERIC().unformatted(), e, true, Level.WARNING);
|
CustomAnvil.instance.getLogger().log(Level.WARNING, "Could not process confirmation supplier.", e);
|
||||||
|
MetricsUtil.INSTANCE.trackError(e);
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,21 +57,19 @@ public class ConfirmActionGui extends AbstractAskGui {
|
||||||
// Info item
|
// Info item
|
||||||
ItemStack infoItem = new ItemStack(Material.PAPER);
|
ItemStack infoItem = new ItemStack(Material.PAPER);
|
||||||
ItemMeta infoMeta = infoItem.getItemMeta();
|
ItemMeta infoMeta = infoItem.getItemMeta();
|
||||||
assert infoMeta != null;
|
|
||||||
|
|
||||||
ComponentUtil.INSTANCE.setMessageName(infoMeta, MsgUI.INSTANCE.getCONFIRM_ACTION_ARE_YOU_SURE());
|
infoMeta.setDisplayName("§eAre you sure ?");
|
||||||
if(actionDescription != null){
|
if(actionDescription != null){
|
||||||
ComponentUtil.INSTANCE.applyLore(actionDescription.formatted(actionParam), infoMeta);
|
infoMeta.setLore(Arrays.asList(actionDescription.split("\n")));
|
||||||
}
|
}
|
||||||
|
|
||||||
infoItem.setItemMeta(infoMeta);
|
infoItem.setItemMeta(infoMeta);
|
||||||
|
|
||||||
pane.bindItem('I', new GuiItem(infoItem, GuiGlobalActions.stayInPlace, CustomAnvil.instance));
|
pane.bindItem('I', new GuiItem(infoItem, GuiGlobalActions.stayInPlace, CustomAnvil.instance));
|
||||||
}
|
}
|
||||||
public ConfirmActionGui(@NotNull Message title, @NotNull String titleParam,
|
public ConfirmActionGui(@NotNull String title, String actionDescription,
|
||||||
@Nullable Message actionDescription, @NotNull String actionParam,
|
|
||||||
Gui backOnCancel, Gui backOnConfirm, Supplier<Boolean> onConfirm){
|
Gui backOnCancel, Gui backOnConfirm, Supplier<Boolean> onConfirm){
|
||||||
this(title, titleParam, actionDescription, actionParam, backOnCancel, backOnConfirm, onConfirm, true);
|
this(title, actionDescription, backOnCancel, backOnConfirm, onConfirm, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,27 +9,25 @@ import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||||
import xyz.alexcrea.cuanvil.util.ComponentUtil;
|
|
||||||
import xyz.alexcrea.cuanvil.util.MaterialUtil;
|
import xyz.alexcrea.cuanvil.util.MaterialUtil;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
public class SelectItemTypeGui extends AbstractAskGui {
|
public class SelectItemTypeGui extends AbstractAskGui {
|
||||||
|
|
||||||
private ItemStack selectedItem;
|
private ItemStack selectedItem;
|
||||||
public SelectItemTypeGui(@NotNull Message title,
|
public SelectItemTypeGui(@NotNull String title,
|
||||||
@NotNull String titleParam,
|
@NotNull String actionDescription,
|
||||||
@NotNull Message actionDescription,
|
|
||||||
@NotNull String descriptionParam,
|
|
||||||
@NotNull Gui backOnCancel,
|
@NotNull Gui backOnCancel,
|
||||||
@NotNull BiConsumer<ItemStack, HumanEntity> onSave,
|
@NotNull BiConsumer<ItemStack, HumanEntity> onSave,
|
||||||
boolean materialOnly) {
|
boolean materialOnly) {
|
||||||
super(3, title, titleParam, backOnCancel);
|
super(3, title, backOnCancel);
|
||||||
this.selectedItem = null;
|
this.selectedItem = null;
|
||||||
|
|
||||||
// Save item
|
// Save item
|
||||||
|
|
@ -49,7 +47,7 @@ public class SelectItemTypeGui extends AbstractAskGui {
|
||||||
this.pane.bindItem('S', GuiGlobalItems.backgroundItem());
|
this.pane.bindItem('S', GuiGlobalItems.backgroundItem());
|
||||||
|
|
||||||
// Select item
|
// Select item
|
||||||
ItemStack selectItem = setDisplayMeta(new ItemStack(Material.BARRIER), actionDescription, descriptionParam);
|
ItemStack selectItem = setDisplayMeta(new ItemStack(Material.BARRIER), actionDescription);
|
||||||
|
|
||||||
AtomicReference<GuiItem> selectGuiItem = new AtomicReference<>();
|
AtomicReference<GuiItem> selectGuiItem = new AtomicReference<>();
|
||||||
selectGuiItem.set(new GuiItem(selectItem, event -> {
|
selectGuiItem.set(new GuiItem(selectItem, event -> {
|
||||||
|
|
@ -60,7 +58,7 @@ public class SelectItemTypeGui extends AbstractAskGui {
|
||||||
|
|
||||||
ItemStack finalItem;
|
ItemStack finalItem;
|
||||||
if(materialOnly){
|
if(materialOnly){
|
||||||
finalItem = setDisplayMeta(new ItemStack(cursor.getType()), actionDescription, descriptionParam);
|
finalItem = setDisplayMeta(new ItemStack(cursor.getType()), actionDescription);
|
||||||
}else{
|
}else{
|
||||||
finalItem = cursor.clone();
|
finalItem = cursor.clone();
|
||||||
}
|
}
|
||||||
|
|
@ -78,19 +76,14 @@ public class SelectItemTypeGui extends AbstractAskGui {
|
||||||
GuiItem temporaryLeave = GuiGlobalItems.temporaryCloseGuiToSelectItem(Material.YELLOW_STAINED_GLASS_PANE, this);
|
GuiItem temporaryLeave = GuiGlobalItems.temporaryCloseGuiToSelectItem(Material.YELLOW_STAINED_GLASS_PANE, this);
|
||||||
|
|
||||||
this.pane.bindItem('s', temporaryLeave);
|
this.pane.bindItem('s', temporaryLeave);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
private ItemStack setDisplayMeta(ItemStack item, String actionDescription){
|
||||||
private ItemStack setDisplayMeta(
|
|
||||||
@NotNull ItemStack item,
|
|
||||||
@NotNull Message actionDescription,
|
|
||||||
@NotNull String param
|
|
||||||
){
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
assert meta != null;
|
|
||||||
|
|
||||||
ComponentUtil.INSTANCE.setMessageName(meta, MsgUI.INSTANCE.getSELECT_ITEM_TYPE_PLACE_HERE());
|
meta.setDisplayName("§ePlace an item here");
|
||||||
ComponentUtil.INSTANCE.applyLore(actionDescription.formatted(param), meta);
|
meta.setLore(Arrays.asList(actionDescription.split("\n")));
|
||||||
|
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
return item;
|
return item;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import xyz.alexcrea.cuanvil.enchant.CAEnchantmentRegistry;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.SettingGuiListConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.SettingGuiListConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.settings.SettingGui;
|
import xyz.alexcrea.cuanvil.gui.config.settings.SettingGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
@ -28,11 +27,11 @@ public abstract class AbstractEnchantConfigGui<T extends SettingGui.SettingGuiFa
|
||||||
*
|
*
|
||||||
* @param title Title of the gui.
|
* @param title Title of the gui.
|
||||||
*/
|
*/
|
||||||
protected AbstractEnchantConfigGui(Message title) {
|
protected AbstractEnchantConfigGui(String title) {
|
||||||
super(title);
|
super(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AbstractEnchantConfigGui(Message title, Gui parent) {
|
protected AbstractEnchantConfigGui(String title, Gui parent) {
|
||||||
super(title, parent);
|
super(title, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.elements.CustomRecipeSubSettingGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.elements.CustomRecipeSubSettingGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
|
||||||
import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe;
|
import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe;
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
|
|
||||||
|
|
@ -37,13 +36,13 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
||||||
}
|
}
|
||||||
|
|
||||||
private CustomRecipeConfigGui() {
|
private CustomRecipeConfigGui() {
|
||||||
super(MsgUI.INSTANCE.getCUSTOM_RECIPE_TITLE());
|
super("Custom Recipe Config");
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomRecipeConfigGui(Gui parent) {
|
public CustomRecipeConfigGui(Gui parent) {
|
||||||
super(MsgUI.INSTANCE.getCUSTOM_RECIPE_TITLE(), parent);
|
super("Custom Recipe Config", parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -61,7 +60,7 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
||||||
ItemMeta meta = displayedItem.getItemMeta();
|
ItemMeta meta = displayedItem.getItemMeta();
|
||||||
assert meta != null;
|
assert meta != null;
|
||||||
|
|
||||||
meta.setDisplayName("§e" + CasedStringUtil.snakeToUpperSpacedCase(recipe.toString()) + " §fCustom recipe");//TODO MESSAGE
|
meta.setDisplayName("§e" + CasedStringUtil.snakeToUpperSpacedCase(recipe.toString()) + " §fCustom recipe");
|
||||||
meta.addItemFlags(ItemFlag.values());
|
meta.addItemFlags(ItemFlag.values());
|
||||||
|
|
||||||
meta.setLore(getRecipeLore(recipe));
|
meta.setLore(getRecipeLore(recipe));
|
||||||
|
|
@ -73,7 +72,7 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
||||||
private static @NotNull ArrayList<String> getRecipeLore(AnvilCustomRecipe recipe) {
|
private static @NotNull ArrayList<String> getRecipeLore(AnvilCustomRecipe recipe) {
|
||||||
boolean shouldWork = recipe.validate();
|
boolean shouldWork = recipe.validate();
|
||||||
|
|
||||||
ArrayList<String> lore = new ArrayList<>();//TODO MESSAGE
|
ArrayList<String> lore = new ArrayList<>();
|
||||||
lore.add("§7Is valid: §" + (shouldWork ? "aYes" : "cNo"));
|
lore.add("§7Is valid: §" + (shouldWork ? "aYes" : "cNo"));
|
||||||
lore.add("§7Exact count: §" + (recipe.getExactCount() ? "aYes" : "cNo"));
|
lore.add("§7Exact count: §" + (recipe.getExactCount() ? "aYes" : "cNo"));
|
||||||
lore.add("§7Recipe Level Cost: §e" + recipe.getLevelCostPerCraft());
|
lore.add("§7Recipe Level Cost: §e" + recipe.getLevelCostPerCraft());
|
||||||
|
|
@ -91,7 +90,7 @@ public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRec
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String genericDisplayedName() {
|
protected String genericDisplayedName() {
|
||||||
return "custom recipe";//TODO MESSAGE
|
return "custom recipe";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import xyz.alexcrea.cuanvil.group.IncludeGroup;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.elements.EnchantConflictSubSettingGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.elements.EnchantConflictSubSettingGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -39,11 +38,11 @@ public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGr
|
||||||
|
|
||||||
// Need to init myself
|
// Need to init myself
|
||||||
public EnchantConflictGui(Gui parent) {
|
public EnchantConflictGui(Gui parent) {
|
||||||
super(MsgUI.INSTANCE.getENCHANTMENT_CONFLICT_TITLE(), parent);
|
super("Conflict Config", parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EnchantConflictGui() {
|
private EnchantConflictGui() {
|
||||||
super(MsgUI.INSTANCE.getENCHANTMENT_CONFLICT_TITLE());
|
super("Conflict Config");
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
@ -81,8 +80,8 @@ public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGr
|
||||||
assert meta != null;
|
assert meta != null;
|
||||||
|
|
||||||
meta.addItemFlags(ItemFlag.values());
|
meta.addItemFlags(ItemFlag.values());
|
||||||
meta.setDisplayName("§e" + CasedStringUtil.snakeToUpperSpacedCase(conflict.toString()) + " §fConflict"); //TODO MESSAGE
|
meta.setDisplayName("§e" + CasedStringUtil.snakeToUpperSpacedCase(conflict.toString()) + " §fConflict");
|
||||||
meta.setLore(Arrays.asList(//TODO MESSAGE
|
meta.setLore(Arrays.asList(
|
||||||
"§7Enchantment count: §e" + conflict.getEnchants().size(),
|
"§7Enchantment count: §e" + conflict.getEnchants().size(),
|
||||||
"§7Group count: §e" + conflict.getCantConflictGroup().getGroups().size(),
|
"§7Group count: §e" + conflict.getCantConflictGroup().getGroups().size(),
|
||||||
"§7Min enchantments count: §e" + conflict.getMinBeforeBlock()
|
"§7Min enchantments count: §e" + conflict.getMinBeforeBlock()
|
||||||
|
|
@ -99,7 +98,7 @@ public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGr
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String genericDisplayedName() {
|
protected String genericDisplayedName() {
|
||||||
return "conflict";//TODO MESSAGE
|
return "conflict";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import xyz.alexcrea.cuanvil.enchant.CAEnchantment;
|
||||||
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.settings.EnchantCostSettingsGui;
|
import xyz.alexcrea.cuanvil.gui.config.settings.EnchantCostSettingsGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -37,7 +36,7 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSe
|
||||||
* Constructor of this Global gui for enchantment cost settings.
|
* Constructor of this Global gui for enchantment cost settings.
|
||||||
*/
|
*/
|
||||||
public EnchantCostConfigGui() {
|
public EnchantCostConfigGui() {
|
||||||
super(MsgUI.INSTANCE.getENCHANTMENT_LEVEL_COST_TITLE());
|
super("§8Enchantment Level Cost");
|
||||||
if (INSTANCE == null) INSTANCE = this;
|
if (INSTANCE == null) INSTANCE = this;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
@ -47,7 +46,7 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSe
|
||||||
* Constructor of this Global gui for enchantment cost settings.
|
* Constructor of this Global gui for enchantment cost settings.
|
||||||
*/
|
*/
|
||||||
public EnchantCostConfigGui(Gui parent) {
|
public EnchantCostConfigGui(Gui parent) {
|
||||||
super(MsgUI.INSTANCE.getENCHANTMENT_LEVEL_COST_TITLE(), parent);
|
super("§8Enchantment Level Cost", parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -59,7 +58,6 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui<EnchantCostSe
|
||||||
String key = enchant.getKey().toString().toLowerCase(Locale.ENGLISH);
|
String key = enchant.getKey().toString().toLowerCase(Locale.ENGLISH);
|
||||||
String prettyKey = CasedStringUtil.snakeToUpperSpacedCase(key.replace(":", "_"));
|
String prettyKey = CasedStringUtil.snakeToUpperSpacedCase(key.replace(":", "_"));
|
||||||
|
|
||||||
//TODO MESSAGE
|
|
||||||
return new EnchantCostSettingsGui.EnchantCostSettingFactory(prettyKey + " Cost", parent,
|
return new EnchantCostSettingsGui.EnchantCostSettingFactory(prettyKey + " Cost", parent,
|
||||||
ENCHANT_VALUES_ROOT + '.' + key, ConfigHolder.DEFAULT_CONFIG,
|
ENCHANT_VALUES_ROOT + '.' + key, ConfigHolder.DEFAULT_CONFIG,
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment;
|
import xyz.alexcrea.cuanvil.enchant.CAEnchantment;
|
||||||
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui;
|
import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
@ -33,14 +32,14 @@ public class EnchantLimitConfigGui extends AbstractEnchantConfigGui<IntSettingsG
|
||||||
* Constructor of this Global gui for enchantment level limit settings.
|
* Constructor of this Global gui for enchantment level limit settings.
|
||||||
*/
|
*/
|
||||||
public EnchantLimitConfigGui() {
|
public EnchantLimitConfigGui() {
|
||||||
super(MsgUI.INSTANCE.getENCHANTMENT_LEVEL_LIMIT_TITLE());
|
super("§8Enchantment Level Limit");
|
||||||
if(INSTANCE == null) INSTANCE = this;
|
if(INSTANCE == null) INSTANCE = this;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnchantLimitConfigGui(Gui parent) {
|
public EnchantLimitConfigGui(Gui parent) {
|
||||||
super(MsgUI.INSTANCE.getENCHANTMENT_LEVEL_LIMIT_TITLE(), parent);
|
super("§8Enchantment Level Limit", parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||||
import xyz.alexcrea.cuanvil.enchant.CAEnchantment;
|
import xyz.alexcrea.cuanvil.enchant.CAEnchantment;
|
||||||
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui;
|
import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -30,7 +29,7 @@ public class EnchantMergeLimitConfigGui extends AbstractEnchantConfigGui<IntSett
|
||||||
* Constructor of this Global gui for enchantment level limit settings.
|
* Constructor of this Global gui for enchantment level limit settings.
|
||||||
*/
|
*/
|
||||||
public EnchantMergeLimitConfigGui() {
|
public EnchantMergeLimitConfigGui() {
|
||||||
super(MsgUI.INSTANCE.getENCHANTMENT_MERGE_LIMIT_TITLE());
|
super("§8Enchantment Maximum Merge Level");
|
||||||
if(INSTANCE == null) INSTANCE = this;
|
if(INSTANCE == null) INSTANCE = this;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
@ -40,7 +39,7 @@ public class EnchantMergeLimitConfigGui extends AbstractEnchantConfigGui<IntSett
|
||||||
* Constructor of this Global gui for enchantment level limit settings.
|
* Constructor of this Global gui for enchantment level limit settings.
|
||||||
*/
|
*/
|
||||||
public EnchantMergeLimitConfigGui(Gui parent) {
|
public EnchantMergeLimitConfigGui(Gui parent) {
|
||||||
super(MsgUI.INSTANCE.getENCHANTMENT_MERGE_LIMIT_TITLE(), parent);
|
super("§8Enchantment Maximum Merge Level", parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -53,7 +52,6 @@ public class EnchantMergeLimitConfigGui extends AbstractEnchantConfigGui<IntSett
|
||||||
String key = enchant.getKey().toString().toLowerCase(Locale.ROOT);
|
String key = enchant.getKey().toString().toLowerCase(Locale.ROOT);
|
||||||
String prettyKey = CasedStringUtil.snakeToUpperSpacedCase(key.replace(":", "_"));
|
String prettyKey = CasedStringUtil.snakeToUpperSpacedCase(key.replace(":", "_"));
|
||||||
|
|
||||||
//TODO MESSAGE
|
|
||||||
return new IntSettingsGui.IntSettingFactory(prettyKey + " Merge Limit", parent,
|
return new IntSettingsGui.IntSettingFactory(prettyKey + " Merge Limit", parent,
|
||||||
SECTION_NAME + '.' + key, ConfigHolder.DEFAULT_CONFIG,
|
SECTION_NAME + '.' + key, ConfigHolder.DEFAULT_CONFIG,
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import xyz.alexcrea.cuanvil.group.IncludeGroup;
|
||||||
import xyz.alexcrea.cuanvil.group.ItemGroupManager;
|
import xyz.alexcrea.cuanvil.group.ItemGroupManager;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.elements.GroupConfigSubSettingGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.elements.GroupConfigSubSettingGui;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
import xyz.alexcrea.cuanvil.util.LazyValue;
|
import xyz.alexcrea.cuanvil.util.LazyValue;
|
||||||
|
|
||||||
|
|
@ -40,13 +39,13 @@ public class GroupConfigGui extends MappedGuiListConfigGui<IncludeGroup, MappedG
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupConfigGui() {
|
public GroupConfigGui() {
|
||||||
super(MsgUI.INSTANCE.getMATERIAL_GROUP_TITLE());
|
super("Group Config");
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupConfigGui(Gui parent) {
|
public GroupConfigGui(Gui parent) {
|
||||||
super(MsgUI.INSTANCE.getMATERIAL_GROUP_TITLE(), parent);
|
super("Group Config", parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.ask.SelectItemTypeGui;
|
import xyz.alexcrea.cuanvil.gui.config.ask.SelectItemTypeGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.UnitRepairElementListGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.UnitRepairElementListGui;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
import xyz.alexcrea.cuanvil.util.MaterialUtil;
|
import xyz.alexcrea.cuanvil.util.MaterialUtil;
|
||||||
|
|
||||||
|
|
@ -39,13 +38,13 @@ public class UnitRepairConfigGui extends
|
||||||
}
|
}
|
||||||
|
|
||||||
private UnitRepairConfigGui() {
|
private UnitRepairConfigGui() {
|
||||||
super(MsgUI.INSTANCE.getUNIT_REPAIR_TITLE());
|
super("Unit Repair Config");
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UnitRepairConfigGui(Gui parent) {
|
public UnitRepairConfigGui(Gui parent) {
|
||||||
super(MsgUI.INSTANCE.getUNIT_REPAIR_TITLE(), parent);
|
super("Unit Repair Config", parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -129,8 +128,9 @@ public class UnitRepairConfigGui extends
|
||||||
clickEvent.setCancelled(true);
|
clickEvent.setCancelled(true);
|
||||||
|
|
||||||
new SelectItemTypeGui(
|
new SelectItemTypeGui(
|
||||||
MsgUI.INSTANCE.getUNIT_REPAIR_NEW_TITLE(), "",
|
"Select unit repair item.",
|
||||||
MsgUI.INSTANCE.getUNIT_REPAIR_NEW_DESCRIPTION(), "",
|
"§7Click here with an item to set the item\n" +
|
||||||
|
"§7You like to be an unit repair item",
|
||||||
this,
|
this,
|
||||||
(itemStack, player) -> {
|
(itemStack, player) -> {
|
||||||
NamespacedKey type = MaterialUtil.INSTANCE.getCustomType(itemStack);
|
NamespacedKey type = MaterialUtil.INSTANCE.getCustomType(itemStack);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ import org.jetbrains.annotations.NotNull;
|
||||||
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@ -33,18 +32,16 @@ public abstract class ElementListConfigGui<T> extends ChestGui implements ValueU
|
||||||
public static final int LIST_FILLER_LENGTH = 7;
|
public static final int LIST_FILLER_LENGTH = 7;
|
||||||
public static final int LIST_FILLER_HEIGHT = 4;
|
public static final int LIST_FILLER_HEIGHT = 4;
|
||||||
|
|
||||||
private final Message rawTitle;
|
private final String namePrefix;
|
||||||
private final String param;
|
|
||||||
|
|
||||||
protected PatternPane backgroundPane;
|
protected PatternPane backgroundPane;
|
||||||
|
|
||||||
private Predicate<T> filter = (t) -> true;
|
private Predicate<T> filter = (t) -> true;
|
||||||
private boolean hasDefaultFilter = true;
|
private boolean hasDefaultFilter = true;
|
||||||
|
|
||||||
protected ElementListConfigGui(@NotNull Message title, String param, Gui parent) {
|
protected ElementListConfigGui(@NotNull String title, Gui parent) {
|
||||||
super(6, title.textHolder(param, "", ""), CustomAnvil.instance);
|
super(6, title, CustomAnvil.instance);
|
||||||
this.rawTitle = title;
|
this.namePrefix = title;
|
||||||
this.param = param;
|
|
||||||
|
|
||||||
// Back item panel
|
// Back item panel
|
||||||
Pattern pattern = getBackgroundPattern();
|
Pattern pattern = getBackgroundPattern();
|
||||||
|
|
@ -262,10 +259,13 @@ public abstract class ElementListConfigGui<T> extends ChestGui implements ValueU
|
||||||
// and add actual page
|
// and add actual page
|
||||||
addPane(page);
|
addPane(page);
|
||||||
|
|
||||||
// intended parameter: (page/max_page) //TODO MESSAGE CHECK CHILDS
|
// set title
|
||||||
|
StringBuilder title = new StringBuilder(this.namePrefix);
|
||||||
int pagesSize = this.pages.size();
|
int pagesSize = this.pages.size();
|
||||||
var title = this.rawTitle.textHolder(param, pageID + 1, pagesSize);
|
if (pagesSize > 1) {
|
||||||
setTitle(title);
|
title.append(" (").append(pageID + 1).append('/').append(pagesSize).append(')');
|
||||||
|
}
|
||||||
|
setTitle(title.toString());
|
||||||
|
|
||||||
super.show(humanEntity);
|
super.show(humanEntity);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -21,14 +20,14 @@ public abstract class MappedElementListConfigGui<T, S> extends ElementListConfig
|
||||||
|
|
||||||
protected final HashMap<T, S> elementGuiMap;
|
protected final HashMap<T, S> elementGuiMap;
|
||||||
|
|
||||||
protected MappedElementListConfigGui(@NotNull Message title, @NotNull String param, @NotNull Gui parent) {
|
protected MappedElementListConfigGui(@NotNull String title, @NotNull Gui parent) {
|
||||||
super(title, param, parent);
|
super(title, parent);
|
||||||
this.elementGuiMap = new HashMap<>();
|
this.elementGuiMap = new HashMap<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MappedElementListConfigGui(@NotNull Message title, @NotNull String param) {
|
protected MappedElementListConfigGui(@NotNull String title) {
|
||||||
this(title, param, MainConfigGui.getInstance());
|
this(title, MainConfigGui.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.elements.ElementMappedToListGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.elements.ElementMappedToListGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||||
import xyz.alexcrea.cuanvil.util.LazyValue;
|
import xyz.alexcrea.cuanvil.util.LazyValue;
|
||||||
|
|
||||||
|
|
@ -20,20 +19,12 @@ import java.util.function.Supplier;
|
||||||
public abstract class MappedGuiListConfigGui<T, S extends MappedGuiListConfigGui.LazyElement<?>>
|
public abstract class MappedGuiListConfigGui<T, S extends MappedGuiListConfigGui.LazyElement<?>>
|
||||||
extends MappedElementListConfigGui<T, S> {
|
extends MappedElementListConfigGui<T, S> {
|
||||||
|
|
||||||
protected MappedGuiListConfigGui(@NotNull Message title, @NotNull String param) {
|
protected MappedGuiListConfigGui(@NotNull String title) {
|
||||||
super(title, param);
|
super(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MappedGuiListConfigGui(@NotNull Message title, @NotNull String param, @NotNull Gui parent) {
|
protected MappedGuiListConfigGui(@NotNull String title, @NotNull Gui parent) {
|
||||||
super(title, param, parent);
|
super(title, parent);
|
||||||
}
|
|
||||||
|
|
||||||
protected MappedGuiListConfigGui(@NotNull Message title) {
|
|
||||||
super(title, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected MappedGuiListConfigGui(@NotNull Message title, @NotNull Gui parent) {
|
|
||||||
super(title, "", parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.settings.SettingGui;
|
import xyz.alexcrea.cuanvil.gui.config.settings.SettingGui;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -21,26 +20,16 @@ public abstract class SettingGuiListConfigGui<T, S extends SettingGui.SettingGui
|
||||||
protected HashMap<T, GuiItem> guiItemMap;
|
protected HashMap<T, GuiItem> guiItemMap;
|
||||||
protected HashMap<T, S> factoryMap;
|
protected HashMap<T, S> factoryMap;
|
||||||
|
|
||||||
protected SettingGuiListConfigGui(@NotNull Message title, Gui parent) {
|
protected SettingGuiListConfigGui(@NotNull String title, Gui parent) {
|
||||||
super(title, "", parent);
|
super(title, parent);
|
||||||
this.guiItemMap = new HashMap<>();
|
this.guiItemMap = new HashMap<>();
|
||||||
this.factoryMap = new HashMap<>();
|
this.factoryMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SettingGuiListConfigGui(@NotNull Message title) {
|
protected SettingGuiListConfigGui(@NotNull String title) {
|
||||||
this(title, MainConfigGui.getInstance());
|
this(title, MainConfigGui.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SettingGuiListConfigGui(@NotNull Message title, @NotNull String param, Gui parent) {
|
|
||||||
super(title, param, parent);
|
|
||||||
this.guiItemMap = new HashMap<>();
|
|
||||||
this.factoryMap = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SettingGuiListConfigGui(@NotNull Message title, @NotNull String param) {
|
|
||||||
this(title, param, MainConfigGui.getInstance());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected GuiItem prepareCreateNewItem() {
|
protected GuiItem prepareCreateNewItem() {
|
||||||
ItemStack createItem = new ItemStack(Material.PAPER);
|
ItemStack createItem = new ItemStack(Material.PAPER);
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,12 @@ public class UnitRepairElementListGui extends SettingGuiListConfigGui<Namespaced
|
||||||
|
|
||||||
private boolean shouldWork = true;
|
private boolean shouldWork = true;
|
||||||
|
|
||||||
private static String prettifiedName(NamespacedKey parentMaterial) {
|
|
||||||
return CasedStringUtil.snakeToUpperSpacedCase(parentMaterial.getKey().toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnitRepairElementListGui(@NotNull NamespacedKey parentMaterial,
|
public UnitRepairElementListGui(@NotNull NamespacedKey parentMaterial,
|
||||||
@NotNull UnitRepairConfigGui parentGui) {
|
@NotNull UnitRepairConfigGui parentGui) {
|
||||||
super(MsgUI.INSTANCE.getUNIT_REPAIR_ELEMENT_TITLE(), prettifiedName(parentMaterial));
|
super("§e" + CasedStringUtil.snakeToUpperSpacedCase(parentMaterial.getKey().toLowerCase()) + " §rUnit repair");
|
||||||
this.parentMaterial = parentMaterial;
|
this.parentMaterial = parentMaterial;
|
||||||
this.parentGui = parentGui;
|
this.parentGui = parentGui;
|
||||||
this.materialName = prettifiedName(parentMaterial);
|
this.materialName = CasedStringUtil.snakeToUpperSpacedCase(parentMaterial.getKey().toLowerCase());
|
||||||
|
|
||||||
GuiGlobalItems.addBackItem(this.backgroundPane, parentGui);
|
GuiGlobalItems.addBackItem(this.backgroundPane, parentGui);
|
||||||
}
|
}
|
||||||
|
|
@ -66,19 +62,20 @@ public class UnitRepairElementListGui extends SettingGuiListConfigGui<Namespaced
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
new SelectItemTypeGui(
|
new SelectItemTypeGui(
|
||||||
MsgUI.INSTANCE.getUNIT_REPAIR_NEW_ELEMENT_TITLE(), this.materialName,
|
"Select item to be repaired.",
|
||||||
MsgUI.INSTANCE.getUNIT_REPAIR_NEW_ELEMENT_DESCRIPTION(), this.materialName,
|
"§7Click here with an item to set the item\n" +
|
||||||
|
"§7You like to be repaired by " + this.materialName,
|
||||||
this,
|
this,
|
||||||
(itemStack, player) -> {
|
(itemStack, player) -> {
|
||||||
ItemMeta meta = itemStack.getItemMeta();
|
ItemMeta meta = itemStack.getItemMeta();
|
||||||
NamespacedKey type = MaterialUtil.INSTANCE.getCustomType(itemStack);
|
NamespacedKey type = MaterialUtil.INSTANCE.getCustomType(itemStack);
|
||||||
|
|
||||||
if (!(meta instanceof Damageable)) {
|
if (!(meta instanceof Damageable)) {
|
||||||
MsgUI.INSTANCE.getUNIT_REPAIR_NEW_ELEMENT_CANNOT_REPAIR().send(player);
|
MsgUI.INSTANCE.getUNIT_REPAIR_ELEMENT_CANNOT_REPAIR_NEW().send(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type.equals(this.parentMaterial)) {
|
if (type.equals(this.parentMaterial)) {
|
||||||
MsgUI.INSTANCE.getUNIT_REPAIR_NEW_ELEMENT_SAME_TYPE().send(player);
|
MsgUI.INSTANCE.getUNIT_REPAIR_ELEMENT_SAME_TYPE_NEW().send(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,7 +94,7 @@ public class UnitRepairElementListGui extends SettingGuiListConfigGui<Namespaced
|
||||||
|
|
||||||
|
|
||||||
// Display material edit setting
|
// Display material edit setting
|
||||||
this.factoryMap.get(type).create().show(player);
|
this.factoryMap.get(materialName).create().show(player);
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
).show(event.getWhoClicked());
|
).show(event.getWhoClicked());
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ import xyz.alexcrea.cuanvil.gui.config.settings.ItemSettingGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
|
||||||
import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe;
|
import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe;
|
||||||
import xyz.alexcrea.cuanvil.recipe.CustomAnvilRecipeManager;
|
import xyz.alexcrea.cuanvil.recipe.CustomAnvilRecipeManager;
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
|
|
@ -37,7 +36,7 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
|
||||||
public CustomRecipeSubSettingGui(
|
public CustomRecipeSubSettingGui(
|
||||||
@NotNull CustomRecipeConfigGui parent,
|
@NotNull CustomRecipeConfigGui parent,
|
||||||
@NotNull AnvilCustomRecipe anvilRecipe) {
|
@NotNull AnvilCustomRecipe anvilRecipe) {
|
||||||
super(4, CasedStringUtil.snakeToUpperSpacedCase(anvilRecipe.toString()));
|
super(4, "§e" + CasedStringUtil.snakeToUpperSpacedCase(anvilRecipe.toString()) + " §8Config");
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.anvilRecipe = anvilRecipe;
|
this.anvilRecipe = anvilRecipe;
|
||||||
|
|
||||||
|
|
@ -74,19 +73,19 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
|
||||||
ItemMeta deleteMeta = deleteItem.getItemMeta();
|
ItemMeta deleteMeta = deleteItem.getItemMeta();
|
||||||
assert deleteMeta != null;
|
assert deleteMeta != null;
|
||||||
|
|
||||||
deleteMeta.setDisplayName("§4DELETE RECIPE");//TODO MESSAGE
|
deleteMeta.setDisplayName("§4DELETE RECIPE");
|
||||||
deleteMeta.setLore(Collections.singletonList("§cCaution with this button !"));//TODO MESSAGE
|
deleteMeta.setLore(Collections.singletonList("§cCaution with this button !"));
|
||||||
|
|
||||||
deleteItem.setItemMeta(deleteMeta);
|
deleteItem.setItemMeta(deleteMeta);
|
||||||
this.pane.bindItem('D', new GuiItem(deleteItem, GuiGlobalActions.openGuiAction(createDeleteGui()), CustomAnvil.instance));
|
this.pane.bindItem('D', new GuiItem(deleteItem, GuiGlobalActions.openGuiAction(createDeleteGui()), CustomAnvil.instance));
|
||||||
|
|
||||||
// Displayed item will be updated later
|
// Displayed item will be updated later
|
||||||
IntRange costRange = AnvilCustomRecipe.Companion.getXP_COST_CONFIG_RANGE();
|
IntRange costRange = AnvilCustomRecipe.Companion.getXP_COST_CONFIG_RANGE();
|
||||||
this.exactCountFactory = new BoolSettingsGui.BoolSettingFactory("§8Exact count ?", this,//TODO MESSAGE
|
this.exactCountFactory = new BoolSettingsGui.BoolSettingFactory("§8Exact count ?", this,
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
this.anvilRecipe + "." + AnvilCustomRecipe.EXACT_COUNT_CONFIG, AnvilCustomRecipe.DEFAULT_EXACT_COUNT_CONFIG);
|
this.anvilRecipe + "." + AnvilCustomRecipe.EXACT_COUNT_CONFIG, AnvilCustomRecipe.DEFAULT_EXACT_COUNT_CONFIG);
|
||||||
|
|
||||||
this.removeExactLinearXpFactory = new BoolSettingsGui.BoolSettingFactory("§8Remove exact linear xp ?", this,//TODO MESSAGE
|
this.removeExactLinearXpFactory = new BoolSettingsGui.BoolSettingFactory("§8Remove exact linear xp ?", this,
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
this.anvilRecipe + "." + AnvilCustomRecipe.REMOVE_EXACT_XP_CONFIG, AnvilCustomRecipe.DEFAULT_REMOVE_EXACT_XP_CONFIG);
|
this.anvilRecipe + "." + AnvilCustomRecipe.REMOVE_EXACT_XP_CONFIG, AnvilCustomRecipe.DEFAULT_REMOVE_EXACT_XP_CONFIG);
|
||||||
|
|
||||||
|
|
@ -94,18 +93,18 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
assert meta != null;
|
assert meta != null;
|
||||||
|
|
||||||
meta.setDisplayName("§cRemove exact linear xp ?");//TODO MESSAGE
|
meta.setDisplayName("§cRemove exact linear xp ?");
|
||||||
meta.setLore(Collections.singletonList("§7Not usable if linear cost is 0"));//TODO MESSAGE
|
meta.setLore(Collections.singletonList("§7Not usable if linear cost is 0"));
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
this.noRemoveExactLinearXp = new GuiItem(item, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
|
this.noRemoveExactLinearXp = new GuiItem(item, GuiGlobalActions.stayInPlace, CustomAnvil.instance);
|
||||||
|
|
||||||
this.levelCostFactory = new IntSettingsGui.IntSettingFactory("§8Recipe Level Cost", this,//TODO MESSAGE
|
this.levelCostFactory = new IntSettingsGui.IntSettingFactory("§8Recipe Level Cost", this,
|
||||||
this.anvilRecipe + "." + AnvilCustomRecipe.XP_LEVEL_COST_CONFIG,
|
this.anvilRecipe + "." + AnvilCustomRecipe.XP_LEVEL_COST_CONFIG,
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
null,
|
null,
|
||||||
costRange.getFirst(), costRange.getLast(), AnvilCustomRecipe.DEFAULT_XP_LEVEL_COST_CONFIG, 1, 5, 10);
|
costRange.getFirst(), costRange.getLast(), AnvilCustomRecipe.DEFAULT_XP_LEVEL_COST_CONFIG, 1, 5, 10);
|
||||||
|
|
||||||
this.linearXpCostFactory = new IntSettingsGui.IntSettingFactory("§8Recipe Linear Xp Cost", this,//TODO MESSAGE
|
this.linearXpCostFactory = new IntSettingsGui.IntSettingFactory("§8Recipe Linear Xp Cost", this,
|
||||||
this.anvilRecipe + "." + AnvilCustomRecipe.LINEAR_XP_COST_CONFIG,
|
this.anvilRecipe + "." + AnvilCustomRecipe.LINEAR_XP_COST_CONFIG,
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
null,
|
null,
|
||||||
|
|
@ -118,21 +117,21 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
AnvilCustomRecipe.Companion.getDEFAULT_LEFT_ITEM_CONFIG(),
|
AnvilCustomRecipe.Companion.getDEFAULT_LEFT_ITEM_CONFIG(),
|
||||||
"§7Set the left item of the custom craft",
|
"§7Set the left item of the custom craft",
|
||||||
"§7■ + □ = □");//TODO MESSAGE
|
"§7\u25A0 + \u25A1 = \u25A1");
|
||||||
|
|
||||||
this.rightItemFactory = new ItemSettingGui.ItemSettingFactory("§eRecipe Right §8Item", this,
|
this.rightItemFactory = new ItemSettingGui.ItemSettingFactory("§eRecipe Right §8Item", this,
|
||||||
this.anvilRecipe + "." + AnvilCustomRecipe.RIGHT_ITEM_CONFIG,
|
this.anvilRecipe + "." + AnvilCustomRecipe.RIGHT_ITEM_CONFIG,
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
AnvilCustomRecipe.Companion.getDEFAULT_RIGHT_ITEM_CONFIG(),
|
AnvilCustomRecipe.Companion.getDEFAULT_RIGHT_ITEM_CONFIG(),
|
||||||
"§7Set the right item of the custom craft",
|
"§7Set the right item of the custom craft",
|
||||||
"§7□ + ■ = □");//TODO MESSAGE
|
"§7\u25A1 + \u25A0 = \u25A1");
|
||||||
|
|
||||||
this.resultItemFactory = new ItemSettingGui.ItemSettingFactory("§aRecipe Result §8Item", this,
|
this.resultItemFactory = new ItemSettingGui.ItemSettingFactory("§aRecipe Result §8Item", this,
|
||||||
this.anvilRecipe + "." + AnvilCustomRecipe.RESULT_ITEM_CONFIG,
|
this.anvilRecipe + "." + AnvilCustomRecipe.RESULT_ITEM_CONFIG,
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
ConfigHolder.CUSTOM_RECIPE_HOLDER,
|
||||||
AnvilCustomRecipe.Companion.getDEFAULT_RESULT_ITEM_CONFIG(),
|
AnvilCustomRecipe.Companion.getDEFAULT_RESULT_ITEM_CONFIG(),
|
||||||
"§7Set the result item of the custom craft",
|
"§7Set the result item of the custom craft",
|
||||||
"§7□ + □ = ■");//TODO MESSAGE
|
"§7\u25A1 + \u25A1 = \u25A0");
|
||||||
|
|
||||||
// Now we update the items
|
// Now we update the items
|
||||||
updateLocal();
|
updateLocal();
|
||||||
|
|
@ -163,9 +162,8 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
|
||||||
return success;
|
return success;
|
||||||
};
|
};
|
||||||
|
|
||||||
var type = CasedStringUtil.snakeToUpperSpacedCase(this.anvilRecipe.toString());
|
return new ConfirmActionGui("§cDelete §e" + CasedStringUtil.snakeToUpperSpacedCase(this.anvilRecipe.toString()) + "§c?",
|
||||||
return new ConfirmActionGui(MsgUI.INSTANCE.getCUSTOM_RECIPE_ELEMENT_DELETE_TITLE(), type,
|
"§7Confirm that you want to delete this conflict.",
|
||||||
MsgUI.INSTANCE.getCUSTOM_RECIPE_ELEMENT_DELETE_DESCRIPTION(), type,
|
|
||||||
this, this.parent, deleteSupplier
|
this, this.parent, deleteSupplier
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
import xyz.alexcrea.cuanvil.util.MetricsUtil;
|
import xyz.alexcrea.cuanvil.util.MetricsUtil;
|
||||||
|
|
||||||
|
|
@ -42,7 +41,8 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
public EnchantConflictSubSettingGui(
|
public EnchantConflictSubSettingGui(
|
||||||
@NotNull EnchantConflictGui parent,
|
@NotNull EnchantConflictGui parent,
|
||||||
@NotNull EnchantConflictGroup enchantConflict) {
|
@NotNull EnchantConflictGroup enchantConflict) {
|
||||||
super(3, CasedStringUtil.snakeToUpperSpacedCase(enchantConflict.toString()));
|
super(3,
|
||||||
|
"§e" + CasedStringUtil.snakeToUpperSpacedCase(enchantConflict.toString()) + " §8Config");
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.enchantConflict = enchantConflict;
|
this.enchantConflict = enchantConflict;
|
||||||
|
|
||||||
|
|
@ -71,8 +71,8 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
ItemMeta deleteMeta = deleteItem.getItemMeta();
|
ItemMeta deleteMeta = deleteItem.getItemMeta();
|
||||||
assert deleteMeta != null;
|
assert deleteMeta != null;
|
||||||
|
|
||||||
deleteMeta.setDisplayName("§4DELETE CONFLICT");//TODO MESSAGE
|
deleteMeta.setDisplayName("§4DELETE CONFLICT");
|
||||||
deleteMeta.setLore(Collections.singletonList("§cCaution with this button !"));//TODO MESSAGE
|
deleteMeta.setLore(Collections.singletonList("§cCaution with this button !"));
|
||||||
|
|
||||||
deleteItem.setItemMeta(deleteMeta);
|
deleteItem.setItemMeta(deleteMeta);
|
||||||
this.pane.bindItem('D', new GuiItem(deleteItem, GuiGlobalActions.openGuiAction(createDeleteGui()), CustomAnvil.instance));
|
this.pane.bindItem('D', new GuiItem(deleteItem, GuiGlobalActions.openGuiAction(createDeleteGui()), CustomAnvil.instance));
|
||||||
|
|
@ -80,24 +80,22 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
// Displayed item will be updated later
|
// Displayed item will be updated later
|
||||||
this.enchantSettingItem = new GuiItem(new ItemStack(Material.ENCHANTED_BOOK), event -> {
|
this.enchantSettingItem = new GuiItem(new ItemStack(Material.ENCHANTED_BOOK), event -> {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
var type = CasedStringUtil.snakeToUpperSpacedCase(enchantConflict.toString());
|
|
||||||
EnchantSelectSettingGui enchantGui = new EnchantSelectSettingGui(
|
EnchantSelectSettingGui enchantGui = new EnchantSelectSettingGui(
|
||||||
MsgUI.INSTANCE.getENCHANTMENT_CONFLICT_ELEMENT_ENCHANTMENTS(), type,
|
"§e" + CasedStringUtil.snakeToUpperSpacedCase(enchantConflict.toString()) + "§5",
|
||||||
this, this);
|
this, this);
|
||||||
enchantGui.show(event.getWhoClicked());
|
enchantGui.show(event.getWhoClicked());
|
||||||
}, CustomAnvil.instance);
|
}, CustomAnvil.instance);
|
||||||
|
|
||||||
this.groupSettingItem = new GuiItem(new ItemStack(Material.PAPER), event -> {
|
this.groupSettingItem = new GuiItem(new ItemStack(Material.PAPER), event -> {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
var type = CasedStringUtil.snakeToUpperSpacedCase(this.enchantConflict.toString());
|
|
||||||
GroupSelectSettingGui enchantGui = new GroupSelectSettingGui(
|
GroupSelectSettingGui enchantGui = new GroupSelectSettingGui(
|
||||||
MsgUI.INSTANCE.getENCHANTMENT_CONFLICT_ELEMENT_SUB_GROUPS(), type,
|
"§e" + CasedStringUtil.snakeToUpperSpacedCase(this.enchantConflict.toString()) + " §3Groups",
|
||||||
this, this, 0);
|
this, this, 0);
|
||||||
enchantGui.show(event.getWhoClicked());
|
enchantGui.show(event.getWhoClicked());
|
||||||
}, CustomAnvil.instance);
|
}, CustomAnvil.instance);
|
||||||
|
|
||||||
this.minBeforeActiveSettingFactory = new IntSettingsGui.IntSettingFactory(
|
this.minBeforeActiveSettingFactory = new IntSettingsGui.IntSettingFactory(
|
||||||
"§8Minimum enchantment count",//TODO MESSAGE
|
"§8Minimum enchantment count",
|
||||||
this, this.enchantConflict + ".maxEnchantmentBeforeConflict", ConfigHolder.CONFLICT_HOLDER,
|
this, this.enchantConflict + ".maxEnchantmentBeforeConflict", ConfigHolder.CONFLICT_HOLDER,
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
"§7Minimum enchantment count set to X mean only X enchantment can be put",
|
"§7Minimum enchantment count set to X mean only X enchantment can be put",
|
||||||
|
|
@ -139,9 +137,8 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
return success;
|
return success;
|
||||||
};
|
};
|
||||||
|
|
||||||
var type = CasedStringUtil.snakeToUpperSpacedCase(this.enchantConflict.toString());
|
return new ConfirmActionGui("§cDelete §e" + CasedStringUtil.snakeToUpperSpacedCase(this.enchantConflict.toString()) + "§c?",
|
||||||
return new ConfirmActionGui(MsgUI.INSTANCE.getENCHANTMENT_CONFLICT_ELEMENT_DELETE_TITLE(), type,
|
"§7Confirm that you want to delete this conflict.",
|
||||||
MsgUI.INSTANCE.getENCHANTMENT_CONFLICT_ELEMENT_DELETE_DESCRIPTION(), type,
|
|
||||||
this, this.parent, deleteSupplier
|
this, this.parent, deleteSupplier
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -162,12 +159,12 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
|
|
||||||
// Prepare enchantment lore
|
// Prepare enchantment lore
|
||||||
ArrayList<String> enchantLore = new ArrayList<>();
|
ArrayList<String> enchantLore = new ArrayList<>();
|
||||||
enchantLore.add("§7Allow you to select a list of §5Enchantments §7that this conflict should include");//TODO MESSAGE
|
enchantLore.add("§7Allow you to select a list of §5Enchantments §7that this conflict should include");
|
||||||
Set<CAEnchantment> enchants = getSelectedEnchantments();
|
Set<CAEnchantment> enchants = getSelectedEnchantments();
|
||||||
if (enchants.isEmpty()) {
|
if (enchants.isEmpty()) {
|
||||||
enchantLore.add("§7There is no included enchantment for this conflict.");//TODO MESSAGE
|
enchantLore.add("§7There is no included enchantment for this conflict.");
|
||||||
} else {
|
} else {
|
||||||
enchantLore.add("§7List of included enchantment for this conflict:");//TODO MESSAGE
|
enchantLore.add("§7List of included enchantment for this conflict:");
|
||||||
Iterator<CAEnchantment> enchantIterator = enchants.iterator();
|
Iterator<CAEnchantment> enchantIterator = enchants.iterator();
|
||||||
|
|
||||||
boolean greaterThanMax = enchants.size() > 5;
|
boolean greaterThanMax = enchants.size() > 5;
|
||||||
|
|
@ -178,7 +175,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
enchantLore.add("§7- §5" + formattedName);
|
enchantLore.add("§7- §5" + formattedName);
|
||||||
}
|
}
|
||||||
if (greaterThanMax) {
|
if (greaterThanMax) {
|
||||||
enchantLore.add("§7And " + (enchants.size() - 4) + " more...");//TODO MESSAGE
|
enchantLore.add("§7And " + (enchants.size() - 4) + " more...");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +188,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
ItemMeta enchantMeta = enchantItem.getItemMeta();
|
ItemMeta enchantMeta = enchantItem.getItemMeta();
|
||||||
assert enchantMeta != null;
|
assert enchantMeta != null;
|
||||||
|
|
||||||
enchantMeta.setDisplayName("§aSelect included §5Enchantments §aSettings");//TODO MESSAGE
|
enchantMeta.setDisplayName("§aSelect included §5Enchantments §aSettings");
|
||||||
enchantMeta.setLore(enchantLore);
|
enchantMeta.setLore(enchantLore);
|
||||||
|
|
||||||
enchantItem.setItemMeta(enchantMeta);
|
enchantItem.setItemMeta(enchantMeta);
|
||||||
|
|
@ -203,7 +200,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
ItemMeta groupMeta = groupItem.getItemMeta();
|
ItemMeta groupMeta = groupItem.getItemMeta();
|
||||||
assert groupMeta != null;
|
assert groupMeta != null;
|
||||||
|
|
||||||
groupMeta.setDisplayName("§aSelect Excluded §3Groups §aSettings");//TODO MESSAGE
|
groupMeta.setDisplayName("§aSelect Excluded §3Groups §aSettings");
|
||||||
groupMeta.setLore(groupLore);
|
groupMeta.setLore(groupLore);
|
||||||
|
|
||||||
groupItem.setItemMeta(groupMeta);
|
groupItem.setItemMeta(groupMeta);
|
||||||
|
|
@ -211,7 +208,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
this.groupSettingItem.setItem(groupItem); // Just in case
|
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"));//TODO MESSAGE
|
"Minimum Enchantment Count"));
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,7 +246,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
@Override
|
@Override
|
||||||
public boolean setSelectedEnchantments(Set<CAEnchantment> enchantments) {
|
public boolean setSelectedEnchantments(Set<CAEnchantment> enchantments) {
|
||||||
if (!this.shouldWork) {
|
if (!this.shouldWork) {
|
||||||
CustomAnvil.instance.getLogger().info("Trying to save " + enchantConflict + " enchants but sub config is destroyed");//TODO MESSAGE
|
CustomAnvil.instance.getLogger().info("Trying to save " + enchantConflict + " enchants but sub config is destroyed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -267,7 +264,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
try {
|
try {
|
||||||
updateGuiValues();
|
updateGuiValues();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
CustomAnvil.instance.getLogger().log(Level.WARNING, "An error occurred while updating enchants for " + this.enchantConflict, e);//TODO MESSAGE
|
CustomAnvil.instance.getLogger().log(Level.WARNING, "An error occurred while updating enchants for " + this.enchantConflict, e);
|
||||||
MetricsUtil.INSTANCE.trackError(e);
|
MetricsUtil.INSTANCE.trackError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -294,7 +291,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
@Override
|
@Override
|
||||||
public boolean setSelectedGroups(Set<AbstractMaterialGroup> groups) {
|
public boolean setSelectedGroups(Set<AbstractMaterialGroup> groups) {
|
||||||
if (!this.shouldWork) {
|
if (!this.shouldWork) {
|
||||||
CustomAnvil.instance.getLogger().info("Trying to save " + enchantConflict.toString() + " groups but sub config is destroyed");//TODO MESSAGE
|
CustomAnvil.instance.getLogger().info("Trying to save " + enchantConflict.toString() + " groups but sub config is destroyed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -312,7 +309,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
try {
|
try {
|
||||||
updateGuiValues();
|
updateGuiValues();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
CustomAnvil.instance.getLogger().log(Level.WARNING, "An error occurred while updating group for " + this.enchantConflict, e);//TODO MESSAGE
|
CustomAnvil.instance.getLogger().log(Level.WARNING, "An error occurred while updating group for " + this.enchantConflict, e);
|
||||||
MetricsUtil.INSTANCE.trackError(e);
|
MetricsUtil.INSTANCE.trackError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,11 @@ import xyz.alexcrea.cuanvil.gui.config.ask.ConfirmActionGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.global.GroupConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.global.GroupConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.settings.GroupSelectSettingGui;
|
import xyz.alexcrea.cuanvil.gui.config.settings.GroupSelectSettingGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.settings.MaterialSelectSettingGui;
|
import xyz.alexcrea.cuanvil.gui.config.settings.MaterialSelectSettingGui;
|
||||||
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
import xyz.alexcrea.cuanvil.util.ComponentUtil;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
@ -40,7 +40,8 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
||||||
public GroupConfigSubSettingGui(
|
public GroupConfigSubSettingGui(
|
||||||
@NotNull GroupConfigGui parent,
|
@NotNull GroupConfigGui parent,
|
||||||
@NotNull IncludeGroup group) {
|
@NotNull IncludeGroup group) {
|
||||||
super(3, CasedStringUtil.snakeToUpperSpacedCase(group.getName()));
|
super(3,
|
||||||
|
"§e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " §rConfig");
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.group = group;
|
this.group = group;
|
||||||
|
|
||||||
|
|
@ -64,49 +65,39 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
||||||
// Delete item
|
// Delete item
|
||||||
ItemStack deleteItem = new ItemStack(Material.RED_TERRACOTTA);
|
ItemStack deleteItem = new ItemStack(Material.RED_TERRACOTTA);
|
||||||
ItemMeta deleteMeta = deleteItem.getItemMeta();
|
ItemMeta deleteMeta = deleteItem.getItemMeta();
|
||||||
assert deleteMeta != null;
|
|
||||||
|
|
||||||
ComponentUtil.INSTANCE.setMessageName(deleteMeta, MsgUI.INSTANCE.getMATERIAL_GROUP_ELEMENT_DELETE_BUTTON_NAME());
|
deleteMeta.setDisplayName("§4DELETE GROUP");
|
||||||
ComponentUtil.INSTANCE.applyLore(
|
deleteMeta.setLore(Collections.singletonList("§cCaution with this button !"));
|
||||||
MsgUI.INSTANCE.getMATERIAL_GROUP_ELEMENT_DELETE_BUTTON_LORE().formatted(),
|
|
||||||
deleteMeta
|
|
||||||
);
|
|
||||||
|
|
||||||
deleteItem.setItemMeta(deleteMeta);
|
deleteItem.setItemMeta(deleteMeta);
|
||||||
this.pane.bindItem('D', new GuiItem(deleteItem, openGuiAndCheckAction(), CustomAnvil.instance));
|
this.pane.bindItem('D', new GuiItem(deleteItem, openGuiAndCheckAction(), CustomAnvil.instance));
|
||||||
|
|
||||||
// Displayed item will be updated later
|
// Displayed item will be updated later
|
||||||
var materialSelectionName = MsgUI.INSTANCE.getMATERIAL_GROUP_ELEMENT_SELECTED_MATERIALS();
|
String materialSelectionName = "§e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " §rMaterials";
|
||||||
var name = CasedStringUtil.snakeToUpperSpacedCase(group.getName());
|
|
||||||
|
|
||||||
ItemStack selectItem = new ItemStack(Material.DIAMOND_SWORD);
|
ItemStack selectItem = new ItemStack(Material.DIAMOND_SWORD);
|
||||||
ItemMeta selectItemMeta = selectItem.getItemMeta();
|
ItemMeta selectItemMeta = selectItem.getItemMeta();
|
||||||
assert selectItemMeta != null;
|
selectItemMeta.setDisplayName(materialSelectionName);
|
||||||
|
|
||||||
ComponentUtil.INSTANCE.setMessageName(selectItemMeta, materialSelectionName, name);
|
|
||||||
|
|
||||||
selectItem.setItemMeta(selectItemMeta);
|
selectItem.setItemMeta(selectItemMeta);
|
||||||
this.materialSelection = new GuiItem(selectItem, (event) -> {
|
this.materialSelection = new GuiItem(selectItem, (event) -> {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
MaterialSelectSettingGui selectGui = new MaterialSelectSettingGui(this,
|
MaterialSelectSettingGui selectGui = new MaterialSelectSettingGui(this,
|
||||||
materialSelectionName, name
|
materialSelectionName
|
||||||
, this);
|
, this);
|
||||||
selectGui.show(event.getWhoClicked());
|
selectGui.show(event.getWhoClicked());
|
||||||
|
|
||||||
}, CustomAnvil.instance);
|
}, CustomAnvil.instance);
|
||||||
|
|
||||||
var selectGroupName = MsgUI.INSTANCE.getMATERIAL_GROUP_ELEMENT_SELECTED_SUB_GROUPS();
|
String selectGroupName = "§e" + CasedStringUtil.snakeToUpperSpacedCase(this.group.getName()) + " §rGroups";
|
||||||
ItemStack selectGroup = new ItemStack(Material.CHEST);
|
ItemStack selectGroup = new ItemStack(Material.CHEST);
|
||||||
ItemMeta selectGroupMeta = selectGroup.getItemMeta();
|
ItemMeta selectGroupMeta = selectGroup.getItemMeta();
|
||||||
assert selectGroupMeta != null;
|
selectGroupMeta.setDisplayName(selectGroupName);
|
||||||
|
|
||||||
ComponentUtil.INSTANCE.setMessageName(selectGroupMeta, selectGroupName, name);
|
|
||||||
|
|
||||||
selectGroup.setItemMeta(selectGroupMeta);
|
selectGroup.setItemMeta(selectGroupMeta);
|
||||||
this.groupSelection = new GuiItem(selectGroup, (event) -> {
|
this.groupSelection = new GuiItem(selectGroup, (event) -> {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
GroupSelectSettingGui enchantGui = new GroupSelectSettingGui(
|
GroupSelectSettingGui enchantGui = new GroupSelectSettingGui(
|
||||||
selectGroupName, name,
|
selectGroupName,
|
||||||
this, this, 0);
|
this, this, 0);
|
||||||
enchantGui.show(event.getWhoClicked());
|
enchantGui.show(event.getWhoClicked());
|
||||||
}, CustomAnvil.instance);
|
}, CustomAnvil.instance);
|
||||||
|
|
@ -161,9 +152,8 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
||||||
return success;
|
return success;
|
||||||
};
|
};
|
||||||
|
|
||||||
var type = CasedStringUtil.snakeToUpperSpacedCase(this.group.toString());
|
return new ConfirmActionGui("§cDelete §e" + CasedStringUtil.snakeToUpperSpacedCase(this.group.toString()) + "§c?",
|
||||||
return new ConfirmActionGui(MsgUI.INSTANCE.getMATERIAL_GROUP_ELEMENT_DELETE_TITLE(), type,
|
"§7Confirm that you want to delete this group.",
|
||||||
MsgUI.INSTANCE.getMATERIAL_GROUP_ELEMENT_DELETE_DESCRIPTION(), type,
|
|
||||||
this, this.parent, deleteSupplier
|
this, this.parent, deleteSupplier
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -236,8 +226,7 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
||||||
ItemStack matSelectItem = this.materialSelection.getItem();
|
ItemStack matSelectItem = this.materialSelection.getItem();
|
||||||
ItemMeta matSelectMeta = matSelectItem.getItemMeta();
|
ItemMeta matSelectMeta = matSelectItem.getItemMeta();
|
||||||
|
|
||||||
assert matSelectMeta != null;
|
matSelectMeta.setDisplayName("§aSelect included §eMaterials §aSettings");
|
||||||
matSelectMeta.setDisplayName("§aSelect included §eMaterials §aSettings");//TODO MESSAGE
|
|
||||||
matSelectMeta.setLore(matLore);
|
matSelectMeta.setLore(matLore);
|
||||||
matSelectMeta.addItemFlags(ItemFlag.values());
|
matSelectMeta.addItemFlags(ItemFlag.values());
|
||||||
|
|
||||||
|
|
@ -249,8 +238,7 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
||||||
ItemStack groupSelectItem = this.groupSelection.getItem();
|
ItemStack groupSelectItem = this.groupSelection.getItem();
|
||||||
ItemMeta groupSelectMeta = groupSelectItem.getItemMeta();
|
ItemMeta groupSelectMeta = groupSelectItem.getItemMeta();
|
||||||
|
|
||||||
assert groupSelectMeta != null;
|
groupSelectMeta.setDisplayName("§aSelect included §3Groups §aSettings");
|
||||||
groupSelectMeta.setDisplayName("§aSelect included §3Groups §aSettings");//TODO MESSAGE
|
|
||||||
groupSelectMeta.setLore(groupLore);
|
groupSelectMeta.setLore(groupLore);
|
||||||
|
|
||||||
groupSelectItem.setItemMeta(groupSelectMeta);
|
groupSelectItem.setItemMeta(groupSelectMeta);
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
package xyz.alexcrea.cuanvil.gui.config.list.elements;
|
package xyz.alexcrea.cuanvil.gui.config.list.elements;
|
||||||
|
|
||||||
|
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
|
||||||
import com.github.stefvanschie.inventoryframework.gui.type.ChestGui;
|
import com.github.stefvanschie.inventoryframework.gui.type.ChestGui;
|
||||||
import com.github.stefvanschie.inventoryframework.gui.type.util.Gui;
|
import com.github.stefvanschie.inventoryframework.gui.type.util.Gui;
|
||||||
import io.delilaheve.CustomAnvil;
|
import io.delilaheve.CustomAnvil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
|
||||||
|
|
||||||
public abstract class MappedToListSubSettingGui extends ChestGui implements ValueUpdatableGui, ElementMappedToListGui {
|
public abstract class MappedToListSubSettingGui extends ChestGui implements ValueUpdatableGui, ElementMappedToListGui {
|
||||||
|
|
||||||
protected MappedToListSubSettingGui(
|
protected MappedToListSubSettingGui(
|
||||||
int rows,
|
int rows,
|
||||||
@NotNull String type) {
|
@NotNull String title) {
|
||||||
super(rows, MsgUI.INSTANCE.getSHARED_TYPED_CONFIG_TITLE().textHolder(type), CustomAnvil.instance);
|
super(rows, title, CustomAnvil.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import xyz.alexcrea.cuanvil.gui.config.SelectEnchantmentContainer;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.SettingGuiListConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.SettingGuiListConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -36,10 +35,8 @@ public class EnchantSelectSettingGui extends SettingGuiListConfigGui<CAEnchantme
|
||||||
|
|
||||||
private boolean displayUnselected;
|
private boolean displayUnselected;
|
||||||
|
|
||||||
public EnchantSelectSettingGui(
|
public EnchantSelectSettingGui(@NotNull String title, ValueUpdatableGui parent, SelectEnchantmentContainer enchantContainer) {
|
||||||
@NotNull Message title, @NotNull String param,
|
super(title, parent instanceof Gui parentGui ? parentGui : MainConfigGui.getInstance()) ;
|
||||||
ValueUpdatableGui parent, SelectEnchantmentContainer enchantContainer) {
|
|
||||||
super(title, param, parent instanceof Gui parentGui ? parentGui : MainConfigGui.getInstance()) ;
|
|
||||||
this.enchantContainer = enchantContainer;
|
this.enchantContainer = enchantContainer;
|
||||||
|
|
||||||
this.selectedEnchant = new HashSet<>(enchantContainer.getSelectedEnchantments());
|
this.selectedEnchant = new HashSet<>(enchantContainer.getSelectedEnchantments());
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.SelectGroupContainer;
|
import xyz.alexcrea.cuanvil.gui.config.SelectGroupContainer;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.ElementListConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.ElementListConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
@ -35,10 +34,8 @@ public class GroupSelectSettingGui extends AbstractSettingGui {
|
||||||
|
|
||||||
Set<AbstractMaterialGroup> selectedGroups;
|
Set<AbstractMaterialGroup> selectedGroups;
|
||||||
|
|
||||||
public GroupSelectSettingGui(
|
public GroupSelectSettingGui(@NotNull String title, ValueUpdatableGui parent, SelectGroupContainer groupContainer, int page) {
|
||||||
@NotNull Message title, @NotNull String param,
|
super(6, title, parent);
|
||||||
ValueUpdatableGui parent, SelectGroupContainer groupContainer, int page) {
|
|
||||||
super(6, title.textHolder(param), parent);
|
|
||||||
this.groupContainer = groupContainer;
|
this.groupContainer = groupContainer;
|
||||||
//Not used but planned
|
//Not used but planned
|
||||||
this.page = page;
|
this.page = page;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ import xyz.alexcrea.cuanvil.gui.config.list.MappedElementListConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
|
||||||
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
|
||||||
import xyz.alexcrea.cuanvil.lang.Message;
|
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
import xyz.alexcrea.cuanvil.lang.MsgUI;
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
|
||||||
import xyz.alexcrea.cuanvil.util.MaterialUtil;
|
import xyz.alexcrea.cuanvil.util.MaterialUtil;
|
||||||
|
|
@ -39,10 +38,9 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Namespa
|
||||||
|
|
||||||
public MaterialSelectSettingGui(
|
public MaterialSelectSettingGui(
|
||||||
@NotNull SelectMaterialContainer selector,
|
@NotNull SelectMaterialContainer selector,
|
||||||
@NotNull Message title,
|
@NotNull String title,
|
||||||
@NotNull String param,
|
|
||||||
@NotNull Gui backGui) {
|
@NotNull Gui backGui) {
|
||||||
super(title, param);//TODO MESSAGE make param go down
|
super(title);
|
||||||
this.selector = selector;
|
this.selector = selector;
|
||||||
this.backGui = backGui;
|
this.backGui = backGui;
|
||||||
this.instantRemove = false;
|
this.instantRemove = false;
|
||||||
|
|
@ -239,8 +237,8 @@ public class MaterialSelectSettingGui extends MappedElementListConfigGui<Namespa
|
||||||
|
|
||||||
// Create and show confirm remove gui.
|
// Create and show confirm remove gui.
|
||||||
ConfirmActionGui confirmGui = new ConfirmActionGui(
|
ConfirmActionGui confirmGui = new ConfirmActionGui(
|
||||||
MsgUI.INSTANCE.getMATERIAL_SELECT_CONFIRM_TITLE(), materialName,
|
"Remove " + materialName,
|
||||||
MsgUI.INSTANCE.getMATERIAL_SELECT_CONFIRM_DESCRIPTION(), materialName.toLowerCase(),
|
"§7Confirm Remove " + materialName.toLowerCase() + " from this list.",
|
||||||
this, this,
|
this, this,
|
||||||
() -> {
|
() -> {
|
||||||
removeMaterial(material);
|
removeMaterial(material);
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ open class CustomAnvil : JavaPlugin() {
|
||||||
|
|
||||||
// Load language
|
// Load language
|
||||||
try {
|
try {
|
||||||
Lang.loadDefault()
|
Lang.reload()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logError("error occurred loading language file", e)
|
logError("error occurred loading language file", e)
|
||||||
if(tryDirtyStart()) return
|
if(tryDirtyStart()) return
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,10 @@ import xyz.alexcrea.cuanvil.enchant.CAEnchantment
|
||||||
import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe
|
import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe
|
||||||
import xyz.alexcrea.cuanvil.util.CasedStringUtil
|
import xyz.alexcrea.cuanvil.util.CasedStringUtil
|
||||||
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializeLegacy
|
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializeLegacy
|
||||||
|
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializePlain
|
||||||
import xyz.alexcrea.cuanvil.util.CustomRecipeUtil
|
import xyz.alexcrea.cuanvil.util.CustomRecipeUtil
|
||||||
import xyz.alexcrea.cuanvil.util.MaterialUtil.isAir
|
import xyz.alexcrea.cuanvil.util.MaterialUtil.isAir
|
||||||
|
import xyz.alexcrea.cuanvil.util.MiniMessageUtil
|
||||||
import xyz.alexcrea.cuanvil.util.UnitRepairUtil.getRepair
|
import xyz.alexcrea.cuanvil.util.UnitRepairUtil.getRepair
|
||||||
import xyz.alexcrea.cuanvil.util.anvil.AnvilColorUtil
|
import xyz.alexcrea.cuanvil.util.anvil.AnvilColorUtil
|
||||||
import xyz.alexcrea.cuanvil.util.anvil.AnvilLoreEditUtil
|
import xyz.alexcrea.cuanvil.util.anvil.AnvilLoreEditUtil
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,11 @@ import net.md_5.bungee.api.chat.hover.content.Text
|
||||||
import org.bukkit.command.Command
|
import org.bukkit.command.Command
|
||||||
import org.bukkit.command.CommandSender
|
import org.bukkit.command.CommandSender
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
import xyz.alexcrea.cuanvil.lang.Lang
|
|
||||||
import xyz.alexcrea.cuanvil.lang.Message
|
import xyz.alexcrea.cuanvil.lang.Message
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgCommand
|
import xyz.alexcrea.cuanvil.lang.MsgCommand
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgError
|
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgUI
|
|
||||||
import xyz.alexcrea.cuanvil.lang.MsgWarning
|
|
||||||
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializePlain
|
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializePlain
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
class DebugToggleExecutor: CASubCommand {
|
class DebugToggleExecutor : CASubCommand {
|
||||||
|
|
||||||
override fun description(): Message {
|
override fun description(): Message {
|
||||||
return MsgCommand.DEBUG_DESCRIPTION
|
return MsgCommand.DEBUG_DESCRIPTION
|
||||||
|
|
@ -56,10 +51,6 @@ class DebugToggleExecutor: CASubCommand {
|
||||||
MsgCommand.DEBUG_LOG_CLEARED.send(sender)
|
MsgCommand.DEBUG_LOG_CLEARED.send(sender)
|
||||||
}
|
}
|
||||||
|
|
||||||
"lang" -> {
|
|
||||||
executeLanguageDebug(sender, args)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
MsgCommand.SHARED_UNKNOWN_SUB_COMMAND.send(sender)
|
MsgCommand.SHARED_UNKNOWN_SUB_COMMAND.send(sender)
|
||||||
return false
|
return false
|
||||||
|
|
@ -115,142 +106,14 @@ class DebugToggleExecutor: CASubCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun executeLanguageDebug(sender: CommandSender, args: Array<out String>) {
|
|
||||||
if(args.size > 1 && "details".contentEquals(args[1], ignoreCase = true))
|
|
||||||
detailedLangDebug(sender)
|
|
||||||
else
|
|
||||||
simpleLangDebug(sender)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun simpleLangDebug(sender: CommandSender) {
|
|
||||||
var validCount = 0
|
|
||||||
// load key from all provider class
|
|
||||||
MsgCommand.DEBUG_DATA_HEADER
|
|
||||||
MsgUI.SHARED_CONFIG_NO_EDIT_PERM
|
|
||||||
MsgError.LOAD_LISTENERS
|
|
||||||
MsgWarning.ANVIL_GENERIC_EXCEPTION
|
|
||||||
|
|
||||||
val registeredKeys = Message.getValues()
|
|
||||||
|
|
||||||
for(message in registeredKeys)
|
|
||||||
if(Lang.has(message.key)) validCount++
|
|
||||||
|
|
||||||
val valid = (100.0 * validCount) / registeredKeys.size
|
|
||||||
sender.sendMessage("Translated (${Lang.currentLang()}): ${"%.1f".format(Locale.ROOT, valid)}% ($validCount/${registeredKeys.size})")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun detailedLangDebug(sender: CommandSender) {
|
|
||||||
simpleLangDebug(sender)
|
|
||||||
|
|
||||||
val stb = StringBuilder("Report of potential issue for language ${Lang.currentLang()}:\n")
|
|
||||||
|
|
||||||
var hadAny = false
|
|
||||||
val keySet = mutableSetOf<String>()
|
|
||||||
val registeredKeys = Message.getValues()
|
|
||||||
|
|
||||||
for(message in registeredKeys) {
|
|
||||||
val key = message.key
|
|
||||||
if(!Lang.has(key)) {
|
|
||||||
stb.append("Missing key inside translation file: $key\n")
|
|
||||||
hadAny = true
|
|
||||||
} else if(hashParamIssue(message, stb))
|
|
||||||
hadAny = true
|
|
||||||
|
|
||||||
if(keySet.contains(key)) {
|
|
||||||
stb.append("Duplicate registered key: $key\n")
|
|
||||||
hadAny = true
|
|
||||||
} else keySet.add(key)
|
|
||||||
}
|
|
||||||
|
|
||||||
for(key in Lang.getKeys()) {
|
|
||||||
if(!keySet.contains(key)) {
|
|
||||||
stb.append("Found unregistered key: $key\n")
|
|
||||||
hadAny = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hadAny) {
|
|
||||||
val message = TextComponent(MsgCommand.DEBUG_LANG_COPY.legacy())
|
|
||||||
|
|
||||||
message.clickEvent = ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, stb.toString())
|
|
||||||
message.hoverEvent = HoverEvent(
|
|
||||||
HoverEvent.Action.SHOW_TEXT,
|
|
||||||
Text(MsgCommand.SHARED_HOVER_COPY.legacy())
|
|
||||||
)
|
|
||||||
|
|
||||||
sender.spigot().sendMessage(message);
|
|
||||||
} else {
|
|
||||||
sender.sendMessage("No additional issue found")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun hashParamIssue(message: Message, stb: StringBuilder): Boolean {
|
|
||||||
val section = Lang.getSection(message.key)
|
|
||||||
val texts = if(section == null)
|
|
||||||
listOf(Lang.getTranslated(message.key))
|
|
||||||
else
|
|
||||||
section.getValues(false).map { it.value.toString() }
|
|
||||||
|
|
||||||
val textParams = ArrayList<String>()
|
|
||||||
|
|
||||||
for(text in texts) {
|
|
||||||
var index = 0
|
|
||||||
while(true) {
|
|
||||||
index = text.indexOf('%', index)
|
|
||||||
//TODO add \% to "ignore" % as param inside param finder
|
|
||||||
if(index > 0 && text[index-1] == '\\') {
|
|
||||||
index++
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if(index++ < 0) break
|
|
||||||
|
|
||||||
var end = text.indexOf(' ', index)
|
|
||||||
if(end == -1) end = text.length
|
|
||||||
val param = text.substring(index, end)
|
|
||||||
if(!textParams.contains(param)) textParams.add(param)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var hadIssue = false
|
|
||||||
// Check all parameter are valid
|
|
||||||
val usedParam = mutableSetOf<String>()
|
|
||||||
for(textParam in textParams) {
|
|
||||||
var found = false
|
|
||||||
for(param in message.params) {
|
|
||||||
if(param.isEmpty()) continue
|
|
||||||
if(textParam.startsWith(param)) {
|
|
||||||
found = true
|
|
||||||
usedParam.add(param)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!found) {
|
|
||||||
hadIssue = true
|
|
||||||
stb.append("Did not found param %$textParam in register list for ${message.key}\n")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(param in message.params) {
|
|
||||||
if(usedParam.contains(param)) continue
|
|
||||||
if("unused".contentEquals(param)) continue
|
|
||||||
hadIssue = true
|
|
||||||
stb.append("Param %$param is not used for key ${message.key}\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
return hadIssue
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun tabCompleter(sender: CommandSender, args: Array<out String>, list: MutableList<String>) {
|
override fun tabCompleter(sender: CommandSender, args: Array<out String>, list: MutableList<String>) {
|
||||||
if(!allowed(sender)) return
|
if(!allowed(sender)) return
|
||||||
|
|
||||||
list.addAll(
|
list.addAll(
|
||||||
when(args.size) {
|
when(args.size) {
|
||||||
1 -> listOf("toggle", "get", "get-and-clear", "clear", "lang")
|
1 -> listOf("toggle", "get", "get-and-clear", "clear")
|
||||||
2 -> when(args[0].lowercase()) {
|
2 -> when(args[0].lowercase()) {
|
||||||
"toggle" -> listOf("default", "verbose")
|
"toggle" -> listOf("default", "verbose")
|
||||||
"lang" -> listOf("details")
|
|
||||||
else -> listOf()
|
else -> listOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class ReloadExecutor : CASubCommand {
|
||||||
if(!ConfigHolder.reloadAllFromDisk(hardfail)) return false
|
if(!ConfigHolder.reloadAllFromDisk(hardfail)) return false
|
||||||
|
|
||||||
// reload language config
|
// reload language config
|
||||||
if(!Lang.reload()) return false
|
Lang.reload()
|
||||||
|
|
||||||
// Then update all global gui containing value from config
|
// Then update all global gui containing value from config
|
||||||
BasicConfigGui.getInstance()?.updateGuiValues()
|
BasicConfigGui.getInstance()?.updateGuiValues()
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package xyz.alexcrea.cuanvil.dependency
|
||||||
import io.delilaheve.CustomAnvil
|
import io.delilaheve.CustomAnvil
|
||||||
import net.kyori.adventure.text.Component
|
import net.kyori.adventure.text.Component
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
|
import org.bukkit.ChatColor
|
||||||
import org.bukkit.command.CommandSender
|
import org.bukkit.command.CommandSender
|
||||||
import org.bukkit.entity.HumanEntity
|
import org.bukkit.entity.HumanEntity
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
||||||
|
|
@ -31,6 +32,7 @@ import xyz.alexcrea.cuanvil.lang.MsgWarning
|
||||||
import xyz.alexcrea.cuanvil.listener.PrepareAnvilListener.Companion.ANVIL_OUTPUT_SLOT
|
import xyz.alexcrea.cuanvil.listener.PrepareAnvilListener.Companion.ANVIL_OUTPUT_SLOT
|
||||||
import xyz.alexcrea.cuanvil.util.MetricsUtil.trackError
|
import xyz.alexcrea.cuanvil.util.MetricsUtil.trackError
|
||||||
import java.lang.IllegalStateException
|
import java.lang.IllegalStateException
|
||||||
|
import java.util.logging.Level
|
||||||
|
|
||||||
@Suppress("UnstableApiUsage")
|
@Suppress("UnstableApiUsage")
|
||||||
object DependencyManager {
|
object DependencyManager {
|
||||||
|
|
@ -164,7 +166,7 @@ object DependencyManager {
|
||||||
trackError(e)
|
trackError(e)
|
||||||
|
|
||||||
// Finally, warn the player
|
// Finally, warn the player
|
||||||
MsgWarning.ANVIL_GENERIC_EXCEPTION.send(target)
|
MsgWarning.DEPENDENCY_GENERIC_EXCEPTION.send(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun logExceptionAndClear(view: AnvilView, e: Exception) {
|
private fun logExceptionAndClear(view: AnvilView, e: Exception) {
|
||||||
|
|
|
||||||
|
|
@ -3,30 +3,13 @@ package xyz.alexcrea.cuanvil.lang
|
||||||
import io.delilaheve.CustomAnvil
|
import io.delilaheve.CustomAnvil
|
||||||
import org.bukkit.configuration.ConfigurationSection
|
import org.bukkit.configuration.ConfigurationSection
|
||||||
import xyz.alexcrea.cuanvil.config.ConfigHolder
|
import xyz.alexcrea.cuanvil.config.ConfigHolder
|
||||||
import java.util.stream.Stream
|
|
||||||
|
|
||||||
object Lang {
|
object Lang {
|
||||||
|
|
||||||
private lateinit var default: Language
|
private val default = Language(DEFAULT_LANG, false)
|
||||||
private lateinit var lang: Language
|
private var lang = default
|
||||||
|
|
||||||
fun loadDefault() {
|
fun reload() {
|
||||||
default = Language(DEFAULT_LANG, false)
|
|
||||||
lang = default
|
|
||||||
reload()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun reload(): Boolean {
|
|
||||||
try {
|
|
||||||
unsafeReload()
|
|
||||||
return true
|
|
||||||
} catch(e: Exception) {
|
|
||||||
CustomAnvil.logError("Error loading language $langID", e, false)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun unsafeReload() {
|
|
||||||
val langID = langID
|
val langID = langID
|
||||||
if(lang.name == langID && lang != default)
|
if(lang.name == langID && lang != default)
|
||||||
lang.reload()
|
lang.reload()
|
||||||
|
|
@ -52,18 +35,6 @@ object Lang {
|
||||||
return default.getSection(key)
|
return default.getSection(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun currentLang(): String {
|
|
||||||
return lang.name
|
|
||||||
}
|
|
||||||
|
|
||||||
fun has(key: String): Boolean {
|
|
||||||
return lang.has(key)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getKeys(): Collection<String> {
|
|
||||||
return lang.getFilteredKeys()
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Config Options & get
|
* Config Options & get
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -55,45 +55,6 @@ class Language(private val id: String, private val default: Boolean = false) {
|
||||||
return conf.getConfigurationSection(key)
|
return conf.getConfigurationSection(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun has(key: String): Boolean {
|
|
||||||
if(conf.isString(key)) return true
|
|
||||||
|
|
||||||
// we want at all child key as valid numbers and valid key if claimed to be multi line
|
|
||||||
val section = getSection(key) ?: return false
|
|
||||||
for(key in section.getKeys(false)) {
|
|
||||||
if(key.toUIntOrNull() == null) return false
|
|
||||||
if(!section.isString(key)) return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getFilteredKeys(): Collection<String> {
|
|
||||||
val result = ArrayList<String>()
|
|
||||||
|
|
||||||
// First pass we ignore key from root
|
|
||||||
for(root in conf.getKeys(false)) {
|
|
||||||
val section = conf.getConfigurationSection(root) ?: continue
|
|
||||||
|
|
||||||
exploreDeeper(section, root, result)
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun exploreDeeper(section: ConfigurationSection, root: String, result: ArrayList<String>) {
|
|
||||||
for(key in section.getKeys(false)) {
|
|
||||||
val newRoot = "$root.$key"
|
|
||||||
if(has(key)) {
|
|
||||||
result.add(newRoot)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
val newSection = section.getConfigurationSection(key) ?: continue
|
|
||||||
exploreDeeper(newSection, newRoot, result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val name: String
|
val name: String
|
||||||
get() = conf.getString("name", id)!!
|
get() = conf.getString("name", id)!!
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package xyz.alexcrea.cuanvil.lang
|
package xyz.alexcrea.cuanvil.lang
|
||||||
|
|
||||||
import com.github.stefvanschie.inventoryframework.adventuresupport.ComponentHolder
|
|
||||||
import com.github.stefvanschie.inventoryframework.adventuresupport.TextHolder
|
|
||||||
import io.delilaheve.CustomAnvil
|
import io.delilaheve.CustomAnvil
|
||||||
import net.kyori.adventure.text.Component
|
import net.kyori.adventure.text.Component
|
||||||
import org.bukkit.command.CommandSender
|
import org.bukkit.command.CommandSender
|
||||||
|
|
@ -10,23 +8,10 @@ import xyz.alexcrea.cuanvil.util.ComponentUtil.send
|
||||||
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializeLegacy
|
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializeLegacy
|
||||||
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializePlain
|
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializePlain
|
||||||
import xyz.alexcrea.cuanvil.util.MiniMessageUtil
|
import xyz.alexcrea.cuanvil.util.MiniMessageUtil
|
||||||
import java.util.Collections
|
|
||||||
import java.util.logging.Level
|
import java.util.logging.Level
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
open class Message(val key: String, vararg val params: String, register: Boolean = true) {
|
open class Message(val key: String, vararg val params: String) {
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val values = ArrayList<Message>()
|
|
||||||
|
|
||||||
fun getValues(): Collection<Message> {
|
|
||||||
return Collections.unmodifiableCollection(values)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
if(register) values.add(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
protected fun replaceParameters(stb: StringBuilder, vararg values: Any) {
|
protected fun replaceParameters(stb: StringBuilder, vararg values: Any) {
|
||||||
// replace all placeholder thingy %key -> value
|
// replace all placeholder thingy %key -> value
|
||||||
|
|
@ -37,7 +22,6 @@ open class Message(val key: String, vararg val params: String, register: Boolean
|
||||||
for(i in 0 until min(params.size, values.size)) {
|
for(i in 0 until min(params.size, values.size)) {
|
||||||
val key = params[i]
|
val key = params[i]
|
||||||
val replacement = values[i].toString()
|
val replacement = values[i].toString()
|
||||||
if(replacement.isEmpty()) continue //May not be good but can be changed if cause an issue
|
|
||||||
|
|
||||||
var current = 0
|
var current = 0
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
@ -93,11 +77,9 @@ open class Message(val key: String, vararg val params: String, register: Boolean
|
||||||
result.add(MiniMessageUtil.mm.deserialize(stb.toString()))
|
result.add(MiniMessageUtil.mm.deserialize(stb.toString()))
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result.isEmpty()) return listOf(Component.text(key))
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// return a list of AT LEAST 1 element. calling first is safe
|
|
||||||
fun formatted(vararg params: Any): List<Component> {
|
fun formatted(vararg params: Any): List<Component> {
|
||||||
val section = Lang.getSection(key)
|
val section = Lang.getSection(key)
|
||||||
if(section != null) return formattedMultiline(section, *params)
|
if(section != null) return formattedMultiline(section, *params)
|
||||||
|
|
@ -107,21 +89,6 @@ open class Message(val key: String, vararg val params: String, register: Boolean
|
||||||
return listOf(MiniMessageUtil.mm.deserialize(translated))
|
return listOf(MiniMessageUtil.mm.deserialize(translated))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun formattedConcatenated(vararg params: Any): Component {
|
|
||||||
val formated = formatted(*params)
|
|
||||||
|
|
||||||
var result = formated.first()
|
|
||||||
for(i in 1 until formated.size) {
|
|
||||||
result = result.appendNewline().append(formated[i])
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
fun textHolder(vararg params: Any): TextHolder {
|
|
||||||
return ComponentHolder.of(formattedConcatenated(*params))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun legacy(vararg params: Any): String {
|
fun legacy(vararg params: Any): String {
|
||||||
val formated = formatted(*params)
|
val formated = formatted(*params)
|
||||||
|
|
||||||
|
|
|
||||||
4
src/main/kotlin/xyz/alexcrea/cuanvil/lang/Msg.kt
Normal file
4
src/main/kotlin/xyz/alexcrea/cuanvil/lang/Msg.kt
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
package xyz.alexcrea.cuanvil.lang
|
||||||
|
|
||||||
|
object Msg {
|
||||||
|
}
|
||||||
|
|
@ -20,7 +20,6 @@ object MsgCommand {
|
||||||
val DEBUG_LOG_CLEARED = Message("debug.log-cleared")
|
val DEBUG_LOG_CLEARED = Message("debug.log-cleared")
|
||||||
val DEBUG_TOGGLED = Message("debug.toggled", "type")
|
val DEBUG_TOGGLED = Message("debug.toggled", "type")
|
||||||
val DEBUG_COPY = Message("debug.copy")
|
val DEBUG_COPY = Message("debug.copy")
|
||||||
val DEBUG_LANG_COPY = Message("debug.copy-lang")
|
|
||||||
|
|
||||||
val DEBUG_DATA_HEADER = Message("debug.data.header")
|
val DEBUG_DATA_HEADER = Message("debug.data.header")
|
||||||
val DEBUG_DATA_LINE_COUNT = Message("debug.data.line-count", "count")
|
val DEBUG_DATA_LINE_COUNT = Message("debug.data.line-count", "count")
|
||||||
|
|
@ -46,8 +45,8 @@ object MsgCommand {
|
||||||
|
|
||||||
// Enchant
|
// Enchant
|
||||||
val ENCHANT_DESCRIPTION = Message("enchant.description")
|
val ENCHANT_DESCRIPTION = Message("enchant.description")
|
||||||
val ENCHANT_REMOVE = Message("enchant.removed", "name")
|
val ENCHANT_REMOVE = Message("enchant.remove.", "name")
|
||||||
val ENCHANT_SET = Message("enchant.set", "name", "level")
|
val ENCHANT_SET = Message("enchant.set.", "name", "level")
|
||||||
|
|
||||||
val ENCHANT_MISSING_PARAMETER_WARNING = Message("enchant.warning.missing_parameter")
|
val ENCHANT_MISSING_PARAMETER_WARNING = Message("enchant.warning.missing_parameter")
|
||||||
val ENCHANT_NOT_FOUND_WARNING = Message("enchant.warning.not_found", "path")
|
val ENCHANT_NOT_FOUND_WARNING = Message("enchant.warning.not_found", "path")
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,11 @@ object MsgError {
|
||||||
val LOAD_NON_DEFAULT_CONFIG = ErrorMessage("load.non-default-config")
|
val LOAD_NON_DEFAULT_CONFIG = ErrorMessage("load.non-default-config")
|
||||||
|
|
||||||
val RELOAD_FAIL = ErrorMessage("reload.resource.fail", "path")
|
val RELOAD_FAIL = ErrorMessage("reload.resource.fail", "path")
|
||||||
val RELOAD_HARD_FAIL = ErrorMessage("reload.resource.hard-fail")
|
val RELOAD_HARD_FAIL = ErrorMessage("reload.resource.hardfail")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ----
|
* ----------
|
||||||
* UI
|
* Commands
|
||||||
* ----
|
* ----------
|
||||||
*/
|
*/
|
||||||
val CONFIRM_ACTION_GENERIC = ErrorMessage("confirm-action.generic")
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,55 +5,17 @@ import xyz.alexcrea.cuanvil.lang.UIMessage as Message
|
||||||
object MsgUI {
|
object MsgUI {
|
||||||
|
|
||||||
val SHARED_CONFIG_NO_EDIT_PERM = Message("shared.no-permission")
|
val SHARED_CONFIG_NO_EDIT_PERM = Message("shared.no-permission")
|
||||||
val SHARED_TYPED_CONFIG_TITLE = Message("shared.typed-config-title", "type")
|
|
||||||
|
|
||||||
val CONFIRM_ACTION_FAILED = Message("confirm-action.fail")
|
val CONFIRM_ACTION_FAILED = Message("confirm-action.fail")
|
||||||
val CONFIRM_ACTION_ARE_YOU_SURE = Message("confirm-action.is-user-sure")
|
|
||||||
|
|
||||||
val SELECT_ITEM_TYPE_PLACE_HERE = Message("select-item-type.place-here")
|
|
||||||
|
|
||||||
val ELEMENT_LIST_INSTRUCTION_NEW = Message("element-list.instruction-new", "type")
|
val ELEMENT_LIST_INSTRUCTION_NEW = Message("element-list.instruction-new", "type")
|
||||||
val ELEMENT_LIST_CANCELLED_NEW = Message("element-list.cancelled-new", "type")
|
val ELEMENT_LIST_CANCELLED_NEW = Message("element-list.cancelled-new", "type")
|
||||||
val ELEMENT_LIST_DUPLICATED_NEW = Message("element-list.duplicated-new", "type")
|
val ELEMENT_LIST_DUPLICATED_NEW = Message("element-list.duplicated-new", "type")
|
||||||
|
|
||||||
val UNIT_REPAIR_TITLE = Message("unit-repair.title", "unused", "page", "max_page")
|
val UNIT_REPAIR_ELEMENT_TITLE = Message("unit-repair.element.title")
|
||||||
val UNIT_REPAIR_ELEMENT_TITLE = Message("unit-repair.element.title", "type", "page", "max_page")
|
val UNIT_REPAIR_ELEMENT_DESCRIPTION = Message("unit-repair.element.description")
|
||||||
val UNIT_REPAIR_NEW_TITLE = Message("unit-repair.new.title")
|
val UNIT_REPAIR_ELEMENT_CANNOT_REPAIR_NEW = Message("unit-repair.element.cannot-damage-new")
|
||||||
val UNIT_REPAIR_NEW_DESCRIPTION = Message("unit-repair.new.description")
|
val UNIT_REPAIR_ELEMENT_SAME_TYPE_NEW = Message("unit-repair.element.same-type-new")
|
||||||
|
|
||||||
val UNIT_REPAIR_NEW_ELEMENT_TITLE = Message("unit-repair.element.new.title", "unused")
|
|
||||||
val UNIT_REPAIR_NEW_ELEMENT_DESCRIPTION = Message("unit-repair.element.new.description", "name")
|
|
||||||
val UNIT_REPAIR_NEW_ELEMENT_CANNOT_REPAIR = Message("unit-repair.element.new.cannot-damage")
|
|
||||||
val UNIT_REPAIR_NEW_ELEMENT_SAME_TYPE = Message("unit-repair.element.new.same-type")
|
|
||||||
|
|
||||||
val CUSTOM_RECIPE_TITLE = Message("custom-recipe.title", "unused", "page", "max_page")
|
|
||||||
|
|
||||||
val CUSTOM_RECIPE_ELEMENT_DELETE_TITLE = Message("custom-recipe.element.delete.title", "type")
|
|
||||||
val CUSTOM_RECIPE_ELEMENT_DELETE_DESCRIPTION = Message("custom-recipe.element.delete.description", "unused")
|
|
||||||
|
|
||||||
val ENCHANTMENT_LEVEL_COST_TITLE = Message("enchant-level-cost.title", "unused", "page", "max_page")
|
|
||||||
|
|
||||||
val ENCHANTMENT_LEVEL_LIMIT_TITLE = Message("enchant-level-limit.title", "unused", "page", "max_page")
|
|
||||||
|
|
||||||
val ENCHANTMENT_MERGE_LIMIT_TITLE = Message("enchant-merge-limit.title", "unused", "page", "max_page")
|
|
||||||
|
|
||||||
val ENCHANTMENT_CONFLICT_TITLE = Message("enchant-conflict.title", "unused", "page", "max_page")
|
|
||||||
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")
|
|
||||||
|
|
||||||
val ENCHANTMENT_CONFLICT_ELEMENT_DELETE_TITLE = Message("enchant-conflict.element.delete.title", "type")
|
|
||||||
val ENCHANTMENT_CONFLICT_ELEMENT_DELETE_DESCRIPTION = Message("enchant-conflict.element.delete.description", "unused")
|
|
||||||
|
|
||||||
val MATERIAL_GROUP_TITLE = Message("material-group.title", "unused", "page", "max_page")
|
|
||||||
val MATERIAL_GROUP_ELEMENT_SELECTED_MATERIALS = Message("material-group.element.selected-materials", "group")
|
|
||||||
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")
|
|
||||||
val MATERIAL_GROUP_ELEMENT_DELETE_DESCRIPTION = Message("material-group.element.delete.description", "unused")
|
|
||||||
val MATERIAL_GROUP_ELEMENT_DELETE_BUTTON_NAME = Message("material-group.element.delete.button.name")
|
|
||||||
val MATERIAL_GROUP_ELEMENT_DELETE_BUTTON_LORE = Message("material-group.element.delete.button.lore")
|
|
||||||
|
|
||||||
val MATERIAL_SELECT_CONFIRM_TITLE = Message("material-select.new.confirm.title","name")
|
|
||||||
val MATERIAL_SELECT_CONFIRM_DESCRIPTION = Message("material-select.new.confirm.description","name")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,6 @@ object MsgWarning {
|
||||||
val LOAD_LEGACY_SPIGOT = Message("load.legacy.spigot")
|
val LOAD_LEGACY_SPIGOT = Message("load.legacy.spigot")
|
||||||
val LOAD_LEGACY_SPIGOT_OLD = Message("load.legacy.spigot-old")
|
val LOAD_LEGACY_SPIGOT_OLD = Message("load.legacy.spigot-old")
|
||||||
|
|
||||||
val ANVIL_GENERIC_EXCEPTION = Message("anvil.generic")
|
val DEPENDENCY_GENERIC_EXCEPTION = Message("config-ui.shared.no-permission")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -33,6 +33,7 @@ import xyz.alexcrea.cuanvil.listener.PrepareAnvilListener.Companion.ANVIL_OUTPUT
|
||||||
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializePlain
|
import xyz.alexcrea.cuanvil.util.ComponentUtil.serializePlain
|
||||||
import xyz.alexcrea.cuanvil.util.CustomRecipeUtil
|
import xyz.alexcrea.cuanvil.util.CustomRecipeUtil
|
||||||
import xyz.alexcrea.cuanvil.util.MaterialUtil.isAir
|
import xyz.alexcrea.cuanvil.util.MaterialUtil.isAir
|
||||||
|
import xyz.alexcrea.cuanvil.util.MiniMessageUtil
|
||||||
import xyz.alexcrea.cuanvil.util.anvil.AnvilLoreEditUtil
|
import xyz.alexcrea.cuanvil.util.anvil.AnvilLoreEditUtil
|
||||||
import xyz.alexcrea.cuanvil.util.anvil.AnvilXpUtil
|
import xyz.alexcrea.cuanvil.util.anvil.AnvilXpUtil
|
||||||
import xyz.alexcrea.cuanvil.util.config.LoreEditConfigUtil
|
import xyz.alexcrea.cuanvil.util.config.LoreEditConfigUtil
|
||||||
|
|
|
||||||
|
|
@ -2,30 +2,10 @@ package xyz.alexcrea.cuanvil.util
|
||||||
|
|
||||||
import net.kyori.adventure.text.Component
|
import net.kyori.adventure.text.Component
|
||||||
import org.bukkit.command.CommandSender
|
import org.bukkit.command.CommandSender
|
||||||
import org.bukkit.inventory.meta.ItemMeta
|
|
||||||
import xyz.alexcrea.cuanvil.dependency.util.PlatformUtil.sendPaperMessage
|
import xyz.alexcrea.cuanvil.dependency.util.PlatformUtil.sendPaperMessage
|
||||||
import xyz.alexcrea.cuanvil.dependency.util.PlatformUtil.setComponentDisplayName
|
|
||||||
import xyz.alexcrea.cuanvil.dependency.util.PlatformUtil.setPaperLore
|
|
||||||
import xyz.alexcrea.cuanvil.lang.Message
|
|
||||||
|
|
||||||
object ComponentUtil {
|
object ComponentUtil {
|
||||||
|
|
||||||
fun Component.serializeMM(): String {
|
|
||||||
return MiniMessageUtil.mm.serialize(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Component.serializeMMColor(): String {
|
|
||||||
return MiniMessageUtil.color_only_mm.serialize(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Component.serializeLegacy(): String {
|
|
||||||
return MiniMessageUtil.legacy_mm.serialize(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Component.serializePlain(): String {
|
|
||||||
return MiniMessageUtil.plain_text_mm.serialize(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Component.send(destination: CommandSender) {
|
fun Component.send(destination: CommandSender) {
|
||||||
if(!destination.sendPaperMessage(this))
|
if(!destination.sendPaperMessage(this))
|
||||||
destination.sendMessage(this.serializeLegacy())
|
destination.sendMessage(this.serializeLegacy())
|
||||||
|
|
@ -36,13 +16,18 @@ object ComponentUtil {
|
||||||
component.send(destination)
|
component.send(destination)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun List<Component>.applyLore(meta: ItemMeta) {
|
fun Component.serializeMM(): String {
|
||||||
if(!meta.setPaperLore(this))
|
return MiniMessageUtil.mm.serialize(this)
|
||||||
meta.lore = this.map {obj -> obj.serializeLegacy()}
|
}
|
||||||
|
fun Component.serializeMMColor(): String {
|
||||||
|
return MiniMessageUtil.color_only_mm.serialize(this)
|
||||||
|
}
|
||||||
|
fun Component.serializeLegacy(): String {
|
||||||
|
return MiniMessageUtil.legacy_mm.serialize(this)
|
||||||
|
}
|
||||||
|
fun Component.serializePlain(): String {
|
||||||
|
return MiniMessageUtil.plain_text_mm.serialize(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ItemMeta.setMessageName(message: Message, vararg params: Any) {
|
|
||||||
this.setComponentDisplayName(message.formattedConcatenated(*params))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -14,8 +14,6 @@ warning:
|
||||||
1: "If replace too expensive is not working this is likely because of spigot"
|
1: "If replace too expensive is not working this is likely because of spigot"
|
||||||
2: "As native nms is not supported for spigot starting 26.1"
|
2: "As native nms is not supported for spigot starting 26.1"
|
||||||
update.available: "An update may be available: %version"
|
update.available: "An update may be available: %version"
|
||||||
anvil:
|
|
||||||
generic: "<white>[<yellow>CustomAnvil<white>] <red>Error while handling the anvil."
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
load:
|
load:
|
||||||
|
|
@ -26,15 +24,11 @@ error:
|
||||||
listeners: "error registering listeners"
|
listeners: "error registering listeners"
|
||||||
enchant-system: "error initializing enchantment system"
|
enchant-system: "error initializing enchantment system"
|
||||||
non-default-config: "Plugin has an issue while trying to load non default config... exiting..."
|
non-default-config: "Plugin has an issue while trying to load non default config... exiting..."
|
||||||
|
|
||||||
reload:
|
reload:
|
||||||
resource:
|
resource:
|
||||||
fail: "Resource %path Could not be loaded or reloaded."
|
fail: "Resource %path Could not be loaded or reloaded."
|
||||||
hard-fail: "Disabling plugin."
|
hard-fail: "Disabling plugin."
|
||||||
|
|
||||||
confirm-action:
|
|
||||||
generic: "Could not process confirmation supplier."
|
|
||||||
|
|
||||||
command:
|
command:
|
||||||
shared:
|
shared:
|
||||||
no-diag-permission: "<red>You do not have permission to diagnostic this server"
|
no-diag-permission: "<red>You do not have permission to diagnostic this server"
|
||||||
|
|
@ -43,19 +37,16 @@ command:
|
||||||
no-permission: "No permission to execute this command"
|
no-permission: "No permission to execute this command"
|
||||||
warning:
|
warning:
|
||||||
missing-subcmd: "Need to specify a subcommand. for example %example1 or %example2"
|
missing-subcmd: "Need to specify a subcommand. for example %example1 or %example2"
|
||||||
|
|
||||||
root:
|
root:
|
||||||
warning:
|
warning:
|
||||||
unknown-sub: "<red>Invalid subcommand. run <yellow>`%command help` <red>to see available commands"
|
unknown-sub: "<red>Invalid subcommand. run <yellow>`%command help` <red>to see available commands"
|
||||||
error:
|
error:
|
||||||
generic: "<red>Error running this command"
|
generic: "<red>Error running this command"
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
description: "Used to toggle debug logs and retrieve them"
|
description: "Used to toggle debug logs and retrieve them"
|
||||||
log-cleared: "Log Cleared"
|
log-cleared: "Log Cleared"
|
||||||
toggled: "Debug toggled to %type"
|
toggled: "Debug toggled to %type"
|
||||||
copy: "<green>Click to copy log data"
|
copy: "<green>Click to copy log data"
|
||||||
copy-lang: "<green>Click to copy detailed lang issues"
|
|
||||||
data:
|
data:
|
||||||
header: "Debug Log data:"
|
header: "Debug Log data:"
|
||||||
line-count: "Found %count lines"
|
line-count: "Found %count lines"
|
||||||
|
|
@ -63,12 +54,10 @@ command:
|
||||||
unspecified-type: "Need to specify which type of debug to toggle: \"default\" or \"verbose\""
|
unspecified-type: "Need to specify which type of debug to toggle: \"default\" or \"verbose\""
|
||||||
invalid-type: "Invalid debug type \"%type\""
|
invalid-type: "Invalid debug type \"%type\""
|
||||||
no-log: "No log to show ? make sure you tried with debug log toggled (%command)"
|
no-log: "No log to show ? make sure you tried with debug log toggled (%command)"
|
||||||
|
|
||||||
diagnostic:
|
diagnostic:
|
||||||
description: "Basic diagnostic of this plugin"
|
description: "Basic diagnostic of this plugin"
|
||||||
had-error: "<red>There was an error running the diagnostic"
|
had-error: "<red>There was an error running the diagnostic"
|
||||||
copy: "<green>Click to copy diagnostic data"
|
copy: "<green>Click to copy diagnostic data"
|
||||||
|
|
||||||
config:
|
config:
|
||||||
description: "Used to edit the configuration of the plugin"
|
description: "Used to edit the configuration of the plugin"
|
||||||
folia-issue:
|
folia-issue:
|
||||||
|
|
@ -83,7 +72,6 @@ command:
|
||||||
warning:
|
warning:
|
||||||
legacy-name: "<red>/ca gui has been moved to /ca config"
|
legacy-name: "<red>/ca gui has been moved to /ca config"
|
||||||
cannot_configure: "Cannot configure the item in hand"
|
cannot_configure: "Cannot configure the item in hand"
|
||||||
|
|
||||||
enchant:
|
enchant:
|
||||||
description: "Allows to set enchantment to holden item"
|
description: "Allows to set enchantment to holden item"
|
||||||
warning:
|
warning:
|
||||||
|
|
@ -93,11 +81,9 @@ command:
|
||||||
cannot_enchant: "Cannot enchant this item"
|
cannot_enchant: "Cannot enchant this item"
|
||||||
removed: "%name removed"
|
removed: "%name removed"
|
||||||
set: "%name set to level %level"
|
set: "%name set to level %level"
|
||||||
|
|
||||||
help:
|
help:
|
||||||
description: "Help command"
|
description: "Help command"
|
||||||
header: "List of available commands:"
|
header: "List of available commands:"
|
||||||
|
|
||||||
reload:
|
reload:
|
||||||
description: "Reload the configuration of this plugin"
|
description: "Reload the configuration of this plugin"
|
||||||
start: "<yellow>Reloading config..."
|
start: "<yellow>Reloading config..."
|
||||||
|
|
@ -108,78 +94,19 @@ command:
|
||||||
config-ui:
|
config-ui:
|
||||||
shared:
|
shared:
|
||||||
no-permission: "<red>You do not have permission to edit the config"
|
no-permission: "<red>You do not have permission to edit the config"
|
||||||
typed-config-title: "<yellow>%type <white>Config"
|
|
||||||
|
|
||||||
confirm-action:
|
confirm-action:
|
||||||
fail: "<red>Action could not be completed."
|
fail: "<red>Action could not be completed."
|
||||||
is-user-sure: "<yellow>Are you sure ?"
|
|
||||||
|
|
||||||
select-item-type:
|
|
||||||
place-here: "<yellow>Place an item here"
|
|
||||||
|
|
||||||
element-list:
|
element-list:
|
||||||
instruction-new:
|
instruction-new:
|
||||||
1: "<yellow>Write the %type name you want to create in the chat."
|
1: "<yellow>Write the %type name you want to create in the chat."
|
||||||
2: "<yellow>Or write <red>cancel <yellow>to go back to %type config menu"
|
2: "<yellow>Or write <red>cancel <yellow>to go back to %type config menu"
|
||||||
cancelled-new: "%type creation cancelled..."
|
cancelled-new: "%type creation cancelled..."
|
||||||
duplicated-new: "<red>Please enter a %type name that do not already exist..."
|
duplicated-new: "<red>Please enter a %type name that do not already exist..."
|
||||||
|
|
||||||
unit-repair:
|
unit-repair:
|
||||||
title: "Unit Repair Config <reset>(%page/%max_page)"
|
element:
|
||||||
new:
|
title: "Select item to be repaired."
|
||||||
title: "Select unit repair item."
|
|
||||||
description:
|
description:
|
||||||
1: "<gray>Click here with an item to set the item"
|
1: "<gray>Click here with an item to set the item"
|
||||||
2: "<gray>You like to be an unit repair item"
|
2: "<gray>You like to be repaired by %name"
|
||||||
element:
|
cannot-damage-new: "<red>This item can't be damaged, so it can't be repaired."
|
||||||
title: "<yellow>%type <red>Unit repair <reset>(%page/%max_page)"
|
same-type-new: "<red>Item can't repair something of the same type."
|
||||||
new:
|
|
||||||
title: "Select item to be repaired."
|
|
||||||
description:
|
|
||||||
1: "<gray>Click here with an item to set the item"
|
|
||||||
2: "<gray>You like to be repaired by %name"
|
|
||||||
cannot-damage: "<red>This item can't be damaged, so it can't be repaired."
|
|
||||||
same-type: "<red>Item can't repair something of the same type."
|
|
||||||
|
|
||||||
custom-recipe:
|
|
||||||
title: "Custom Recipe Config <reset>(%page/%max_page)"
|
|
||||||
element:
|
|
||||||
delete:
|
|
||||||
title: "<red>Delete <yellow>%type<red>?"
|
|
||||||
description: "<gray>Confirm that you want to delete this recipe."
|
|
||||||
|
|
||||||
enchant-level-cost:
|
|
||||||
title: "<dark_gray>Enchantment Level Limit <reset>(%page/%max_page)"
|
|
||||||
|
|
||||||
enchant-level-limit:
|
|
||||||
title: "<dark_gray>Enchantment Level Limit <reset>(%page/%max_page)"
|
|
||||||
|
|
||||||
enchant-merge-limit:
|
|
||||||
title: "<dark_gray>Enchantment Maximum Merge Level <reset>(%page/%max_page)"
|
|
||||||
|
|
||||||
enchant-conflict:
|
|
||||||
title: "Conflict Config <reset>(%page/%max_page)"
|
|
||||||
element:
|
|
||||||
selected-enchantments: "<yellow>%group<dark_purple>" # likely need page and max page
|
|
||||||
selected-sub-groups: "<yellow>%group <red>Groups"
|
|
||||||
delete:
|
|
||||||
title: "<red>Delete <yellow>%type<red>?"
|
|
||||||
description: "<gray>Confirm that you want to delete this conflict."
|
|
||||||
|
|
||||||
material-group:
|
|
||||||
title: "Group Config <reset>(%page/%max_page)"
|
|
||||||
element:
|
|
||||||
selected-materials: "<yellow>%group <red>Materials"
|
|
||||||
selected-sub-groups: "<yellow>%group <red>Groups"
|
|
||||||
delete:
|
|
||||||
title: "<red>Delete <yellow>%type<red>?"
|
|
||||||
description: "<gray>Confirm that you want to delete this group."
|
|
||||||
button:
|
|
||||||
name: "<dark_red>DELETE GROUP"
|
|
||||||
lore: "<red>Caution with this button !"
|
|
||||||
|
|
||||||
material-select:
|
|
||||||
new:
|
|
||||||
confirm:
|
|
||||||
title: "Remove %name"
|
|
||||||
description: "<dark_gray>Confirm Remove %name from this list."
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue