炫宙菌
本帖最后由 炫宙菌 于 2020-4-13 11:36 编辑

LightAPI
LightAPI Fork
隐藏光源的API
简介
一个简单的创建隐藏光源的轻量级库(Library)
原作名为LightAPI,支持版本1.8-1.11
接坑者更名为LightAPI Fork,支持版本1.8-1.15
请下载并使用LightAPI Fork,LightAPI原作者已弃坑
目前系列下载量已经超过4.5W


授权问题
在搞


功能
  • 创建、删除隐藏光源
  • 支持插件nuNPCDestinations
  • 支持插件HatMeEnhanced
  • 支持插件VarLight
  • 支持插件ShinyItems
  • 支持插件Quality Armory
  • 支持插件AddLight
还有更多,大部分支持光源的插件都与之有关
LightAPI的兼容性:请选择LightAPI Fork以获得更多支持(MC1.8-1.15)
CraftBukkit/Spigot 1.8.8-1.10
Paper 1.8.8
Paper 1.9+
Tacospigot 1.9+
Cauldron 1.7.10 [测试支持]


用法
基本模式:
-LightAPI
createLight创建光源(World世界,blockX坐标X,blockY坐标Y,blockZ坐标Z,light level光照等级,async异步);
-在此特定坐标和灯光级别上创建灯光。如果async state设置为“true”,那么将创建异步请求并将其添加到处理队列中。
  1. LightAPI.createLight(location.getWorld(),
复制代码
如果你添加了坐标,则可以使用
  1. LightAPI.createLight(location, 15, true);
复制代码
deleteLight(World,blockX,blockY,blockZ,async);
-删除此位置上的灯光。
如果async state设置为“true”,那么将创建异步请求并将其添加到处理队列中。
  1. LightAPI.deleteLight(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(),  true);
复制代码
如果你添加了坐标,则可以使用
  1. LightAPI.deleteLight(location,  true)
复制代码
collectChunks(Location loc);
- 收集并回退一个更改了的区块列表
  1. LightAPI.collectChunks(player.getLocation());
复制代码
updateChunk(ChunkInfo info);
- 发送更改区块的玩家
  1. LightAPI.updateChunk(info);
复制代码
高级模式
需要SeverModManager3.0+
Starting with version 3.0+ developers can add their own implementation NMSHandler for other CraftBukkit implementations.

registerServerMod(ServerModInfo info);
- Registration of the new platform. ServerModInfo contains a map with classes for initialization NMSHandler under the version of CraftBukkit implementation.
  1. // Example code from LightAPI 3.0.0
  2. ServerModInfo spigot = new ServerModInfo("Spigot");
  3. spigot.getVersions().put("v1_8_R3", CraftBukkit_v1_8_R3.class);
  4. spigot.getVersions().put("v1_9_R1", CraftBukkit_v1_9_R1.class);
  5. spigot.getVersions().put("v1_9_R2", CraftBukkit_v1_9_R2.class);
  6. spigot.getVersions().put("v1_10_R1", CraftBukkit_v1_10_R1.class);
  7. ServerModManager.registerServerMod(spigot);
复制代码
unregisterServerMod(String modName);
- Unregistration of CraftBukkit implementation.
  1. ServerModManager.unregisterServerMod("Spigot");
复制代码
getNMSHandler();
- initialized NMSHandler after enable main plugin.
  1. ServerModManager.getNMSHandler();
复制代码
事件
- SetLightEvent设置光源
- DeleteLightEvent删除光源
- UpdateChunkEvent区块更新
命令
- /lightapi - 主要命令
- /lightapi update - 检测更新


配置
# LightAPI v3.2.0-dev 版配置,仅供参考
#作者——BeYkeRYkt
version: 3 #版本,勿动
update-delay-ticks: 2 #多少tick检测1次
max-iterations-per-tick: 400 #每tick检测几次
updater:
  enable: true #是否自动更新
  repo: BeYkeRYkt/LightAPI
  update-delay-ticks: 40
  view-changelog: false #开启日志


示例


下载地址·源代码


acnull
感谢楼主!正愁找不到相关的API

山洪jkl
谢谢版主分享,很实用的前置,动态光源需要这个

MC小鱼儿
mcbbs有你更精彩!这插件真的好用