Moved some class. Abstracted gui list elements.

This commit is contained in:
alexcrea 2024-04-08 21:39:45 +02:00
parent 57cd58657d
commit 479bd03e83
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
16 changed files with 79 additions and 65 deletions

View file

@ -1,4 +1,4 @@
package xyz.alexcrea.cuanvil.gui.config.global;
package xyz.alexcrea.cuanvil.gui.config;
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
import com.github.stefvanschie.inventoryframework.gui.type.ChestGui;
@ -8,6 +8,7 @@ import io.delilaheve.CustomAnvil;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import xyz.alexcrea.cuanvil.gui.config.global.*;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;

View file

@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import xyz.alexcrea.cuanvil.config.ConfigHolder;
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
import xyz.alexcrea.cuanvil.gui.config.settings.BoolSettingsGui;
import xyz.alexcrea.cuanvil.gui.config.settings.IntSettingsGui;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;

View file

@ -6,6 +6,7 @@ import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import xyz.alexcrea.cuanvil.config.ConfigHolder;
import xyz.alexcrea.cuanvil.gui.config.list.MappedElementListConfigGui;
import xyz.alexcrea.cuanvil.gui.config.settings.subsetting.CustomRecipeSubSettingGui;
import xyz.alexcrea.cuanvil.recipe.AnvilCustomRecipe;
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
@ -41,7 +42,7 @@ public class CustomRecipeConfigGui extends MappedElementListConfigGui<AnvilCusto
// edit displayed item
ItemMeta meta = displaydItem.getItemMeta();
meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(recipe.getName()) + " \u00A7fCustom recipe");
meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(recipe.toString()) + " \u00A7fCustom recipe");
meta.addItemFlags(ItemFlag.values());
boolean shouldWork = recipe.validate();

View file

@ -7,6 +7,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import xyz.alexcrea.cuanvil.config.ConfigHolder;
import xyz.alexcrea.cuanvil.group.EnchantConflictGroup;
import xyz.alexcrea.cuanvil.group.IncludeGroup;
import xyz.alexcrea.cuanvil.gui.config.list.MappedElementListConfigGui;
import xyz.alexcrea.cuanvil.gui.config.settings.subsetting.EnchantConflictSubSettingGui;
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
import xyz.alexcrea.cuanvil.util.CasedStringUtil;
@ -57,7 +58,7 @@ public class EnchantConflictGui extends MappedElementListConfigGui<EnchantConfli
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(conflict.getName()) + " \u00A7fConflict");
meta.setDisplayName("\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(conflict.toString()) + " \u00A7fConflict");
meta.setLore(Arrays.asList(
"\u00A77Enchantment count: \u00A7e" + conflict.getEnchants().size(),
"\u00A77Group count: \u00A7e" + conflict.getCantConflictGroup().getGroups().size(),

View file

@ -1,4 +1,4 @@
package xyz.alexcrea.cuanvil.gui.config.global;
package xyz.alexcrea.cuanvil.gui.config.list;
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
import com.github.stefvanschie.inventoryframework.pane.Orientable;
@ -14,6 +14,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalItems;
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant;
@ -22,11 +23,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.UUID;
public abstract class ElementListGlobalConfigGui< T > extends ValueUpdatableGui {
public abstract class ElementListConfigGui< T > extends ValueUpdatableGui {
private final String namePrefix;
public ElementListGlobalConfigGui(@NotNull String title) {
public ElementListConfigGui(@NotNull String title) {
super(6, title, CustomAnvil.instance);
this.namePrefix = title;
}

View file

@ -0,0 +1,16 @@
package xyz.alexcrea.cuanvil.gui.config.list;
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
import com.github.stefvanschie.inventoryframework.gui.type.util.Gui;
public interface ElementMappedToListGui {
GuiItem getParentItemForThisGui();
void updateLocal();
void cleanUnused();
Gui getMappedGui();
}

View file

@ -1,4 +1,4 @@
package xyz.alexcrea.cuanvil.gui.config.global;
package xyz.alexcrea.cuanvil.gui.config.list;
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
import io.delilaheve.CustomAnvil;
@ -7,9 +7,7 @@ import org.bukkit.entity.HumanEntity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;
import xyz.alexcrea.cuanvil.gui.config.settings.subsetting.MappedToListSubSettingGui;
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions;
import xyz.alexcrea.cuanvil.interfaces.Named;
import java.util.Arrays;
import java.util.HashMap;
@ -17,7 +15,7 @@ import java.util.Locale;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
public abstract class MappedElementListConfigGui< T extends Named, S extends MappedToListSubSettingGui> extends ElementListGlobalConfigGui< T > {
public abstract class MappedElementListConfigGui< T, S extends ElementMappedToListGui> extends ElementListConfigGui< T > {
protected final HashMap<T, S> elementGuiMap;
@ -72,34 +70,34 @@ public abstract class MappedElementListConfigGui< T extends Named, S extends Map
@Override
protected void updateGeneric(T generic, ItemStack usedItem) {
S gui = this.elementGuiMap.get(generic);
S mapElement = this.elementGuiMap.get(generic);
GuiItem guiItem;
if (gui == null) {
// Create new sub setting gui
if (mapElement == null) {
// Create new sub setting mapElement
guiItem = new GuiItem(usedItem, CustomAnvil.instance);
gui = newInstanceOfGui(generic, guiItem);
mapElement = newInstanceOfGui(generic, guiItem);
guiItem.setAction(GuiGlobalActions.openGuiAction(gui));
guiItem.setAction(GuiGlobalActions.openGuiAction(mapElement.getMappedGui()));
this.elementGuiMap.put(generic, gui);
this.elementGuiMap.put(generic, mapElement);
addToPage(guiItem);
} else {
// Replace item with the updated one
guiItem = gui.getParentItemForThisGui();
guiItem = mapElement.getParentItemForThisGui();
guiItem.setItem(usedItem);
}
gui.updateLocal();
mapElement.updateLocal();
}
@Override
protected GuiItem findGuiItemForRemoval(T generic) {
S gui = this.elementGuiMap.get(generic);
if (gui == null) return null;
S mapElement = this.elementGuiMap.get(generic);
if (mapElement == null) return null;
this.elementGuiMap.remove(generic);
return gui.getParentItemForThisGui();
return mapElement.getParentItemForThisGui();
}
protected Consumer<String> prepareCreateItemConsumer(HumanEntity player){
@ -125,7 +123,7 @@ public abstract class MappedElementListConfigGui< T extends Named, S extends Map
// Try to find if it already exists in a for loop
// Not the most efficient on large number of conflict, but it should not run often.
for (T generic : getEveryDisplayableInstanceOfGeneric()) {
if (generic.getName().equalsIgnoreCase(message)) {
if (generic.toString().equalsIgnoreCase(message)) {
player.sendMessage("\u00A7cPlease enter a "+genericDisplayedName()+" name that do not already exist...");
// wait next message.
CustomAnvil.Companion.getChatListener().setListenedCallback(player, selfRef.get());
@ -138,7 +136,7 @@ public abstract class MappedElementListConfigGui< T extends Named, S extends Map
updateValueForGeneric(generic, true);
// show the new conflict config to the player
this.elementGuiMap.get(generic).show(player);
this.elementGuiMap.get(generic).getMappedGui().show(player);
update();
};

View file

@ -37,7 +37,7 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
@NotNull CustomRecipeConfigGui parent,
@NotNull AnvilCustomRecipe anvilRecipe,
@NotNull GuiItem parentItemForThisGui) {
super(parentItemForThisGui, 3, "\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(anvilRecipe.getName()) + " \u00A78Config");
super(parentItemForThisGui, 3, "\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(anvilRecipe.toString()) + " \u00A78Config");
this.parent = parent;
this.anvilRecipe = anvilRecipe;
@ -77,24 +77,24 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
IntRange costRange = AnvilCustomRecipe.Companion.getXP_COST_CONFIG_RANGE();
this.exactCountFactory = BoolSettingsGui.boolFactory("\u00A78Exact count ?", this,
this.anvilRecipe.getName()+"."+AnvilCustomRecipe.EXACT_COUNT_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
this.anvilRecipe + "." + AnvilCustomRecipe.EXACT_COUNT_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
AnvilCustomRecipe.Companion.getDEFAULT_EXACT_COUNT_CONFIG());
this.xpCostFactory = IntSettingsGui.intFactory("\u00A78Recipe Xp Cost", this,
this.anvilRecipe.getName()+"."+AnvilCustomRecipe.XP_COST_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
this.anvilRecipe +"."+AnvilCustomRecipe.XP_COST_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
costRange.getFirst(), costRange.getLast(), AnvilCustomRecipe.Companion.getDEFAULT_XP_COST_CONFIG(), 1, 5, 10);
this.leftItemFactory = ItemSettingGui.itemFactory("\u00A7eRecipe Left \u00A78Item", this,
this.anvilRecipe.getName()+"."+AnvilCustomRecipe.LEFT_ITEM_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
this.anvilRecipe + "." + AnvilCustomRecipe.LEFT_ITEM_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
AnvilCustomRecipe.Companion.getDEFAULT_LEFT_ITEM_CONFIG());
this.rightItemFactory = ItemSettingGui.itemFactory("\u00A7eRecipe Right \u00A78Item", this,
this.anvilRecipe.getName()+"."+AnvilCustomRecipe.RIGHT_ITEM_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
this.anvilRecipe + "." + AnvilCustomRecipe.RIGHT_ITEM_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
AnvilCustomRecipe.Companion.getDEFAULT_RIGHT_ITEM_CONFIG());
this.resultItemFactory = ItemSettingGui.itemFactory("\u00A7aRecipe Result \u00A78Item", this,
this.anvilRecipe.getName()+"."+AnvilCustomRecipe.RESULT_ITEM_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
this.anvilRecipe + "." + AnvilCustomRecipe.RESULT_ITEM_CONFIG, ConfigHolder.CUSTOM_RECIPE_HOLDER,
AnvilCustomRecipe.Companion.getDEFAULT_RESULT_ITEM_CONFIG());
}
@ -112,7 +112,7 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
cleanUnused();
// Update config file storage
ConfigHolder.CUSTOM_RECIPE_HOLDER.getConfig().set(this.anvilRecipe.getName(), null);
ConfigHolder.CUSTOM_RECIPE_HOLDER.getConfig().set(this.anvilRecipe.toString(), null);
// Save
boolean success = true;
@ -123,7 +123,7 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
return success;
};
return new ConfirmActionGui("\u00A7cDelete \u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(this.anvilRecipe.getName()) + "\u00A7c?",
return new ConfirmActionGui("\u00A7cDelete \u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(this.anvilRecipe.toString()) + "\u00A7c?",
"\u00A77Confirm that you want to delete this conflict.",
this, this.parent, deleteSupplier
);

View file

@ -46,7 +46,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
@NotNull GuiItem parentItemForThisGui) {
super(parentItemForThisGui,
3,
"\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(enchantConflict.getName()) + " \u00A78Config");
"\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(enchantConflict.toString()) + " \u00A78Config");
this.parent = parent;
this.enchantConflict = enchantConflict;
@ -85,7 +85,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
this.enchantSettingItem = new GuiItem(new ItemStack(Material.ENCHANTED_BOOK), (event) -> {
event.setCancelled(true);
EnchantSelectSettingGui enchantGui = new EnchantSelectSettingGui(
"\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(enchantConflict.getName()) + " \u00A75Enchantments",
"\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(enchantConflict.toString()) + " \u00A75Enchantments",
this, this, 0);
enchantGui.show(event.getWhoClicked());
}, CustomAnvil.instance);
@ -93,14 +93,14 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
this.groupSettingItem = new GuiItem(new ItemStack(Material.PAPER), (event) -> {
event.setCancelled(true);
GroupSelectSettingGui enchantGui = new GroupSelectSettingGui(
"\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(this.enchantConflict.getName()) + " \u00A73Groups",
"\u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(this.enchantConflict.toString()) + " \u00A73Groups",
this, this, 0);
enchantGui.show(event.getWhoClicked());
}, CustomAnvil.instance);
this.minBeforeActiveSettingFactory = IntSettingsGui.intFactory(
"\u00A78Minimum enchantment count",
this, this.enchantConflict.getName() + ".maxEnchantmentBeforeConflict", ConfigHolder.CONFLICT_HOLDER,
this, this.enchantConflict + ".maxEnchantmentBeforeConflict", ConfigHolder.CONFLICT_HOLDER,
0, 255, 0, 1
);
@ -129,7 +129,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
cleanUnused();
// Update config file storage
ConfigHolder.CONFLICT_HOLDER.getConfig().set(this.enchantConflict.getName(), null);
ConfigHolder.CONFLICT_HOLDER.getConfig().set(this.enchantConflict.toString(), null);
// Save
boolean success = true;
@ -140,7 +140,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
return success;
};
return new ConfirmActionGui("\u00A7cDelete \u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(this.enchantConflict.getName()) + "\u00A7c?",
return new ConfirmActionGui("\u00A7cDelete \u00A7e" + CasedStringUtil.snakeToUpperSpacedCase(this.enchantConflict.toString()) + "\u00A7c?",
"\u00A77Confirm that you want to delete this conflict.",
this, this.parent, deleteSupplier
);
@ -149,7 +149,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
@Override
public void updateGuiValues() {
// update value from config to conflict
int minBeforeBlock = ConfigHolder.CONFLICT_HOLDER.getConfig().getInt(this.enchantConflict.getName()+'.'+EnchantConflictManager.ENCH_MAX_PATH, 0);
int minBeforeBlock = ConfigHolder.CONFLICT_HOLDER.getConfig().getInt(this.enchantConflict.toString()+'.'+EnchantConflictManager.ENCH_MAX_PATH, 0);
this.enchantConflict.setMinBeforeBlock(minBeforeBlock);
// Parent should call updateLocal with this call
@ -267,7 +267,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
@Override
public boolean setSelectedEnchantments(Set<Enchantment> enchantments) {
if (!this.shouldWork) {
CustomAnvil.instance.getLogger().info("Trying to save " + enchantConflict.getName() + " enchants but sub config is destroyed");
CustomAnvil.instance.getLogger().info("Trying to save " + enchantConflict + " enchants but sub config is destroyed");
return false;
}
@ -280,12 +280,12 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
for (Enchantment enchantment : enchantments) {
enchantKeys[index++] = enchantment.getKey().getKey();
}
ConfigHolder.CONFLICT_HOLDER.getConfig().set(enchantConflict.getName() + ".enchantments", enchantKeys);
ConfigHolder.CONFLICT_HOLDER.getConfig().set(enchantConflict + ".enchantments", enchantKeys);
try {
updateGuiValues();
} catch (Exception e) {
CustomAnvil.instance.getLogger().log(Level.WARNING, "An error occurred while updating enchants for " + this.enchantConflict.getName(), e);
CustomAnvil.instance.getLogger().log(Level.WARNING, "An error occurred while updating enchants for " + this.enchantConflict, e);
}
@ -312,7 +312,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
@Override
public boolean setSelectedGroups(Set<AbstractMaterialGroup> groups) {
if (!this.shouldWork) {
CustomAnvil.instance.getLogger().info("Trying to save " + enchantConflict.getName() + " groups but sub config is destroyed");
CustomAnvil.instance.getLogger().info("Trying to save " + enchantConflict.toString() + " groups but sub config is destroyed");
return false;
}
@ -325,12 +325,12 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
for (AbstractMaterialGroup group : groups) {
groupsNames[index++] = group.getName();
}
ConfigHolder.CONFLICT_HOLDER.getConfig().set(this.enchantConflict.getName() + ".notAffectedGroups", groupsNames);
ConfigHolder.CONFLICT_HOLDER.getConfig().set(this.enchantConflict + ".notAffectedGroups", groupsNames);
try {
updateGuiValues();
} catch (Exception e) {
CustomAnvil.instance.getLogger().log(Level.WARNING, "An error occurred while updating group for " + this.enchantConflict.getName(), e);
CustomAnvil.instance.getLogger().log(Level.WARNING, "An error occurred while updating group for " + this.enchantConflict, e);
}
// Save file configuration to disk

View file

@ -1,11 +1,13 @@
package xyz.alexcrea.cuanvil.gui.config.settings.subsetting;
import com.github.stefvanschie.inventoryframework.gui.GuiItem;
import com.github.stefvanschie.inventoryframework.gui.type.util.Gui;
import io.delilaheve.CustomAnvil;
import org.jetbrains.annotations.NotNull;
import xyz.alexcrea.cuanvil.gui.ValueUpdatableGui;
import xyz.alexcrea.cuanvil.gui.config.list.ElementMappedToListGui;
public abstract class MappedToListSubSettingGui extends ValueUpdatableGui {
public abstract class MappedToListSubSettingGui extends ValueUpdatableGui implements ElementMappedToListGui {
private final GuiItem item;
public MappedToListSubSettingGui(
@ -16,13 +18,15 @@ public abstract class MappedToListSubSettingGui extends ValueUpdatableGui {
this.item = item;
}
@Override
public GuiItem getParentItemForThisGui() {
return item;
}
@Override
public Gui getMappedGui() {
return this;
}
public abstract void updateLocal(); // TODO
public abstract void cleanUnused(); // TODO
}

View file

@ -6,7 +6,7 @@ import com.github.stefvanschie.inventoryframework.pane.PatternPane;
import com.github.stefvanschie.inventoryframework.pane.util.Pattern;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import xyz.alexcrea.cuanvil.gui.config.global.MainConfigGui;
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui;
import java.util.Arrays;
import java.util.Comparator;

View file

@ -5,7 +5,7 @@ import org.bukkit.command.Command
import org.bukkit.command.CommandExecutor
import org.bukkit.command.CommandSender
import org.bukkit.entity.HumanEntity
import xyz.alexcrea.cuanvil.gui.config.global.MainConfigGui
import xyz.alexcrea.cuanvil.gui.config.MainConfigGui
import xyz.alexcrea.cuanvil.gui.util.GuiGlobalActions
class EditConfigExecutor : CommandExecutor {

View file

@ -3,13 +3,12 @@ package xyz.alexcrea.cuanvil.group
import io.delilaheve.CustomAnvil
import org.bukkit.Material
import org.bukkit.enchantments.Enchantment
import xyz.alexcrea.cuanvil.interfaces.Named
class EnchantConflictGroup(
private val name: String,
private val cantConflict: AbstractMaterialGroup,
var minBeforeBlock: Int
): Named {
) {
private val enchantments = HashSet<Enchantment>()
@ -63,7 +62,7 @@ class EnchantConflictGroup(
return Material.ENCHANTED_BOOK
}
override fun getName(): String {
override fun toString(): String {
return name
}

View file

@ -139,9 +139,9 @@ class EnchantConflictManager {
var result = ConflictType.NO_CONFLICT
for (conflict in conflictList) {
CustomAnvil.verboseLog("Is against ${conflict.getName()}")
CustomAnvil.verboseLog("Is against $conflict")
val conflicting = conflict.allowed(base, mat)
CustomAnvil.verboseLog("Was against ${conflict.getName()} and conflicting: $conflicting ")
CustomAnvil.verboseLog("Was against $conflict and conflicting: $conflicting ")
if (!conflicting) {
if (conflict.getEnchants().size <= 1) {
result = ConflictType.SMALL_CONFLICT

View file

@ -1,7 +0,0 @@
package xyz.alexcrea.cuanvil.interfaces
interface Named {
fun getName(): String
}

View file

@ -5,7 +5,6 @@ import org.bukkit.configuration.ConfigurationSection
import org.bukkit.inventory.ItemStack
import xyz.alexcrea.cuanvil.config.ConfigHolder
import xyz.alexcrea.cuanvil.gui.util.GuiSharedConstant
import xyz.alexcrea.cuanvil.interfaces.Named
class AnvilCustomRecipe(
private val name: String,
@ -18,7 +17,7 @@ class AnvilCustomRecipe(
var leftItem: ItemStack?,
var rightItem: ItemStack?,
var resultItem: ItemStack?,
): Named {
) {
// Static config name
companion object {
@ -162,7 +161,7 @@ class AnvilCustomRecipe(
return true
}
override fun getName(): String {
override fun toString(): String {
return name
}