Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/handyplus/folialib
这是一个包装库,提供各种方法来让你的插件同时适配bukkit和folia核心(This is a wrapper library that provides various ways to adapt your plugin to both the bukkit and folia cores.)
https://github.com/handyplus/folialib
minecraft minecraft-plugin
Last synced: about 12 hours ago
JSON representation
这是一个包装库,提供各种方法来让你的插件同时适配bukkit和folia核心(This is a wrapper library that provides various ways to adapt your plugin to both the bukkit and folia cores.)
- Host: GitHub
- URL: https://github.com/handyplus/folialib
- Owner: handyplus
- License: lgpl-3.0
- Created: 2023-12-12T12:17:49.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-11-11T07:58:01.000Z (4 days ago)
- Last Synced: 2024-11-11T08:36:42.394Z (4 days ago)
- Topics: minecraft, minecraft-plugin
- Language: Java
- Homepage: https://handyplus.github.io/FoliaLib/
- Size: 349 KB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FoliaLib
> 同时适配Folia和bukkit核心
## 使用方法(本jar已经发布到maven中央仓库)
[![Maven Central](https://img.shields.io/maven-central/v/cn.handyplus.lib.adapter/FoliaLib.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22cn.handyplus.lib.adapter%22%20AND%20a:%22FoliaLib%22)
首先: Folia要求 在plugin.yml 中添加配置 `folia-supported: true`
1. maven引入
```xml
cn.handyplus.lib.adapter
FoliaLib
最新版本
```2. 初始化;
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
// 初始化
HandySchedulerUtil.init(this);
}
}
```## 使用示例
```java
// 同步方法
public void test1(Player player) {
HandySchedulerUtil.runTask(player::closeInventory);
}// 异步方法
public void test2() {
HandySchedulerUtil.runTaskAsynchronously(() -> {
// 执行方法
});
}// TP方法
public void test3(Player player, Location location) {
PlayerTeleportEvent.teleport(player, location);
}// 执行命令
public void test4(Player player, String command) {
PlayerTeleportEvent.performCommand(player, command);
}// 定时方法
public void test5() {
HandyRunnable handyRunnable = new HandyRunnable() {
@Override
public void run() {
try {
// 执行逻辑
} catch (Exception ignored) {
this.cancel();
}
}
};
HandySchedulerUtil.runTaskTimerAsynchronously(handyRunnable, 20 * 2, 20 * 60);
}
```## javadoc
[点击查看](https://handyplus.github.io/FoliaLib/)
## 建议
可以在[issues](https://github.com/handyplus/FoliaLib/issues)提出
## 贡献者
[![Contrib](https://contrib.rocks/image?repo=handyplus/FoliaLib)](https://github.com/handyplus/FoliaLib/graphs/contributors)
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=handyplus/FoliaLib&type=Date)](https://star-history.com/#handyplus/FoliaLib&Date)