Describe the bug
I recently implemented support for CustomItems from eco in WolfyUtilities (and CustomCrafting).
It simply uses the Items#getCustomItem(ItemStack) method and then gets the key from it, to later match the items in the recipes.
However, it was reported to me that when using equipment from EcoArmor, it returns the advanced key for non-advanced items.
I then tested it with the default configuration of EcoArmor.
For example, the angelic set (/ecoarmor give <player> set:angelic) returns the following:
As you can see, even though all of them are the default variant, some return advanced keys.
Weirdly enough, this is not consistent between sets.
In each set, there are a few items correctly identified:
angelic: elytry and chestplate
huntress: leggings and elytra
reaper: everything except elytra
slayer: helmet
To Reproduce
I made a very simple test plugin to rule out any possible conflicts.
That plugin simply returns the selected item when running /ecoarmortest
The simple test plugin
```java
package com.wolfyscript.ecoarmortest;
import com.willfp.eco.core.items.Items;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public final class Ecoarmortest extends JavaPlugin {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (label.equalsIgnoreCase("ecoarmortest")) {
if(sender instanceof Player player) {
ItemStack item = player.getEquipment().getItemInMainHand();
if (!item.getType().equals(Material.AIR)) {
if (Items.isCustomItem(item)) {
player.sendMessage("CustomItem: " + Items.getCustomItem(item).getKey().toString());
}
}
}
}
return true;
}
}
```
```yml
name: Ecoarmortest
version: '${project.version}'
main: com.wolfyscript.ecoarmortest.Ecoarmortest
api-version: 1.18
depend: [ eco, EcoArmor ]
commands:
ecoarmortest:
usage: "/ecoarmortest"
```
Steps to reproduce the behaviour:
Get any of the default sets (For example: /ecoarmor give <player> set:angelic)
For each item, hold it in your hand and run /ecoarmortest
Find that it returns the advanced key for non-advanced items.
Expected behavior
The Items#getCustomItem(ItemStack) method should return the advanced item only if the item is advanced.
Otherwise, it should return the non-advanced item.
Server Information:
This server is running CraftBukkit version 3453-Spigot-ffceeae-64db512 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT)
Describe the bug I recently implemented support for CustomItems from eco in WolfyUtilities (and CustomCrafting).
It simply uses the
Items#getCustomItem(ItemStack)
method and then gets the key from it, to later match the items in the recipes.However, it was reported to me that when using equipment from EcoArmor, it returns the
advanced
key for non-advanced items.I then tested it with the default configuration of EcoArmor. For example, the angelic set (
/ecoarmor give <player> set:angelic
) returns the following:As you can see, even though all of them are the default variant, some return advanced keys. Weirdly enough, this is not consistent between sets. In each set, there are a few items correctly identified:
To Reproduce I made a very simple test plugin to rule out any possible conflicts. That plugin simply returns the selected item when running
/ecoarmortest
The simple test plugin
```java package com.wolfyscript.ecoarmortest; import com.willfp.eco.core.items.Items; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.java.JavaPlugin; public final class Ecoarmortest extends JavaPlugin { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (label.equalsIgnoreCase("ecoarmortest")) { if(sender instanceof Player player) { ItemStack item = player.getEquipment().getItemInMainHand(); if (!item.getType().equals(Material.AIR)) { if (Items.isCustomItem(item)) { player.sendMessage("CustomItem: " + Items.getCustomItem(item).getKey().toString()); } } } } return true; } } ``` ```yml name: Ecoarmortest version: '${project.version}' main: com.wolfyscript.ecoarmortest.Ecoarmortest api-version: 1.18 depend: [ eco, EcoArmor ] commands: ecoarmortest: usage: "/ecoarmortest" ```Steps to reproduce the behaviour:
/ecoarmor give <player> set:angelic
)/ecoarmortest
Expected behavior The
Items#getCustomItem(ItemStack)
method should return the advanced item only if the item is advanced.Otherwise, it should return the non-advanced item.
Server Information: This server is running CraftBukkit version 3453-Spigot-ffceeae-64db512 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT)
eco version 6.27.3 EcoArmor version 7.36.0