LifeSteal
一个基于 Fabric 的服务端模组,实现了 LifeSteal SMP(生命吸取生存多人游戏)玩法。
更新至 v2.0.0 的注意事项
自 v1.2.0 版本以来,模组发生了大量更改,因此配置文件的结构也发生了很大变化(主要是新增了一些配置项)。
此外,如果您希望在玩家生命值降至 0 时禁用封禁功能,请查看配置文件中的 punishment(惩罚)部分,因为该选项已被移动至此。
所需模组
此模组依赖 BFAPI
命令
此模组添加了一个用于修改和获取玩家已损失生命值的命令,其通用结构如下:
/alias [get [uuid/name]]/[set [uuid/name] value]
这允许管理员在不重启服务器的情况下对玩家的生命值进行管理。
配置文件
配置文件位于配置目录下的 lifesteal.json 中。
{
"comment-maxHealth": "可以获得的*总*最大生命值上限,如果小于 0 则将被忽略",
"maxHealth": -1.0,
"comment-minHealth": "玩家能达到的最小*总*生命值,达到此值后,该玩家将无法再为他人提供心跳(生命值)",
"minHealth": 0.0,
"comment-healthToLooseOnDeath": "玩家死亡时失去的生命值数量",
"healthToLooseOnDeath": 2.0,
"comment-looseHealthOnlyOnPlayerRelatedDeath": "此开关决定玩家是否会因非玩家造成的死亡而损失生命值;若为 true,则不会因非玩家原因损失生命值",
"looseHealthOnlyOnPlayerRelatedDeath": false,
"punishment": {
"banWhenHealthReachesZero": true,
"banReason": {
"text": "由于您的生命值已降至 0,您已被封禁!"
}
},
"comment-notEnoughHeartsMessage": "当您击杀的玩家没有足够的生命值供您吸取时显示的消息",
"notEnoughHeartsMessage": {
"text": "该玩家没有任何您可以吸取的心跳"
},
"command": {
"comment-enableCommands": "是否注册命令",
"enableCommands": true,
"comment-aliases": "命令将注册的别名列表",
"aliases": [
"lifesteal",
"ls"
],
"comment-permission": "修改玩家生命值所需的权限 *如果您没有权限数据库,等级可设置为所需的操作员等级*",
"permission": {
"node": "lifesteal.modify",
"level": "op_3"
},
"comment-successMessage": "当玩家设置另一个玩家的生命值时发送给该玩家的消息",
"successMessage": {
"color": "green",
"text": "完成!"
},
"comment-successMessageFile": "当玩家设置另一个玩家的生命值但对方不在线,导致消息被存储以便在对方上线时应用时发送的消息",
"successMessageFile": {
"color": "green",
"text": "完成!(已存档)"
},
"comment-broadcastToOps": "是否向所有操作员广播设置玩家生命值的操作"
,
"broadcastToOps": true
},
"recipe": {
"comment-allowCraftingOfHealth": "如果在 lifesteal:health 下未找到自定义配方,是否注册默认的生命值合成配方",
"allowCraftingOfHealth": true,
"comment-registerRequirements": "除非遇到冲突错误,否则请勿禁用此项,其他模组的配方可能依赖于它",
"registerRequirements": true,
"comment-registerResults": "除非遇到冲突错误,否则请勿禁用此项,其他模组的配方可能依赖于它",
"registerResults": true
},
"marks": {
"comment-enableMarks": "是否监听标记,这是生命值物品所必需的",
"enableMarks": true,
"comment-marks": "将监听的标记列表,如果您移除或修改了其中任何一项,请确保更新合成配方的标记",
"marks": [
"lifesteal",
"health"
],
"comment-limiter": "玩家在停止之前可以消耗生命值的最大次数,如果 <1 则将被忽略",
"limiter": -1,
"output": {
"comment-markOutputSuccess": "实体成功消耗带有标记的物品时发送的消息",
"markOutputSuccess": {
"text": "您消耗了一些生命值"
},
"comment-markOutputFailed": "实体因未能通过限制器检查而失败消耗带有标记的物品时发送的消息",
"markOutputFailed": {
"color": "red",
"text": "您已经消耗了足够的生命值"
},
"comment-broadcastToOpsMarks": "是否告知操作员玩家已消耗带有标记的物品"
,
"broadcastToOps": true
}
}
}
链接
API 使用
此模组提供了一个简单的接口 LifeStealable,用作 API 进行调用。
LifeStealable 允许模组获取玩家的已损失生命值并根据需要对其进行修改,同时允许将其实现到自定义实体中,以便它们在死亡时可以被用来获取生命值。
任何 LifeStealable 的实现都应在生命值发生变化时始终调用 setLostHealth。
标记 (Marks)
LifeSteal 添加了一组可自定义的标记(查看子项 marks 以获取单个标记详情),默认值为 lifesteal 和 health。
当这些标记应用于 ItemStack(物品堆)且该 ItemStack 被使用时,会向用户发送相应的消息:
如果用户获得的生命值超过了限制器允许的数量,将发送 markOutputFailed;否则将发送 markOutputSuccess。
配方
现在 LifeSteal 添加了几个新的配方需求/结果。
需求 (Requirements)
LifeSteal 为自定义配方添加了 3 个新需求,分别是:
| 需求 ID |
描述 |
预期值 |
| losthealth> |
确保合成者已损失至少给定数值的生命值 |
整数 |
| losthealth< |
确保合成者损失的生命值少于给定数值 |
整数 |
| losthealth= |
确保合成者损失的生命值等于给定数值 |
整数 |
这些条件可用于将配方锁定到特定的生命值状态。例如,将 losthealth< 设置为 -2 时,只有那些获得了一格心(即生命值有所恢复)的玩家才能进行合成。
结果
LifeSteal 为自定义配方新增了 3 种结果类型,具体如下:
| 结果 ID |
描述 |
预期值 |
| gainhealth |
给予玩家指定数值的生命值 |
整数 |
| loosehealth |
从玩家身上扣除指定数值的生命值 |
整数 |
| sethealth |
将玩家损失的生命值设置为指定数值 |
整数 |
LifeSteal
A fabric server side implementation of the LifeSteal SMP
Notice for when updating to v2.0.0
There has been alot of changes since v1.2.0 and as a result the config is very different (i only really added stuff)
Also if you want to disable banning of users when they reach 0 health have a look under punishment in the config as it has been moved
Required Mods
This mod is dependent on BFAPI
Commands
This mod adds a command that can be used to modify and get a players lost health, the general structure is as follows:
/alias [get [uuid/name]]/[set [uuid/name] value]
This allows for moderation of players health without lengthy server restarts
Config
The config is found under lifesteal.json in the config directory
{
"comment-maxHealth": "The maximum *total* health that can be gained, if less than 0 it will be ignored",
"maxHealth": -1.0,
"comment-minHealth": "The minimum *total* health that someone can be at, when this value is reached they cannot be used to gain hearts",
"minHealth": 0.0,
"comment-healthToLooseOnDeath": "The amount of health to be lost when a player dies",
"healthToLooseOnDeath": 2.0,
"comment-looseHealthOnlyOnPlayerRelatedDeath": "This toggle dictates if a player can loose health from deaths that are not caused by a player, if true then they cannot",
"looseHealthOnlyOnPlayerRelatedDeath": false,
"punishment": {
"banWhenHealthReachesZero": true,
"banReason": {
"text": "You have been banned due to your health reaching 0!"
}
},
"comment-notEnoughHeartsMessage": "The message that is displayed when you kill a player that doesn't have enough hearts to kill you",
"notEnoughHeartsMessage": {
"text": "The player did not have any hearts you could steal"
},
"command": {
"comment-enableCommands": "If the commands should be registered",
"enableCommands": true,
"comment-aliases": "The aliases that the command will register under",
"aliases": [
"lifesteal",
"ls"
],
"comment-permission": "The permission required to modify a players health *if you dont have a permission db the level can be set to the wanted operator level*",
"permission": {
"node": "lifesteal.modify",
"level": "op_3"
},
"comment-successMessage": "The text sent to the player when they set another players health",
"successMessage": {
"color": "green",
"text": "Done!"
},
"comment-successMessageFile": "The text sent to the player when they set another players health but they are not online so it stored it to be applied when the player joins",
"successMessageFile": {
"color": "green",
"text": "Done! (to file)"
},
"comment-broadcastToOps": "If setting a players health should be broadcasted to all operators",
"broadcastToOps": true
},
"recipe": {
"comment-allowCraftingOfHealth": "If the default recipe should be registered if a custom one is not found under lifesteal:health",
"allowCraftingOfHealth": true,
"comment-registerRequirements": "Don't disable this unless you have a conflicting error, other mods recipes may depend on it",
"registerRequirements": true,
"comment-registerResults": "Don't disable this unless you have a conflicting error, other mods recipes may depend on it",
"registerResults": true
},
"marks": {
"comment-enableMarks": "If marks should be listened to, this is needed for health items",
"enableMarks": true,
"comment-marks": "The list of marks that will be listened to, if you remove/modify any of these ensure you update the crafting recipes mark",
"marks": [
"lifesteal",
"health"
],
"comment-limiter": "The maximum number of times a player can consume health before they are stopped, if <1 this is ignored",
"limiter": -1,
"output": {
"comment-markOutputSuccess": "Sent to an entity when they consume a marked item sucessfully",
"markOutputSuccess": {
"text": "You consumed some health"
},
"comment-markOutputFailed": "Sent to an entity when they fail consume a marked item due to failing the limiter check",
"markOutputFailed": {
"color": "red",
"text": "You have already consumed your fill of health"
},
"comment-broadcastToOpsMarks": "If operators should be told when a player consumes a marked item",
"broadcastToOps": true
}
}
}
Links
Api utilisation
This mod adds a (simple interface)[ for using it as an API, LifeStealable
LifeStealable allows for a mod to get a players lost health and modify it as needed while also allowing it to be implemented on custom entities so that they can be used to gain health on death
Any LifeStealable implementation should always call setLostHealth when ever the health changes
Additions to BFAPI
Marks
LifeSteal adds a customisable set of marks (check the sub marks for individual marks) that default as lifesteal and health
When these marks are applied to an ItemStack and said ItemStack is used the appropriate message is sent to the user:
If the user has more gained health than the limiter allows it will send markOutputFailed elsewise markOutputSuccess will be sent
Recipes
There are now a couple of recipe requirements/results that are added by LifeSteal
Requirements
LifeSteal adds 3 new requirements to custom recipies, these are:
| Requirement ID |
Description |
Expects |
| losthealth> |
Ensures the crafter has lost atleast the given amount of health |
Integer |
| losthealth< |
Ensures the crafter has lost less the given amount of health |
Integer |
| losthealth= |
Ensures the crafter has lost the given amount of health |
Integer |
These can be utilised to lock recipes to certain health levels such as losthealth< being set to -2 will only be craftable by those who have gained a heart
Results
LifeSteal adds 3 new results to custom recipies, these are:
| Result ID |
Description |
Expects |
| gainhealth |
Gives the player the given amount of health |
Integer |
| loosehealth |
Takes the given amount of health from the player |
Integer |
| sethealth |
Sets the players lost health to the given amount |
Integer |
评论 0
登录后参与评分
还没有评论,来抢沙发吧