The Assistant Easy To Use Dependency Injection API

The Assistant Easy To Use Dependency Injection API - The Assistant 简易依赖注入API

基于Okaeri的库,提供开发者工具。
Bukkit / Spigot 作者 QualityPlus 支持版本 1.8 - 1.21
服务器使用量
未统计
服务玩家数
未统计
下载量
5,296
插件详细介绍

The Assistant 是一个面向开发者的多功能库,旨在简化 Minecraft 插件开发流程。它提供了一系列 API 和集成服务,帮助开发者轻松处理命令、依赖、经济、区域、NPC 等常见功能。

核心 API

通过 TheAssistantAPI 接口,开发者可以访问库的所有核心服务。

public interface TheAssistantAPI {
    public CommandProvider<AssistantCommand> getCommandProvider();
    public DependencyResolver getDependencyResolver();
    public AddonsService getAddons();
    public NMS getNms();
    public Plugin getPlugin();
}

可用服务

  • getCommandProvider(): 获取命令提供者,用于动态注册和管理命令。
  • getDependencyResolver(): 获取依赖解析器,用于管理插件依赖。
  • getAddons(): 获取插件服务,用于访问各种功能扩展(Addon)。
  • getNms(): 获取 NMS 多版本处理器,便于处理不同 Minecraft 版本的兼容性。
  • getPlugin(): 获取插件主类实例。

插件服务

这是 Assistant 最强大的功能之一,可以轻松地集成和管理其他插件(Hooks)。

Economy Addon

支持 Vault、PlayerPoints 和 TokenManager。

public interface EconomyAddon extends DependencyPlugin {
    public double getMoney(final OfflinePlayer player);
    public void depositMoney(final OfflinePlayer player, final double amount);
    public void withdrawMoney(final OfflinePlayer player, final double amount);
}

Regions Addon

支持 WorldGuard、Residence 和 UltraRegions。

public interface RegionAddon extends DependencyPlugin {
    public default boolean isInAnyRegion(final Location location, final List<String> regions) { ... }
    public default boolean isInRegion(final Location location, final String region) { ... }
    public Set<String> getRegions(final Location location);
}

Paster Addon

支持 WorldEdit,用于粘贴 schematic 文件。

public interface PasterAddon extends DependencyPlugin {
    public CompletableFuture<PasterSession> pasteSchematic(final Location location, final Schematic schematic);
}

NPC's Addon

支持 Citizens,用于判断实体是否为 NPC。

public interface NPCAddon extends DependencyPlugin {
    public boolean isNPC(final Entity entity);
}

Placeholders Addon

支持 PlaceholderAPI 和 MVdW PlaceholderAPI,用于注册自定义变量。

public interface PlaceholdersAddon extends DependencyPlugin {
    public void registerPlaceholders(final String identifier, final PlaceholderReplacer replacer);
}

命令提供者

使用 CommandProvider 可以实时注册命令。请注意,命令仍需在 plugin.yml 中声明。

注册步骤

  • 注册标签提供者
首先需要构建并注册一个 `LabelProvider` 来定义命令的基本信息。
    LabelProvider.builder()
        .id("theAssistantCommand")
        .label("assistant")
        .plugin(box.plugin())
        .useHelpMessage("&cUse Help")
        .unknownCommandMessage("&cUnknown Command")
        .onlyForPlayersMessage("&cThis command can be executed only for players!")
        .noPermissionMessage("&cYou don't have permission to use that command!")
        .build()
        .register();
  • 注册命令与处理器
通过 `TheAssistantCommandProvider` 将具体的命令与对应的处理器绑定。
    public final class TheAssistantCommandProvider implements CommandProvider<AssistantCommand> {
        public void registerCommand(final AssistantCommand command, final CommandHandler<AssistantCommand> handler);
    }
测试支持版本
1.8 1.9 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 1.20.6 1.21
版本分布
基本信息
插件名称 The Assistant Easy To Use Dependency Injection API
作者 QualityPlus
平台 Bukkit / Spigot
支持版本 1.8 - 1.21
点赞数 未统计
最近版本
暂无数据 -

友情链接: 网易我的世界 | 泰拉瑞亚 | ocent云计算 | 米饭Minecraft插件文档 | 友链合作

历史访问人数:2,621,652  |  历史访问人次:3,178,714

今日访问人数:42,851  |  今日访问人次:48,335

昨日访问人数:24,332  |  昨日访问人次:29,698

Copyright © 2019-2026 我的世界服务器列表站. All rights reserved.

Powered by GermMC 京ICP备17023959号-6