# 添加兼容性的插件

## 它是如何工作的？

### 第一步：创建兼容类

您需要创建一个扩展

```
CompatibilityProvider<Main class of the plugin you want to add support>
```

并把为插件添加支持的代码放在你创建的类中

### 第二步：将兼容性类添加到Oraxen中

使用

```
CompatibilitiesManager.addCompatibility(name of the plugin you want to add support, class you created in first step)
```

以将该类添加到Oraxen中

## 示范

{% hint style="info" %}
&#x20;我将在这个例子中使用MythicMobs。
{% endhint %}

### 第一步：创建兼容类

```
import io.lumine.xikage.mythicmobs.MythicMobs;
import io.lumine.xikage.mythicmobs.api.bukkit.events.MythicDropLoadEvent;
import io.th0rgal.oraxen.compatibilities.CompatibilityProvider;

public class MythicMobsCompatibility extends CompatibilityProvider<MythicMobs>{

    @EventHandler
    public void onMythicDropLoadEvent(MythicDropLoadEvent event) {
    
    }
    
}
```

### 第二步：将兼容类添加到Oraxen中

```
import io.th0rgal.oraxen.compatibilities.CompatibilitiesManager;
import org.bukkit.plugin.java.JavaPlugin;

public class OraxenMythicMobsCompatibilityPlugin extends JavaPlugin {

    public void onEnable() {
        CompatibilitiesManager.addCompatibility("MythicMobs", MythicMobsCompatibility.class)
    }

}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://3504743864.gitbook.io/oraxen-wiki/kai-fa/tian-jia-jian-rong-xing-de-cha-jian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
