ItemsAPI 图标

ItemsAPI

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 1.0
本资源为搬运资源,原资源地址: https://modrinth.com/mod/itemsapi
资源信息

Minecraft 版本: 1.21 1.21.1 1.21.2 1.21.3 1.21.4 1.21.5 1.21.6 1.21.7 1.21.8 1.21.9 1.21.10 1.21.11

平台: bukkit paper purpur spigot

标签: equipment game-mechanics library

资源介绍

ItemsAPI (1.16.5-1.21.8)

A plugin for Minecraft servers that provides an API for managing custom items and storing them in the configuration.

? Features

  • Save, load, and give items via commands
  • Simple API interface for integration with plugins
  • Items are stored in a configuration file

? Commands

Command Description Permission
/items give <player> <item> Give a saved item to the specified player ItemsAPI.use
/items add Save all items from your inventory ItemsAPI.use

? API for Developers

// Getting an instance of the API:
@Override
public void onEnable() {
    itemsAPI = ItemsAPIProvider.getAPI();
}

// Getting and giving an ItemStack:
ItemStack needItem = itemsAPI.getItem("CRUSHER_TALISMAN");

// Get all saved items
Map<String, ItemStack> allItems = api.getAllItems();

⭐ Example Usage in a Menu

public class MenuPlugin extends JavaPlugin implements CommandExecutor {
    private ItemsAPIInterface itemsAPI;
    private final MiniMessage mm = MiniMessage.miniMessage();

    @Override
    public void onEnable() {
        itemsAPI = ItemsAPIProvider.getAPI();
        getServer().getPluginManager().registerEvents(this, this);
        getCommand("menu").setExecutor(this);
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player)) { return true; }

        Inventory inv = Bukkit.createInventory(player, 3*9, mm.deserialize("<blue>API Example</blue>"));
        inv.setItem(13, itemsAPI.getItem("CRUSHER_TALISMAN"));
        player.openInventory(inv);

        return true;
    }
}
  • Don't forget to add depend: [ItemsAPI] to your plugin's plugin.yml
  • And also to your build.gradle: compileOnly files('libs/ItemsAPI-1.0.jar')
下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
Cpvp baloizya pack

价格:0 墨喵币
下载量:0

查看详情
Cravings!

价格:0 墨喵币
下载量:0

查看详情
EnlightenedBlockEntities

价格:0 墨喵币
下载量:0

查看详情
Cauldron Mud

价格:0 墨喵币
下载量:0

查看详情