离线玩家缓存是什么?
离线玩家缓存(Offline Player Cache,简称 OPC)是一款基于 Fabric 框架开发的 Minecraft API 模组,旨在允许服务器在玩家离线时缓存其数据。这意味着模组可以利用此 API 访问离线玩家的数据。该功能主要开发用于为包含离线玩家的 Minecraft 服务器提供全局且持久的排行榜系统。
具体功能
模组可以注册接收一个玩家并输出一个值/对象的函数;该值/对象仅限于键的 NBT 数据读写所指定的范围。当玩家断开与服务器的连接时,所有已注册的函数都会被调用,并在玩家断开连接之前将相应数据缓存在服务器上。这些数据会保存到服务器的关卡数据中,并且可以随时访问。当同一玩家重新连接到服务器时,其缓存的数据会被删除;此时若调用值函数,它将返回基于在线玩家的当前值/对象。
命令
/opc get uuid|name <uuid|name> <key>返回指定 UUID/名称玩家对应的值;如果玩家在线,则返回其当前值;如果玩家离线,则返回其缓存的值;否则返回 null。如果该值是instanceofNumber类型且在命令方块中运行,红石信号强度将为绝对模数 16。/opc remove uuid|name <uuid|name> <key>如果指定的 UUID/名称玩家处于离线状态,则移除由输入键确定的该玩家的缓存值;如果玩家在线,则无操作。/opc remove uuid|name <uuid|name>如果指定的 UUID/名称玩家处于离线状态,则移除其所有缓存数据;如果玩家在线,则无操作。
注意事项
- 此 API 模组本身不会注册任何可缓存的值,因此不会缓存任何玩家数据,单独使用时无效。
- 要在你的模组中使用此 API,可以在 Gradle 构建文件中包含以下内容(更多详情请参见 Modrinth Maven):
repositories {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}
dependencies {
modImplementation "maven.modrinth:offline-player-cache:<version>"
include "maven.modrinth:offline-player-cache:<version>"
}
What is Offline Player Cache?
Offline Player Cache (OPC) is a Minecraft API mod built using the Fabric framework to allow caching player data on the server while the player is offline. This means that mods can use this API to access offline player's data. This was primarily developed as a way to allow global and persistent leaderboards for Minecraft servers that included offline players.
Specific Capabilities
Mods can register functions that take in a player and output a value/object; this value/object is limited only by what is specified in the key's read/write to/from nbt data. When a player disconnects from a server, all registered functions are called and the respective data is cached on the server before the player disconnects. This data is saved to the server's level data, and can be accessed any time. When the same player connects to the server, their cached data is deleted and instead when a value function is called, it returns the current value/object based on the online player.
Commands
/opc get uuid|name <uuid|name> <key>Returns the input uuid/name player's value; if they are online, returns their current value, if they are offline returns their cached value; else returns null. If the value is aninstanceofNumberand run from a command block, the redstone output is the absolute modulus of 16./opc remove uuid|name <uuid|name> <key>If the input uuid/name player is offline, removes that player's cached value determined by the input key; if the player is online, does nothing./opc remove uuid|name <uuid|name>If the input uuid/name player is offline, removes all of their cached data; if the player is online, does nothing.
Notes
- This API mod does not itself register any cacheable values, and hence does not cache any player data, and therefore does nothing by itself.
- To use this API in your mod, you can include the following in your gradle build (see Modrinth Maven for more details):
repositories {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}
dependencies {
modImplementation "maven.modrinth:offline-player-cache:<version>"
include "maven.modrinth:offline-player-cache:<version>"
}
下载 Offline Player Cache
下载 Offline Player Cache
下载 Offline Player Cache
下载 Offline Player Cache
下载 Offline Player Cache
下载 Offline Player Cache
下载 Offline Player Cache
下载 Offline Player Cache
未指定更新日志。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
适用于 MC 1.18+ 的 Effekseer 加载器
评论 0
登录后参与评分
还没有评论,来抢沙发吧