{"id":20255686,"url":"https://github.com/handyplus/folialib","last_synced_at":"2025-04-11T00:06:08.608Z","repository":{"id":212085685,"uuid":"730666154","full_name":"handyplus/FoliaLib","owner":"handyplus","description":"这是一个包装库，提供各种方法来让你的插件同时适配bukkit和folia核心（This is a wrapper library that provides various ways to adapt your plugin to both the bukkit and folia cores.）","archived":false,"fork":false,"pushed_at":"2025-04-09T14:03:26.000Z","size":400,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T00:06:00.182Z","etag":null,"topics":["minecraft","minecraft-plugin"],"latest_commit_sha":null,"homepage":"https://handyplus.github.io/FoliaLib/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/handyplus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-12T12:17:49.000Z","updated_at":"2025-04-09T14:03:29.000Z","dependencies_parsed_at":"2024-02-04T04:25:26.906Z","dependency_job_id":"5a4d573b-1461-4e61-8ad3-fef834c3433e","html_url":"https://github.com/handyplus/FoliaLib","commit_stats":null,"previous_names":["handy-git/folialib","handyplus/folialib"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/handyplus%2FFoliaLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/handyplus%2FFoliaLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/handyplus%2FFoliaLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/handyplus%2FFoliaLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/handyplus","download_url":"https://codeload.github.com/handyplus/FoliaLib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317707,"owners_count":21083528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["minecraft","minecraft-plugin"],"created_at":"2024-11-14T10:39:54.926Z","updated_at":"2025-04-11T00:06:08.596Z","avatar_url":"https://github.com/handyplus.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FoliaLib\n\n\u003e 同时适配Folia和bukkit核心\n\n## 使用方法(本jar已经发布到maven中央仓库)\n\n[![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)\n\n首先: Folia要求 在plugin.yml 中添加配置 `folia-supported: true`\n\n1. maven引入\n   ```xml\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecn.handyplus.lib.adapter\u003c/groupId\u003e\n        \u003cartifactId\u003eFoliaLib\u003c/artifactId\u003e\n        \u003cversion\u003e最新版本\u003c/version\u003e\n    \u003c/dependency\u003e\n   ```\n\n2. 初始化;\n   ```java\n   public class MyPlugin extends JavaPlugin {\n       @Override\n       public void onEnable() {\n           // 初始化\n           HandySchedulerUtil.init(this);\n       }\n   }\n   ```\n\n## 使用示例\n\n   ```java\n// 同步方法\npublic void test1(Player player) {\n   HandySchedulerUtil.runTask(() -\u003e {\n      // 执行方法\n   });\n}\n\n// 异步方法\npublic void test2() {\n   HandySchedulerUtil.runTaskAsynchronously(() -\u003e {\n      // 执行方法\n   });\n}\n\n// 定时方法\npublic void test3() {\n   HandyRunnable handyRunnable = new HandyRunnable() {\n      @Override\n      public void run() {\n         try {\n            // 执行逻辑\n         } catch (Exception ignored) {\n            this.cancel();\n         }\n      }\n   };\n   HandySchedulerUtil.runTaskTimerAsynchronously(handyRunnable, 20 * 2, 20 * 60);\n}\n\n// TP方法\npublic void test4(Player player, Location location) {\n   PlayerSchedulerUtil.teleport(player, location);\n}\n\n// 执行命令\npublic void test5(Player player, String command) {\n   // 执行命令\n   PlayerSchedulerUtil.performCommand(player, command);\n   // 执行命令 指定同步\n   PlayerSchedulerUtil.syncPerformCommand(player, command);\n   // op身份执行命令\n   PlayerSchedulerUtil.performOpCommand(player, command);\n   // op身份执行命令 指定同步\n   PlayerSchedulerUtil.syncPerformOpCommand(player, command);\n}\n\n// 打开gui\npublic void test6(Player player, Inventory inv) {\n   PlayerSchedulerUtil.syncOpenInventory(player, inv);\n}\n\n// 关闭gui\npublic void test7(Player player, Inventory inv) {\n   PlayerSchedulerUtil.syncOpenInventory(player, inv);\n}\n   ```\n\n## javadoc\n\n[点击查看](https://handyplus.github.io/FoliaLib/)\n\n## 建议\n\n可以在[issues](https://github.com/handyplus/FoliaLib/issues)提出\n\n## 贡献者\n\n[![Contrib](https://contrib.rocks/image?repo=handyplus/FoliaLib)](https://github.com/handyplus/FoliaLib/graphs/contributors)\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=handyplus/FoliaLib\u0026type=Date)](https://star-history.com/#handyplus/FoliaLib\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhandyplus%2Ffolialib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhandyplus%2Ffolialib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhandyplus%2Ffolialib/lists"}