监狱逻辑

监狱逻辑

The Jail (Logic) Mod 是一个服务端模组,允许你将玩家囚禁在虚拟监狱中,阻止他们与世界交互,直到被释放。它是 Fabric 服务器的理想选择,可用于执行临时惩罚或限制玩家移动。

游戏机制

Jail Mod (Fabric)

Jail Mod 是一个服务端模组,允许你将玩家关押在虚拟监狱中,阻止他们与世界交互,直到被释放。它非常适合需要施加临时惩罚或暂时限制某些玩家行动的 Minecraft 服务器。

jail

主要特性

  • 临时关押:你可以将玩家关押一段特定时间,期间阻止其与方块、实体和物品(例如熔岩桶或水桶)交互。

  • 自动或手动释放:玩家将在设定时间后自动释放,管理员也可以手动释放他们。
  • 关押原因:关押玩家时,你可以指定一个原因,该原因会告知该玩家。

  • 查询剩余时间的命令:被关押的玩家可以查看距离释放还剩多少时间。

使用方法:

  1. 建造一座监狱(一个封闭结构)。

  2. 使用命令 /jail set x y z 设置你希望囚犯生成的坐标(例如 /jail set 0 60 0)

  3. 使用 /jail reload 重新加载配置。

  4. 使用 /jail playerexample 120 Griefing 将某人送进监狱。

  5. 如果你不想等待以秒为单位设定的关押时间(例如 120 秒),可以使用命令 /unjail playerexample 提前释放该玩家。

前置要求

  • Minecraft 1.21 或更高版本
  • Fabric API

安装

  1. 将模组的 .jar 文件放入 Minecraft 服务器的 mods 文件夹中。
  2. 启动服务器以生成配置文件。

可用命令

1. /jail player time reason

  • 描述:将玩家关押指定秒数,并指定原因。
  • 使用者:仅限管理员或服务器 OP。
  • 语法: /jail player_name time_in_seconds reason
  • 示例: /jail Steve 300 Griefing该命令将玩家 Steve 关押 300 秒(5 分钟),原因为“Griefing”。

2. /unjail player

  • 描述:在时间到期前手动释放玩家。
  • 使用者:仅限管理员或服务器 OP。
  • 语法: /unjail player_name
  • 示例:/unjail Steve
    该命令将手动将 Steve 从监狱中释放。

3. /jail info

  • 描述:允许被关押的玩家查看距离释放的剩余时间以及关押原因。
  • 使用者:仅限被关押的玩家。
  • 示例: /jail info该命令将返回类似以下的消息:“You are in jail for another 200 seconds. Reason: Griefing.”

4. /jail reload

  • 描述:无需重启服务器即可重新加载模组配置和语言消息。
  • 使用者:仅限管理员或服务器 OP。
  • 示例: /jail reload该命令会重新加载模组的配置,在配置文件被修改后很有用。

5. /jail set

  • 描述:设置被关押玩家的生成坐标。玩家被送进监狱时将出现在此处。
  • 使用者:仅限管理员或服务器 OP。
  • 语法: /jail set x y z
  • 示例: /jail set 0 60 0
    该命令将监狱生成位置设置为坐标 (0, 60, 0)。

关押期间被阻止的交互

当玩家被关押时,他们无法进行以下操作:

  • 使用方块,例如门、拉杆或按钮。
  • 与实体交互,例如村民或动物。
  • 使用熔岩桶或水桶。
  • 破坏或放置方块。

自动释放

  • 当设定时间到期后,玩家将自动从监狱释放。
  • 被关押期间,玩家可以使用 /jail info 命令查看剩余时间。

配置文件

config/jailmod/config.json

该文件会自动生成,允许你配置监狱位置和玩家的释放位置。以下是你可找到的选项:

  • use_previous_position:如果设为 true,玩家将在被关押前所在的位置被释放。如果设为 false,他们将在指定位置被释放。
  • release_position:定义默认释放位置的坐标 x、y、z,当 use_previous_position 设为 false 时生效。
  • jail_position:定义监狱位置的坐标 x、y、z。

配置示例:

    {
    "use_previous_position": true,
    "release_position": {
      "x": 100,
      "y": 65,
      "z": 100
    },
    "jail_position": {
      "x": 0,
      "y": 60,
      "z": 0
    }
    }

config/jailmod/language.txt

该文件包含游戏内显示的消息,可自定义以匹配服务器的语气或风格。如果该文件不存在,将自动生成默认消息。以下是你可修改的部分消息:

  • jail_player:玩家被关押时收到的消息。使用变量 {time} 表示时长,{reason} 表示原因。
    示例:"You have been jailed for {time} seconds! Reason: {reason}"
  • jail_broadcast:当玩家被关押时向服务器所有玩家广播的消息。
    示例:"{player} has been jailed for {time} seconds. Reason: {reason}"
  • unjail_player_manual:玩家被手动释放时收到的消息。
    示例:"You have been manually released from jail!"
  • unjail_broadcast_manual:当玩家被手动释放时向服务器所有玩家广播的消息。
    示例:"{player} has been manually released from jail!"
  • unjail_player_auto:玩家在时间到期后自动释放时收到的消息。
    示例:"You have been released after serving your sentence."
  • unjail_broadcast_auto:当玩家在时间到期后自动释放时向服务器所有玩家广播的消息。
    示例:"{player} has been released after serving their sentence."
  • block_interaction_denied:告知玩家在监狱中无法与方块交互的消息。
    示例:"You cannot interact with blocks while in jail!"
  • entity_interaction_denied:告知玩家在监狱中无法与实体交互的消息。
    示例:"You cannot interact with entities while in jail!"
  • bucket_use_denied:告知玩家在监狱中无法使用熔岩桶或水桶的消息。
    示例:"You cannot use lava or water buckets while in jail!"
  • item_use_denied:告知玩家在监狱中无法使用物品的消息。
    示例:"You cannot use items while in jail!"
  • block_break_denied:告知玩家在监狱中无法破坏方块的消息。
    示例:"You cannot break blocks while in jail!"
  • jail_info_message:当玩家使用 /jail info 命令时显示剩余时间和关押原因的消息。
    示例:"You are in jail for another {time} seconds. Reason: {reason}."
  • not_in_jail_message:如果玩家不在监狱中却尝试使用 /jail info 时显示的消息。
    示例:"You are not in jail!"

默认 language.txt 示例:

    jail_player=You have been jailed for {time} seconds! Reason: {reason}
    jail_broadcast={player} has been jailed for {time} seconds. Reason: {reason}
    unjail_player_manual=You have been manually released from jail!
    unjail_broadcast_manual={player} has been manually released from jail!
    unjail_player_auto=You have been released after serving your sentence.
    unjail_broadcast_auto={player} has been released after serving their sentence.
    block_interaction_denied=You cannot interact with blocks while in jail!
    entity_interaction_denied=You cannot interact with entities while in jail!
    bucket_use_denied=You cannot use lava or water buckets while in jail!
    item_use_denied=You cannot use items while in jail!
    block_break_denied=You cannot break blocks while in jail!
    jail_info_message=You are in jail for another {time} seconds. Reason: {reason}.
    not_in_jail_message=You are not in jail!

使用提示

在更改配置或语言消息后,使用 /jail reload 命令应用更改,无需重启服务器。始终为关押指定明确的原因,以便玩家知道他们为何被关押。

使用示例

设置监狱生成位置:

/jail set 0 60 0

因不公平行为关押玩家:

/jail Alex 600 Offending another player

这将把 Alex 关押 10 分钟,原因为“Offending another player”。

查看关押时间:

/jail info

被关押的玩家可以使用该命令查看还剩多少时间。