- 版权类型
- 原创
- 插件中文名称
- weed的Lua插件集
- 插件英文名称
- Lua Utils
- 原帖地址
- #
- 支持的核心(服务端)
- Spigot
- 语言支持
- 中文(简体)
- 前置组件
- LuaInMinecraftBukkit II: https://www.minebbs.com/resources/luainminecraftbukkit-ii-lua.11867/
- 适配版本(Java)
- 1.7
Lua插件集
基于LuaInMinecraftBukkit II实现的Lua插件,是一些在我当前所使用服务端版本下没有找到更好插件替代时写的小玩意,通常不会在同一个脚本中塞入过多功能,更注重模块化设计。未来实现更多可公开的通用插件后将会更新本帖
已实现的公开插件
适配版本:Bukkit 1.7.10
OP是可以正常使用的!!!测试前请/deop
OP是可以正常使用的!!!测试前请/deop
code_language.lua:
local CraftItemStack = luajava.bindClass("org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack")
luaBukkit.env:listenerBuilder()
:subscribe({
event = "PlayerInteractEvent",
priority = "LOWEST",
handler = function(event)
local player = event:getPlayer()
local item = event:getItem()
local action = event:getAction():toString()
if not player or not item or not action then return end
if (action == "RIGHT_CLICK_AIR" or action == "RIGHT_CLICK_BLOCK") then
if item:getType():toString() ~= "THAUMCRAFT_WANDCASTING" then return end
local nms_item = CraftItemStack:asNMSCopy(item)
if not nms_item then return end
local tag = nms_item:func_77978_p()
if not tag then return end
if tag:func_74764_b("focus") and not player:isOp() then
player:sendMessage("§c法杖核心已禁用,请卸载法杖核心后再尝试使用法杖!")
event:setCancelled(true)
end
end
end
})
:build()
:register("RodFocusUsing")
luaBukkit.helper:runnable(function() luaBukkit.log:info("法杖核心已禁用") end):run()
适配版本:Bukkit 1.7.10
OP是可以正常打开GUI的!!!测试前请/deop
OP是可以正常打开GUI的!!!测试前请/deop
code_language.lua:
local black_list = {
SUPERSOLARPANEL_SINGULARSOLARPANEL = true,
SUPERSOLARPANEL_SPECTRALSOLARPANEL = true,
SUPERSOLARPANEL_ADMINSOLARPANEL = true,
SUPERSOLARPANEL_PHOTONICSOLARPANEL = true,
ADVANCEDSOLARPANEL_BLOCKADVSOLARPANEL = true
}
luaBukkit.env:listenerBuilder()
:subscribe({
event = "PlayerInteractEvent",
priority = "LOWEST",
handler = function(event)
local player = event:getPlayer()
local clicked_block = event:getClickedBlock()
local action = event:getAction():toString()
if not player or not clicked_block or not action then return end
if (action == "RIGHT_CLICK_BLOCK") and black_list[clicked_block:getType():toString()] and not player:isOp() then
player:sendMessage("§c高级太阳能GUI已禁用!")
event:setCancelled(true)
end
end
})
:build()
:register("SolarPanelGUI")
luaBukkit.helper:runnable(function() luaBukkit.log:info("高级太阳能GUI已禁用") end):run()
适配版本:LuaInMinecraftBukkit II支持的全版本
需要搭配支持关服重启的启动脚本!!!
会向全体玩家发送重启消息
默认提供了一个定时重启时间,在脚本中已标注,同时提供重启命令
倒计时重启命令:/infinityutils reboot <倒计时>
基于我自己的服务器开发,所以命令是infinityutils开头,你可以根据需要自行修改
1.8及以上版本会启用title接口实现发送屏幕标题
权限节点:infinityutils.commands.reboot
需要搭配支持关服重启的启动脚本!!!
会向全体玩家发送重启消息
默认提供了一个定时重启时间,在脚本中已标注,同时提供重启命令
倒计时重启命令:/infinityutils reboot <倒计时>
基于我自己的服务器开发,所以命令是infinityutils开头,你可以根据需要自行修改
1.8及以上版本会启用title接口实现发送屏幕标题
权限节点:infinityutils.commands.reboot
code_language.lua:
-- 这些时间将会发送title进行全服通知
local notifications = {
[3600] = true,
[1800] = true,
[600] = true,
[300] = true,
[180] = true,
[60] = true,
[30] = true,
[15] = true
}
for i = 1, 10 do
notifications[i] = true
end
-- 默认提供一个定时重启,设定为负值则不生效
local timeout = -1
local function formatTime(seconds)
if seconds >= 60 then
local minutes = math.floor(seconds / 60)
local remain = seconds % 60
if remain == 0 then
return string.format("%d分钟", minutes)
else
return string.format("%d分%d秒", minutes, remain)
end
else
return string.format("%d秒", seconds)
end
end
local send_title = false
local major, minor = luaBukkit.bukkit:getVersion():match("(%d+)%.(%d+)")
if tonumber(major) and tonumber(minor) and tonumber(major) == 1 and tonumber(minor) >= 8 then
send_title = true
luaBukkit.log:info("服务器版本>=1.8,已启用sendTitle接口")
end
local function notify(time)
local time_str = formatTime(time)
local message = string.format("§e服务器将在§c%s§e后重启,请尽快完成当前事物,以免造成不必要的损失", time_str)
local players = luaBukkit.server:getOnlinePlayers()
luaBukkit.log:info(string.format("服务器将在%s后重启", time_str))
if send_title then
for i = 1, #players do
local player = players:get(i - 1)
if player then
player:sendTitle("§b重启", message)
end
end
else
for i = 1, #players do
local player = players:get(i - 1)
if player then
player:sendMessage(message)
end
end
end
end
local function newRebootTask(sender, args)
timeout = tonumber(args[1])
if not timeout or timeout <= 0 then
sender:sendMessage("§c无效的倒计时时间,请输入正整数!")
return
end
end
luaBukkit.helper:asyncTimer(function()
if timeout < 0 then return end
if timeout == 0 then
luaBukkit.server:shutdown()
return
end
if notifications[timeout] then notify(timeout) end
timeout = timeout - 1
end, 0, 20)
local commands = {
{
command = "reboot",
args = {"倒计时(秒)"},
description = "在指定时间(秒)后重启服务器",
permission = "infinityutils.commands.reboot",
handler = newRebootTask
}
}
local command_builder = luaBukkit.env:commandClassBuilder()
:commands(commands)
:aliases({"iu", "infinityu"})
:build("InfinityUtils")
local result = luaBukkit.env:registerCommand("infinityutils", {"iu", "infinityu"}, { command_builder })
if result:isError() then luaBukkit.log:info("命令注册失败!") end
luaBukkit.helper:runnable(function() luaBukkit.log:info("命令已注册") end):run()
适配版本:Bukkit 1.7.10
如果你可以更改
支持NBT,支持跨服,支持系统商店,(计划)支持点券购买
Q:为什么我不使用GlobalMarket?
A:因为通过ChestCommands等菜单插件中通过/market打开其GUI会发生错误
设置好数据库连接信息host、port、database、username、password即可
配置信息
命令:/market
权限节点:
infinityutils.commands.market.open
infinityutils.commands.market.servershop
infinityutils.commands.market.sell
infinityutils.commands.market.serversell
脚本下载:https://www.alipan.com/s/Q67dEzc3muS
2025.7.12更新修复连接池问题
如果你可以更改
org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack类,那么理论可以适配1.7.10-1.12.2支持NBT,支持跨服,支持系统商店,(计划)支持点券购买
Q:为什么我不使用GlobalMarket?
A:因为通过ChestCommands等菜单插件中通过/market打开其GUI会发生错误
如何使用?
前置插件:SQLibrary、Essentials|CMI等支持Vault的经济插件、Vault设置好数据库连接信息host、port、database、username、password即可
其他有用的信息
这个脚本是我花了几个小时写完的,没有经过大量验证,如果发生问题,请在评论区提出配置信息
code_language.lua:
local conn_info = {
logger = luaBukkit.log:getLogger("GlobalMarket"),
prefix = "[GlobalMarket]",
host = "localhost",
port = 3306,
database = "db",
username = "username",
password = "password",
connection_pool = 10
}
权限节点:
infinityutils.commands.market.open
infinityutils.commands.market.servershop
infinityutils.commands.market.sell
infinityutils.commands.market.serversell
脚本下载:https://www.alipan.com/s/Q67dEzc3muS
2025.7.12更新修复连接池问题
如何使用?
1.安装LuaInMinecraftBukkit II插件2.将所需功能的对应代码放到plugins/LuaInMinecraftBukkitII/luaState/新建文件名.lua
3.在plugins/LuaInMinecraftBukkitII/config.json中加入初始化脚本名,具体参考LuaInMinecraftBukkit II的配置文件部分
4.执行"/lua reload"