9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-19 15:09:24 +00:00

add ecoitems support

This commit is contained in:
XiaoMoMi
2025-01-30 21:16:44 +08:00
parent eb64b50392
commit 1c9110aaf8
6 changed files with 58 additions and 2 deletions

View File

@@ -52,10 +52,12 @@ dependencies {
compileOnly(files("libs/SCore-5.24.9.29.jar"))
compileOnly(files("libs/SCore-5.24.9.29.jar"))
compileOnly(files("libs/CraftEngine-beta.jar"))
compileOnly(files("libs/libreforge-4.73.0.jar"))
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.6.1")
compileOnly("net.Indyuce:MMOItems-API:6.10-SNAPSHOT")
compileOnly("io.lumine:MythicLib-dist:1.6.2-SNAPSHOT")
compileOnly("pers.neige.neigeitems:NeigeItems:1.17.13")
compileOnly("com.willfp:EcoItems:5.61.0")
compileOnly("io.th0rgal:oraxen:1.168.0")
compileOnly("com.github.brcdev-minecraft:shopgui-api:3.0.0")
// entity

Binary file not shown.

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) <2024> <XiaoMoMi>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customfishing.bukkit.integration.item;
import com.willfp.ecoitems.items.EcoItem;
import com.willfp.ecoitems.items.EcoItemFinder;
import com.willfp.ecoitems.items.EcoItems;
import net.momirealms.customfishing.api.integration.ItemProvider;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static java.util.Objects.requireNonNull;
public class EcoItemsProvider implements ItemProvider {
@Override
public String identifier() {
return "EcoItems";
}
@NotNull
@Override
public ItemStack buildItem(@NotNull Player player, @NotNull String id) {
EcoItem item = EcoItems.INSTANCE.getByID(id);
requireNonNull(item, "EcoItems cannot find item with ID " + id);
return item.getItemStack();
}
@Override
public String itemID(@NotNull ItemStack itemStack) {
List<EcoItem> list = EcoItemFinder.INSTANCE.find(itemStack);
if (list.isEmpty()) return null;
return list.get(0).getID();
}
}