Better-Whitelist 为你的服务器提供了一个基础白名单系统,你可以根据自身需求进行调整。
该模组需要在服务端和所有连接至服务端的客户端上都安装。
白名单通过 μScript 进行配置,但你无需具备编程技能即可使用此模组。
当你首次启动带有该模组的服务端时,会生成一个包含更多详细信息的配置文件。
Better-Whitelist 的一个简单配置示例如下(请注意,在使用此配置时,你可能需要为具有可选服务端组件的客户端模组添加例外):
// 将模组转换为更简单的表示形式以节省带宽
simplify = { mod -> { id = mod.id, version = mod.version } }
// 服务端上存在的所有非纯服务端模组
sharedMods = mods::values()
::filter({ v -> v.environment != 'server' & v.id != 'java' })
::map(simplify)
// 确保客户端拥有服务端上每个非纯模组的正确版本
clientMissing = challenge({ arg ->
arg::filter({ v -> !mods::values()::anyMatch({ m -> v.id == m.id & v.version == m.version }) })
}, sharedMods)
assert(clientMissing::isEmpty(), 'You lack required mods: ' || clientMissing)
// 确保客户端没有额外的、在服务端必需的模组
clientAdditional = challenge({ arg, fn ->
clientSideMods = mods::values()::filter({ v -> v.environment != 'client' & v.id != 'java' })
clientSideMods::filter({ v -> !arg::anyMatch({ m -> v.id == m.id & v.version == m.version }) })::map(fn)
}, sharedMods, simplify)
assert(clientAdditional::isEmpty(), 'You have unsupported mods: ' || clientAdditional)
// 过滤资源包中的 X-Ray 作弊包
bannedWords = listOf('xray', 'x-ray', 'cheat')
assert(!challenge({ ->
resourcePacks::map({ pack -> pack.name || ' ' || pack.displayName || ' ' || pack.description })
})::anyMatch({ v -> bannedWords::anyMatch({ word -> v::toLower()::contains(word) }) }), "Please don't cheat, " || user.name)
以下变量可供你的脚本使用:
- μScript 标准库中的所有方法(包括日期/时间相关功能,这意味着你可以临时加入或移除白名单/黑名单用户,或创建倒计时)
resourcePacks(仅限客户端):资源包列表,每个资源包包含name、displayName和description字段println('message')(两端通用):用于调试的输出函数mods(两端通用):已加载模组列表,其字段与mod()返回的结果相同mod('id')(两端通用):特定模组的信息(若无则为 null):包含id、name、description、authors(字符串列表)、contributors(字符串列表)、version、environment(值为client、server或*)、license、contact(同 FMJ 规范)、depends(字符串列表)assert(bool)(服务端):断言某个条件为真,若不为真则踢出玩家(可选地,可将消息作为第二个参数传入)challenge({->closure}, additional arguments...)(服务端):向客户端发送一个闭包以便在其上执行。参数中可以包含其他闭包。user(服务端):尝试登录的用户信息,包含其id和name
Better-Whitelist provides a basic whitelist system for your server that you can adapt to your use case.
The mod is required both on the server and any clients connecting to the server.
The whitelist is configured using μScript, but you don't have to be good at programming to use this mod.
A config file with some additional details will be created when you first start your server with the mod.
A simple config for Better-Whitelist could look as follows (please note that you'd probably have to add exceptions for client-side mods with optional server-side components when using this):
// convert a mod to a simpler representation to save bandwidth
simplify = { mod -> { id = mod.id, version = mod.version } }
// all non-serverside mods present on the server
sharedMods = mods::values()
::filter({ v -> v.environment != 'server' & v.id != 'java' })
::map(simplify)
// ensure the client has the correct version of every non-serverside mod on the server
clientMissing = challenge({ arg ->
arg::filter({ v -> !mods::values()::anyMatch({ m -> v.id == m.id & v.version == m.version }) })
}, sharedMods)
assert(clientMissing::isEmpty(), 'You lack required mods: ' || clientMissing)
// ensure the client has no additional mods that would be required on the server
clientAdditional = challenge({ arg, fn ->
clientSideMods = mods::values()::filter({ v -> v.environment != 'client' & v.id != 'java' })
clientSideMods::filter({ v -> !arg::anyMatch({ m -> v.id == m.id & v.version == m.version }) })::map(fn)
}, sharedMods, simplify)
assert(clientAdditional::isEmpty(), 'You have unsupported mods: ' || clientAdditional)
// filter resource packs for X-Ray packs
bannedWords = listOf('xray', 'x-ray', 'cheat')
assert(!challenge({ ->
resourcePacks::map({ pack -> pack.name || ' ' || pack.displayName || ' ' || pack.description })
})::anyMatch({ v -> bannedWords::anyMatch({ word -> v::toLower()::contains(word) }) }), "Please don't cheat, " || user.name)
The following things are available to your scripts:
- All methods from the μScript standard library (including date/time, meaning you can temporarily whitelist or blacklist users or create countdowns)
resourcePacks(client only): a list of resource packs, each of which has aname,displayNameanddescriptionprintln('message')(both): a function for debuggingmods(both): a list of loaded mods with the same fields as the result ofmod()mod('id')(both): information about a specific mod (or null):id,name,description,authors(list of strings),contributors(list of strings),version,environment(eitherclient,serveror*),license,contact(same as FMJ),depends(list of strings)assert(bool)(server): assert that something is true and kick the player if it's not (optionally, add a message as the second parameter)challenge({->closure}, additional arguments...)(server): send a closure to the client to be executed there. The arguments may contain other closures.user(server): information about the user trying to log in, namely theiridandname
下载 Better Whitelist
下载 Better Whitelist
下载 Better Whitelist
下载 Better Whitelist
下载 Better Whitelist
下载 Better Whitelist
下载 Better Whitelist
下载 Better Whitelist
下载 Better Whitelist
下载 Better Whitelist
Release 26.3.0 的提交内容:
- chore: 更新至 26.3
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个基于构建器的 Minecraft 配置库!
模组
? 使用命令保存和加载玩家或他人的背包/套装。
模组
一款轻量级模组,允许服务器管理员对抗透视作弊者。
模组
恢复所有账户的游戏聊天访问权限
模组
通过图形界面控制模组加载。适用于需要可选功能的整合包和服务器,也适合不想手动操作文件而希望直接管理模组的极客用户。
模组
实体tick优化
评论 0
登录后参与评分
还没有评论,来抢沙发吧