Skip to content

Commit d092a5a

Browse files
Update Lua definitions
1 parent c300b92 commit d092a5a

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

library/lualink/script.lua

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ local Event = java.import("org.bukkit.event.Event")
44
local HandlerList = java.import("org.bukkit.event.HandlerList")
55
---@class Script
66
---@field name string The name of the script
7-
---@field commands table<string, table> Registered commands
8-
---@field hooks table<string, function[]> Event hooks
9-
---@field listeners listener[] List of event listeners instances
10-
---@field logger Logger The logger instance for the script
11-
---@field loadHandlers function[] Functions to call on load
12-
---@field unloadHandlers function[] Functions to call on unload
7+
---@field package commands table<string, table> Registered commands
8+
---@field package hooks table<string, function[]> Event hooks
9+
---@field package listeners listener[] List of event listeners instances
10+
---@field public logger Logger The logger instance for the script
11+
---@field package loadHandlers function[] Functions to call on load
12+
---@field package unloadHandlers function[] Functions to call on unload
13+
---@field package dataFolder string The data folder for the script
1314
Script = {}
1415

1516
-- Create a new script instance
@@ -28,6 +29,7 @@ function Script.new(name, server, plugin, logger, debug)
2829
self.loadHandlers = {}
2930
self.unloadHandlers = {}
3031
self.logger = logger
32+
self.dataFolder = plugin:getDataFolder():getAbsolutePath() .. "/scripts/" .. name
3133

3234
-- Internal onLoad handler
3335
self:onLoad(function()
@@ -151,6 +153,12 @@ function Script:_callUnloadHandlers()
151153
end
152154
end
153155

156+
--Returns this scripts data folder (where the script is located)
157+
---@public
158+
function Script:getDataFolder()
159+
return self.dataFolder
160+
end
161+
154162

155163
---@class LuaLinkCommandMetadata
156164
---@field name string The name of the command

0 commit comments

Comments
 (0)