mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 08:14:00 +02:00
progress
This commit is contained in:
parent
8cb11c3c18
commit
94847832c0
16 changed files with 34 additions and 38 deletions
|
|
@ -444,7 +444,7 @@ n * <p>
|
|||
AbstractItemTypeGroup typeGroup = itemGroupManager.get(groupName);
|
||||
|
||||
if (typeGroup == null) {
|
||||
CustomAnvil.instance.getLogger().warning("Material group " + groupName + " do not exist but is ask by conflict " + getName());
|
||||
CustomAnvil.instance.getLogger().warning("Item group " + groupName + " do not exist but is ask by conflict " + getName());
|
||||
ConflictAPI.logConflictOrigin(this);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class ItemGroupApi {
|
|||
public static boolean writeItemGroup(@NotNull AbstractItemTypeGroup group, boolean updatePlanned) {
|
||||
String name = group.getName();
|
||||
if (name.contains(".")) {
|
||||
CustomAnvil.instance.getLogger().warning("Group " + name + " contain . in its name but should not. this material group is ignored.");
|
||||
CustomAnvil.instance.getLogger().warning("Group " + name + " contain . in its name but should not. this item group is ignored.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import xyz.alexcrea.cuanvil.api.ItemGroupApi;
|
|||
* <p>
|
||||
* use {@link xyz.alexcrea.cuanvil.api.ConflictAPI ConflictApi},
|
||||
* {@link xyz.alexcrea.cuanvil.gui.config.global.CustomRecipeConfigGui CustomRecipeConfigGui},
|
||||
* {@link ItemGroupApi MaterialGroupApi}
|
||||
* {@link ItemGroupApi ItemGroupApi}
|
||||
* and {@link xyz.alexcrea.cuanvil.api.UnitRepairApi UnitRepairApi}
|
||||
* to add/remove/edit configurations
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ public interface SelectItemTypeContainer {
|
|||
static List<String> getItemLore(SelectItemTypeContainer container, String containerType, String action) {
|
||||
// Prepare material lore
|
||||
ArrayList<String> groupLore = new ArrayList<>();
|
||||
groupLore.add("§7Allow you to select a list of §ematerials §7that this " + containerType + " should " + action);
|
||||
groupLore.add("§7Allow you to select a list of §eitems §7that this " + containerType + " should " + action);
|
||||
Set<ItemType> typeSet = container.getSelectedItems();
|
||||
if (typeSet.isEmpty()) {
|
||||
groupLore.add("§7There is no " + action + "d material for this " + containerType + ".");
|
||||
groupLore.add("§7There is no " + action + "d item for this " + containerType + ".");
|
||||
} else {
|
||||
groupLore.add("§7List of " + action + "d materials for this " + containerType + ":");
|
||||
groupLore.add("§7List of " + action + "d items for this " + containerType + ":");
|
||||
Iterator<ItemType> typeIterator = typeSet.iterator();
|
||||
|
||||
boolean greaterThanMax = typeSet.size() > 5;
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ public class GroupConfigGui extends MappedGuiListConfigGui<IncludeItemTypeGroup,
|
|||
meta.addItemFlags(ItemFlag.values());
|
||||
meta.setDisplayName("§e" + CasedStringUtil.snakeToUpperSpacedCase(group.getName()) + " §fGroup");
|
||||
meta.setLore(Arrays.asList(
|
||||
"§7Number of selected groups : " + group.getGroups().size(),
|
||||
"§7Number of included material : " + group.getNonGroupInheritedItemTypes().size(),
|
||||
"§7Number of selected groups: " + group.getGroups().size(),
|
||||
"§7Number of included item: " + group.getNonGroupInheritedItemTypes().size(),
|
||||
"",
|
||||
"§7Total number of included material " + group.getItemTypes().size()));
|
||||
"§7Total number of included item: " + group.getItemTypes().size()));
|
||||
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
|
|
@ -80,7 +80,7 @@ public class GroupConfigGui extends MappedGuiListConfigGui<IncludeItemTypeGroup,
|
|||
|
||||
@Override
|
||||
protected String genericDisplayedName() {
|
||||
return "material group";
|
||||
return "item group";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class UnitRepairElementListGui extends
|
|||
protected List<String> getCreateItemLore() {
|
||||
return Arrays.asList(
|
||||
"§7Select a new item to be repairable.",
|
||||
"§7You will be asked the material to use."
|
||||
"§7You will be asked the item to use."
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -223,22 +223,22 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
|||
List<String> groupLore = SelectGroupContainer.getGroupLore(this, "group", "include");
|
||||
|
||||
// Configure included material setting item
|
||||
ItemStack matSelectItem = this.itemSelection.getItem();
|
||||
ItemMeta matSelectMeta = matSelectItem.getItemMeta();
|
||||
ItemStack itemSelectItem = this.itemSelection.getItem();
|
||||
ItemMeta itemSelectMeta = itemSelectItem.getItemMeta();
|
||||
|
||||
matSelectMeta.setDisplayName("§aSelect included §eMaterials §aSettings");
|
||||
matSelectMeta.setLore(matLore);
|
||||
matSelectMeta.addItemFlags(ItemFlag.values());
|
||||
itemSelectMeta.setDisplayName("§aSelect included §eItems");
|
||||
itemSelectMeta.setLore(matLore);
|
||||
itemSelectMeta.addItemFlags(ItemFlag.values());
|
||||
|
||||
matSelectItem.setItemMeta(matSelectMeta);
|
||||
itemSelectItem.setItemMeta(itemSelectMeta);
|
||||
|
||||
this.itemSelection.setItem(matSelectItem); // Just in case
|
||||
this.itemSelection.setItem(itemSelectItem); // Just in case
|
||||
|
||||
// Configure enchant setting item
|
||||
ItemStack groupSelectItem = this.groupSelection.getItem();
|
||||
ItemMeta groupSelectMeta = groupSelectItem.getItemMeta();
|
||||
|
||||
groupSelectMeta.setDisplayName("§aSelect included §3Groups §aSettings");
|
||||
groupSelectMeta.setDisplayName("§aSelect included §3Groups");
|
||||
groupSelectMeta.setLore(groupLore);
|
||||
|
||||
groupSelectItem.setItemMeta(groupSelectMeta);
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public class ItemTypeSelectSettingGui extends MappedElementListConfigGui<ItemTyp
|
|||
selectMeta.setDisplayName("§aAdd Item");
|
||||
selectMeta.setLore(Arrays.asList(
|
||||
"§7Click here with an item to add",
|
||||
"§7it's Material to the list."));
|
||||
"§7it to the list."));
|
||||
|
||||
selectItem.setItemMeta(selectMeta);
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ public class ItemTypeSelectSettingGui extends MappedElementListConfigGui<ItemTyp
|
|||
|
||||
if (meta == null) return item;
|
||||
meta.setDisplayName("§a" + CasedStringUtil.snakeToUpperSpacedCase(type.key().value().toLowerCase()));
|
||||
meta.setLore(Collections.singletonList("§7Click here to remove this material from the list"));
|
||||
meta.setLore(Collections.singletonList("§7Click here to remove this item from the list"));
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
|
||||
item.setItemMeta(meta);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class PUpdate_1_11_0 {
|
|||
|
||||
ItemGroupApi.addItemGroup(group, true);
|
||||
|
||||
// Try to see if all the materials was in the tools group. and if so, replace it with the new group
|
||||
// Try to see if all the items was in the tools group. and if so, replace it with the new group
|
||||
if (tools == null) return;
|
||||
if (!(tools instanceof IncludeItemTypeGroup include)) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ abstract class AbstractItemTypeGroup(private val name: String) {
|
|||
protected abstract fun createDefaultSet(): MutableSet<ItemType>
|
||||
|
||||
/**
|
||||
* Get if a material is allowed following the group policy
|
||||
* Get if an item is allowed following the group policy
|
||||
*/
|
||||
open fun contain(mat: ItemType): Boolean {
|
||||
return mat in getItemTypes()
|
||||
|
|
@ -98,19 +98,19 @@ abstract class AbstractItemTypeGroup(private val name: String) {
|
|||
abstract fun setGroups(groups: MutableSet<AbstractItemTypeGroup>)
|
||||
|
||||
/**
|
||||
* Get the contained group of this material group
|
||||
* Get the contained group of this item group
|
||||
*/
|
||||
abstract fun getGroups(): MutableSet<AbstractItemTypeGroup>
|
||||
|
||||
open fun getRepresentativeItem(): ItemType {
|
||||
// Test inner material
|
||||
// Test inner item
|
||||
val itemIterator = includedItems.iterator()
|
||||
while (itemIterator.hasNext()) {
|
||||
val type = itemIterator.next()
|
||||
if (type == ItemType.AIR) continue
|
||||
return type
|
||||
}
|
||||
// Test included group representative material
|
||||
// Test included group representative item
|
||||
val groupIterator = getGroups().iterator()
|
||||
while (groupIterator.hasNext()) {
|
||||
val groupType = groupIterator.next().getRepresentativeItem()
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ class EnchantConflictManager {
|
|||
): AbstractItemTypeGroup {
|
||||
val group = itemManager.get(groupName)
|
||||
if (group == null) {
|
||||
CustomAnvil.instance.logger.warning("Material group $groupName do not exist but is ask by conflict $conflictName")
|
||||
CustomAnvil.instance.logger.warning("Item group $groupName do not exist but is ask by conflict $conflictName")
|
||||
return IncludeItemTypeGroup("error_placeholder")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class ItemGroupManager {
|
|||
|
||||
lateinit var groupMap: LinkedHashMap<String, AbstractItemTypeGroup>
|
||||
|
||||
// Read and create material groups
|
||||
// Read and create item groups
|
||||
fun prepareGroups(config: ConfigurationSection) {
|
||||
groupMap = LinkedHashMap()
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ class ItemGroupManager {
|
|||
val groupSection = config.getConfigurationSection(key)!!
|
||||
val groupType = groupSection.getString(GROUP_TYPE_PATH, null)
|
||||
|
||||
// Create Material group according to the group type
|
||||
// Create item group according to the group type
|
||||
val group: AbstractItemTypeGroup
|
||||
if (groupType != null && GroupType.EXCLUDE.equal(groupType)) {
|
||||
group = ExcludeItemTypeGroup(key)
|
||||
|
|
@ -74,7 +74,7 @@ class ItemGroupManager {
|
|||
config: ConfigurationSection,
|
||||
keys: Set<String>
|
||||
) {
|
||||
// Read material to include in this group policy
|
||||
// Read item to include in this group policy
|
||||
val itemTypeNames = groupSection.getStringList(ITEMS_LIST_PATH)
|
||||
for (typeName in itemTypeNames) {
|
||||
val type = ItemTypeUtil.getItemType(typeName)
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class AnvilCustomRecipe(
|
|||
DEFAULT_RESULT_ITEM_CONFIG
|
||||
)
|
||||
|
||||
// Update material map
|
||||
// Update item map
|
||||
ConfigHolder.CUSTOM_RECIPE_HOLDER.recipeManager.cleanSetLeftItem(this, leftItem)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ enum class LoreEditType(
|
|||
}
|
||||
|
||||
/**
|
||||
* If the edit should consume the provided material
|
||||
* If the edit should consume the provided item
|
||||
*/
|
||||
val doConsume: Boolean
|
||||
get() {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# You can still manually edit here if you like to. but if you do, don't forget to /anvilconfigreload after you changes !
|
||||
#
|
||||
|
||||
# material conflicts
|
||||
# item conflicts
|
||||
#
|
||||
# If you want to edit this file:
|
||||
# - A conflict will apply to every item except if in one of the notAffectedGroups group
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
# It is recommended that you use /configanvil to edit theses config.
|
||||
# You can still manually edit here if you like to. but if you do, don't forget to /anvilconfigreload after you changes !
|
||||
#
|
||||
|
||||
# Please note this config use spigot material names.
|
||||
# It should match minecraft name in most case, maybe every case, but I can't be sure
|
||||
# In case there an issue with material name, you can found them here:
|
||||
# https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
|
||||
# This config use the item namespace. or assume minecraft: namespace if absent.
|
||||
|
||||
# An empty Exclude group exclude nothing, so it contain everything
|
||||
everything:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue