Contagion — 基于接触的传播引擎

插件

原名 Contagion — Contact-Based Outbreak Engine · 作者 XenbleDev

一个适用于 Paper 的可配置感染引擎:通过近距离传播,静默潜伏,经历症状阶段升级,并最终导致变异——包含隔离区和可制作的解药。

0 本站下载 0 关注 更新于 2 个月前

最新 1.0.0 · 1.21.11 · Paper / Purpur

一键开服(送7天)

Contagion

Contagion 将你的服务器变成一个爆发场景。感染通过近距离接触在玩家之间传播,经历静默潜伏期,通过可配置的症状阶段升级,最终转化宿主。玩家可以通过隔离区和可制作的解药来反击。

所有设置——包括时间、症状、药水效果、概率、消息和配方——均由 config.yml 驱动。无需其他插件或外部服务。

HEALTHY ──infected──▶ INCUBATING ──▶ STAGE 1 ──▶ STAGE 2 ──▶ … ──▶ STAGE N ──▶ TURNED
   ▲                                                                              │
   └──────────────── antidote / /cg cure  (+ immunity window) ────────────────────┘

✨ Features

  • ? Proximity transmission — 每个扫描间隔内,传染性玩家会在半径内寻找健康玩家。概率为 base-chance × stage multiplier × distance falloff,可选视线要求。
  • ⏳ Silent incubation — 无症状窗口期,在此期间玩家可能已成为携带者,导致爆发在任何人察觉之前就开始。
  • ? Symptom stages — 任意数量的阶段,每个阶段都有自己的持续时间、药水效果、聊天消息和传染性倍数。
  • ? Transformation — 最终状态:永久性的重度效果、最大传染性、发光,默认情况下解药无法治愈。
  • ? Quarantine zones — 圆柱形区域,可选垂直限制。标志位阻止区域内的传播并在边界处将受感染的玩家推回。
  • ? Craftable antidote — 自定义形状的配方。物品通过持久数据标签标识,因此在铁砧上重命名它仍能正常工作,而外观相似的仿制品则无效。
  • ? Action bar HUD — 受感染的玩家会看到当前阶段以及到下一阶段的倒计时。
  • ? Offline-aware progression — 基于时间戳的进度,中途登出的玩家在重新登录时会保留正确的剩余时间,并在离线期间推进阶段。
  • ? Developer API — ContagionInfectEvent(可取消)、ContagionStageChangeEvent、ContagionCureEvent。

该插件仅使用稳定的 Bukkit/Paper 和 Adventure API——不涉及 NMS 或对服务器内部的反射调用。

? Commands

根命令:/contagion,别名 /cg。所有参数均支持自动补全(玩家名称、阶段 ID、区域名称、标志名称)。

Command Description Permission
/cg status [player] 状态、阶段、剩余时间和免疫期 contagion.status
/cg infect <player> [stage] 感染一名玩家;如果不指定 [stage],他们将从潜伏期开始 contagion.admin
/cg cure <player> 完全治愈并进入配置的免疫期 contagion.admin
/cg outbreak start [count] 随机选择在线的健康玩家作为零号病人 contagion.admin
/cg outbreak stop 治愈所有人并结束爆发 contagion.admin
/cg zone add <name> <radius> [flag=value…] 以你所在的位置为中心创建一个区域 contagion.admin
/cg zone remove <name> 删除一个区域 contagion.admin
/cg zone list 列出带有其标志的区域 contagion.admin
/cg zone flag <name> <flag> <true|false> 切换区域标志 contagion.admin
/cg reload 重新加载 config.yml + zones.yml 并重新注册配方 contagion.admin

/cg infect 接受阶段 ID(如 mild)、从 1 开始的数字(如 2)或 turned。/cg zone add 也接受 y-min=<value> 和 y-max=<value>:

/cg zone add hospital 24 deny-infected-entry=true y-min=50 y-max=90

Permissions

Node Default Grants
contagion.status everyone 对自己使用 /cg status
contagion.status.others op 对 <other player> 使用 /cg status
contagion.admin op 所有管理子命令

⚙️ Configuration

所有颜色代码使用 &(十六进制颜色使用 &#RRGGBB)。

transmission:
  enabled: true
  check-interval-ticks: 40      # 20 ticks = 1 second
  radius: 4.0                   # blocks
  base-chance: 0.15             # per scan (0.0-1.0)
  distance-falloff: true        # chance *= (1 - distance / radius)
  require-line-of-sight: false
  contagious-during-incubation: true
  ignore-same-team: false
  ignored-gamemodes: [CREATIVE, SPECTATOR]
  ignored-worlds: []

incubation:
  duration-seconds: 180
  notify-on-symptom-start: true

stages:                          # ordered; add or remove entries freely
  - id: mild
    duration-seconds: 300
    contagious-multiplier: 1.0
    message: "&7Your throat feels sore..."
    effects:
      - "SLOWNESS:0:ambient"     # TYPE:AMPLIFIER[:ambient] - amplifier 0 = level I
  - id: moderate
    duration-seconds: 300
    contagious-multiplier: 1.5
    message: "&eA fever is setting in."
    effects: ["SLOWNESS:0", "WEAKNESS:0", "HUNGER:0"]
  - id: severe
    duration-seconds: 240
    contagious-multiplier: 2.0
    message: "&cYour vision is fading!"
    effects: ["SLOWNESS:1", "WEAKNESS:1", "BLINDNESS:0:ambient", "MINING_FATIGUE:0"]

turned:
  enabled: true                  # if false, the last stage simply never ends
  contagious-multiplier: 3.0
  curable-by-antidote: false
  glowing: true
  effects: ["SLOWNESS:1", "WEAKNESS:2", "STRENGTH:0", "HEALTH_BOOST:1"]
  broadcast: "&4&l{player} has turned!"

cure:
  immunity-seconds: 300          # 0 disables immunity
  clear-effects: true
  message: "&aThe infection has been cleared from your blood."

antidote:
  enabled: true
  item:
    material: POTION             # must be consumable
    name: "&bAntidote"
    lore: ["&7Clears the infection."]
    custom-model-data: 7301
    potion-color: "#2FD0C4"
  recipe:                        # shaped, up to 3x3, spaces are empty slots
    shape: ["  G", " NF", "B  "]
    ingredients:
      G: GHAST_TEAR
      N: NETHER_WART
      F: FERMENTED_SPIDER_EYE
      B: GLASS_BOTTLE

outbreak:
  auto-start-on-boot: false
  patient-zero-count: 1
  broadcast-on-infect: false

death:
  cure-on-death: false

hud: action-bar: true format: "&c感染阶段:&f{stage} &8| &7剩余时间"


效果类型通过服务器注册表按名称解析,因此现代拼写(`SLOWNESS`、`MINING_FATIGUE`)和旧版拼写(`SLOW`、`SLOW_DIGGING`)均可正常使用。遇到未知效果时会记录日志并跳过,而不会导致阶段中断。仅移除 Contagion 施加的效果——玩家自行饮用的药水不受影响。

### 区域配置 (`zones.yml`)

由命令生成,但可手动编辑:

```yaml
zones:
  hospital:
    world: world
    x: 120.5
    y: 64.0
    z: -340.5
    radius: 24.0
    y-min: 50        # 可选;若未设置,则圆柱体在垂直方向上无边界限制
    y-max: 90
    flags:
      block-transmission: true
      deny-infected-entry: true

? 运行环境要求

服务端 Paper 1.21 – 1.21.11(或基于 Paper 的分支版本)
Java 21+
依赖项 无

? 安装步骤

  1. 下载 Contagion 的 jar 文件,并将其放入服务端的 plugins/ 文件夹中。
  2. 启动一次服务器 —— 此时会生成 plugins/Contagion/config.yml 配置文件。
  3. 根据需要修改配置文件,然后执行 /cg reload(无需重启服务器)。

玩家状态存储在本地 SQLite 数据库中。首次启动时,SQLite JDBC 驱动程序由 Paper 的库加载器自动下载;如果在全离线服务器上无法完成该下载,Contagion 会记录一条警告日志,并回退到使用 YAML 数据文件存储。

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源