Light Api Plugin
Light API Plugin (1.19.4, 1.19.2) is a plugin that allows you to Edit light resource levels in Minecraft. It works with CraftBukkit, Spigot, and Paper servers and supports versions from 1.8 to 1.19. With LightAPI, you can create dynamic and realistic lighting effects for your maps, minigames, and plugins.
Features:
- Â Edit light levels in the Minecraft world.
Currently supported platforms:
- CraftBukkit/Spigot (1.14.1 – 1.19)
Current supported light engines:
- Vanilla engine (1.14.1 – 1.19)
- Starlight engine (1.17.1 – 1.19)
How to use:
- Very simple.
- If you want to edit light level (with deferred policy):
Code (Text):
LightAPI.get().setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel)
After calling this function, your request is added to the queue and will be executed after a while with automatic sending to all clients (by default, after 1 tick).
If you want more control, you can use:
Code (Text):
LightAPI.get().setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags); LightAPI.get().setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags, ICallback callback); LightAPI.get().setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags, EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback);
Using the following parameters, you can:
- lightFlags: choose which lighting layer to make changes on, as well as combine them;
- editPolicy: choose a edit policy (apply changes right now, apply immediately taking into account the state of the server, or apply deferred (by default 1 tick)).
- sendPolicy: choose a policy for sending lighting data to clients (send separate packets for each change or combine the same chunks within an interval (by default 2 tick)).
- callback: get execution result codes about completed stages.
If this is not enough for you, then you can use IBukkitExtension to get a Handler class.
Code (Text):
IBukkitExtension ext = (IBukkitExtension) LightAPI.get().getExtension(); IHandler rawHandler = ext.getHandler();
With this class, you get “raw” access to library elements.
Commands:
- /lightapi – main command
Configuration:
Default configuration:
Code (Text):
general: debug: false enable-metrics: true enable-compatibility-mode: false force-enable-legacy: false specific-handler-path: none handlers: craftbukkit: factory-path: ru.beykerykt.minecraft.lightapi.bukkit.internal.handler.craftbukkit.HandlerFactory BukkitBackgroundService: corePoolSize: 1 BukkitScheduledChunkObserver: tick-period: 2 BukkitScheduledLightEngine: relight-strategy: DEFERRED tick-period: 1 max-time-ms-in-per-tick: 50 max-iterations-in-per-tick: 256
general:
debug – enables debug messages.
enable-metrics – enables bStats metrics.
enable-compatibility-mode – enables compatibility mode, where instead of editing lighting data, the plugin places blocks of light. Does not support Skylight editing. Works only with 1.17+.
force-enable-legacy – enables support for legacy plugins (from ru.beykerykt.lightapi namespace).
specific-handler-path – the path for forced loading of the handler.
handlers.*Â – a list of platforms and their paths to the HandlerFactory.
BukkitBackgroundService:
corePoolSize – The number of threads allocated for internal tasks.
BukkitScheduledChunkObserver:
tick-period – The delay in server ticks before queue processing.
BukkitScheduledLightEngine:
relight-strategy – A strategy for recalculating lighting. The values can be as follows: DEFERRED – recalculation is performed after ALL changes are applied. FORWARD – recalculation is performed after EACH change.
tick-period – The delay in server ticks before queue processing.
max-time-ms-in-per-tick – The maximum time (in milliseconds) allocated for processing requests for each tick.
max-iterations-in-per-tick – The maximum number of processed requests per tick.
Example usage:
Code (Java):
int blockLight = LightAPI.get().getLightLevel(worldName, blockX, blockY, blockZ, LightFlag.BLOCK_LIGHTING); broadcastMessage("LightLevel: " + blockLight); int resultCode = LightAPI.get().setLightLevel(worldName, blockX, blockY, blockZ, lightLevel); switch (resultCode) { case ResultCode.SUCCESS: // The request was executed. break; case ResultCode.MOVED_TO_DEFERRED: // The request has been moved to the queue and will be executed after a // while. break; default: broadcastMessage("Something is wrong. Result code:" + resultCode); break; }
Maven
subproject: lightapi-bukkit-common
Code (Text):
<dependency> <groupId>com.github.BeYkeRYkt</groupId> <artifactId>lightapi-bukkit-common</artifactId> <version>5.1.0</version> <scope>provided</scope> </dependency>
How to install:
- Download a plugin of your choice.
- Place the .jar and any other files in your pluginâs directory.
- Run the server and wait for it to fully load.
- Type stop in your Minecraft server console to bring the server to a clean stop.
- Run the server.
- All done! Your plugin should be installed and ready to be used.