Configuration

The config lives at plugins/CreeperConfettiPro/config.yml. Every key can also be changed with /cc commands; after hand-editing, run /cc reload.

Config structure

KeyTypeDefaultPurpose
config-versionint6Migration marker — do not edit
debugboolfalseVerbose logs: style list, chances, GeoIP details
confetti_chance0–100100Overall chance for a creeper to become a firework
command-aliasessectionall onSwitches for /cc and /confetti
update-checkersectionenabledGitHub release check, OP notices, optional token
languagestringautoPlugin language, auto or a language code
firework_stylessection4 built-in stylesStyle definitions
firework_chancessection40/30/20/10Per-style weights, normalised to 100% on load

confetti_chance

The overall trigger chance, 0 to 100, decimals allowed. On every creeper explosion the plugin rolls a random 0–100 value and only converts the blast when the roll is below this number.

# every creeper becomes a firework
confetti_chance: 100

# roughly one in four
confetti_chance: 25

# one in ten thousand — a rare easter egg
confetti_chance: 0.01

The in-game equivalent is /cc chance 25. The command clamps to 0–100 and rejects anything else; the file itself is not validated, so 150 behaves like 100 and a negative value like 0.

v

This is the overall chance and is independent of the per-style weights: first the plugin decides whether this explosion becomes a firework at all, then it draws a style from firework_chances.

command-aliases

The plugin registers /cc and /confetti at runtime through the server's CommandMap rather than in plugin.yml — Bukkit has no way to toggle aliases declared in the plugin file after startup.

command-aliases:
  enabled: true      # master switch
  cc: true           # /cc
  confetti: true     # /confetti
SituationBehaviour
Alias already taken by another pluginSkipped with a console warning; everything else keeps working
Alias disabled hereSilently skipped; the reason is logged when debug: true
enabled: falseNeither alias is registered; only /creeperconfetti works
/cc reloadAll aliases are unregistered and re-registered from the new config, so conflicts are re-checked

If the "already registered" warning is noise on your server, set that alias to false. The warning never affects functionality — it just tells you the alias is redundant.

language

Controls every player-facing message and the console banner.

# pick a language from the server's IP region
language: auto

# pin English
language: en_us

# legacy codes still work and are converted
language: en

Values and the country mapping are listed under Languages. An unrecognised code logs a warning and falls back to en_us.

debug

When enabled the plugin also logs:

  • the number of styles loaded plus their full name list;
  • the chances after normalisation;
  • GeoIP details (which endpoints were queried, which country was detected, which language that maps to);
  • why an alias registration was skipped.
i

Debugging "why did no firework appear" or "why is it still English" starts here — turn debug on and restart; the log usually answers it directly.

Update checker

On enable the plugin asks the GitHub Releases API for the newest published version and prints a console notice when a newer one exists. The check runs asynchronously about five seconds after startup (Bukkit: a task delayed 100 ticks; Folia: an async scheduler), so it never blocks the server.

KeyDefaultPurpose
enabledtrueSwitch the whole check off
notify-opstrueSend operators a one-time in-game notice when they join and an update is available
github-token""Optional classic token with only the public_repo scope

Anonymous GitHub requests are limited to 60 per hour per IP. Shared hosting and cloud IPs often exhaust that quota, which shows up in the log as [Update] GitHub returned HTTP 403. A token raises the limit to 5000 per hour. Instead of putting it in the config, set the CREEPERCONFETTI_GITHUB_TOKEN environment variable (or GITHUB_TOKEN) — that keeps the token out of config.yml and out of the backups/ folder. Resolution order is the config value, then CREEPERCONFETTI_GITHUB_TOKEN, then GITHUB_TOKEN.

i

The in-game notice is sent once per server session per operator, and only when notify-ops is on. A 403 or 429 is logged once per session with the rate-limit reset time; it never affects the plugin's behaviour.

Config version & migration

config-version at the top of the file drives migration. The current value is 6. It is only checked on enable — /cc reload does not migrate.

  1. Same version → nothing happens

    If the stored version is 6 or higher the migrator returns immediately without reading or writing.

  2. Older version → back up first

    The existing file is copied to backups/config-backup-<yyyyMMdd-HHmmss>.yml before anything changes.

  3. Convert the old format

    Version 0 (a config with no config-version key at all) has its old single-effect list confetti_effect turned into a style named default, keeping every colour and shape.

  4. Merge new keys

    Keys added by newer versions are merged in. Existing values are never overwritten. The new version number is then written.

!

Migration only runs at startup. If you lower config-version by hand, the next restart migrates again — and this time the "old" values come from your current file, which is rarely what you want. Leave the number alone.

Full example

A complete, ready-to-use config with four preset styles:

# config version — do not edit
config-version: 6

# verbose logging
debug: false

# overall chance for a creeper to become a firework (0-100)
confetti_chance: 100

# command aliases
command-aliases:
  enabled: true
  cc: true
  confetti: true

# update checker (GitHub Releases)
update-checker:
  enabled: true
  notify-ops: true
  github-token: ""

# language: auto / en_us / zh_cn / ...
language: auto

# firework styles: any number, one is picked at random per explosion
firework_styles:
  classic:
    type: BALL
    flicker: true
    trail: false
    colors:
      - RED
      - YELLOW
      - WHITE
    fade-colors:
      - ORANGE
  starburst:
    type: STAR
    flicker: true
    trail: false
    colors:
      - AQUA
      - WHITE
      - BLUE
    fade-colors:
      - PURPLE
  rainbow:
    type: BURST
    flicker: false
    trail: true
    colors:
      - RED
      - ORANGE
      - YELLOW
      - GREEN
      - AQUA
    fade-colors:
      - WHITE
  creeper:
    type: CREEPER
    flicker: true
    trail: true
    colors:
      - GREEN
      - LIME
    fade-colors:
      - GREEN

# per-style weights, normalised to 100%
firework_chances:
  classic: 40
  starburst: 30
  rainbow: 20
  creeper: 10

After using commands, the file looks different

Once you change styles through /cc effect add, /cc effect chance or the GUI, the plugin rewrites the firework_styles and firework_chances sections. Styles are then stored in Bukkit's serialised form:

firework_styles:
  classic:
  - ==: org.bukkit.FireworkEffect
    type: BALL
    flicker: true
    trail: false
    colors:
    - ==: org.bukkit.Color
      RGB: 16711680
    fade-colors:
    - ==: org.bukkit.Color
      RGB: 16755200

This is normal, not corruption — it loads fine, it is just unpleasant to hand-edit. To get the readable form back:

  • run /cc effect reset to restore the four built-in styles (still serialised);
  • or stop the server and replace the whole firework_styles block with the hand-written example above, then start again.
v

Suggested workflow: capture styles in game with /cc effect add or the GUI (it reads the firework in your hand), and only touch the YAML for bulk edits or version control.

配置文件

配置文件位于 plugins/CreeperConfettiPro/config.yml。所有键都可以通过 /cc 系列指令修改,手改之后执行 /cc reload 即可生效。

配置结构总览

键类型默认值作用
config-version整数6配置版本标识,用于自动迁移,不要手改
debug布尔false输出样式列表、概率、GeoIP 探测等详细日志
confetti_chance0–100100苦力怕变成烟花的整体概率
command-aliases节点全开/cc 与 /confetti 别名的开关
update-checker节点开启发行版检查、OP 提示与可选 GitHub 令牌
language字符串auto插件语言,auto 或语言代码
firework_styles节点4 个内置样式烟花样式定义
firework_chances节点40/30/20/10各样式权重,加载时自动归一化为 100%

confetti_chance

整体触发概率,取值 0 到 100,支持小数。判定方式是每次苦力怕爆炸时生成一个 0–100 的随机数,小于该值才转为烟花。

# 每一只苦力怕都变成烟花
confetti_chance: 100

# 大约四分之一
confetti_chance: 25

# 万分之一,节日彩蛋
confetti_chance: 0.01

游戏内等价指令:/cc chance 25。指令会把值限制在 0–100,超出范围直接拒绝并提示;手改配置文件则不做校验,写 150 等价于 100,写负数等价于 0。

v

这个概率是整体概率,与单个样式的权重是两个维度:先判断这次要不要变烟花,命中后再按 firework_chances 抽具体样式。

command-aliases

插件会在启用时通过服务端 CommandMap 动态注册 /cc 与 /confetti 两个别名,而不是写在 plugin.yml 里——因为 Bukkit 没有办法在运行时开关 plugin.yml 中声明的别名。

command-aliases:
  enabled: true      # 总开关
  cc: true           # /cc
  confetti: true     # /confetti
场景行为
别名已被其他插件占用跳过该别名,控制台输出一条警告,插件其余功能不受影响
别名被本插件关闭静默跳过;debug: true 时会打印原因
关闭 enabled两个别名都不注册,只能用 /creeperconfetti
执行 /cc reload先注销全部别名再按新配置重新注册,冲突会被重新检测

不想看到「已被占用」的警告,就把对应项设为 false:警告本身不影响功能,只是提示你该关掉它了。

language

控制插件所有玩家可见消息与控制台文案的语言。

# 根据服务器 IP 所在地区自动选择
language: auto

# 固定简体中文
language: zh_cn

# 旧写法仍然可用,会自动转换
language: zh

可选值与地区映射规则见 多语言。填了无法识别的代码时,插件会打一条警告并回退到 en_us。

debug

开启后额外输出:

  • 启动时加载到的样式数量与完整名称列表;
  • 归一化之后的各样式概率;
  • GeoIP 探测明细(查询了哪些接口、最终识别到的国家代码 → 语言);
  • 别名注册被跳过时的具体原因。
i

排查「为什么没触发烟花」「为什么语言是英文」时,第一件事就是把 debug 打开重启一次,日志基本能直接给出答案。

更新检查

插件启用时会向 GitHub Releases API 查询最新发行版,发现有新版本就在控制台提示。检查在启动约 5 秒后异步执行(Bukkit 为延迟 100 tick 的任务,Folia 走异步调度器),不会拖慢开服。

字段默认值作用
enabledtrue关闭整个检查
notify-opstrue有更新时,OP 进服给一次游戏内提示
github-token""可选,只勾选 public_repo 权限的 classic token

GitHub 匿名请求每个出口 IP 每小时只有 60 次配额,机房与云服务器的 IP 常常已经被其他程序用光,日志里就会出现 [Update] GitHub returned HTTP 403。填写令牌后配额提升到每小时 5000 次。更推荐用环境变量 CREEPERCONFETTI_GITHUB_TOKEN(或 GITHUB_TOKEN),这样令牌不会写进 config.yml,也不会出现在 backups/ 备份里。取值顺序为:配置文件 → CREEPERCONFETTI_GITHUB_TOKEN → GITHUB_TOKEN。

i

游戏内提示每轮服务器运行对每位 OP 只发一次,且需要 notify-ops 开启。403 / 429 每次运行只警告一次并附带配额重置时间,不影响插件本身功能。

配置版本与自动迁移

配置文件顶部的 config-version 是迁移依据,当前版本为 6。插件只在启用时检查它,/cc reload 不会触发迁移。

  1. 版本一致 → 什么都不做

    文件里记录的版本大于等于 6 时直接返回,不读也不写。

  2. 版本较旧 → 先备份

    把现有文件复制到 backups/config-backup-<yyyyMMdd-HHmmss>.yml,出问题随时可以还原。

  3. 转换旧格式

    版本为 0(即完全没有 config-version 键的老配置)时,会把旧的单效果列表 confetti_effect 转成名为 default 的样式,原有的颜色与形状全部保留。

  4. 补齐新增字段

    新版增加的键会被合并进文件,已存在的值一律不覆盖,然后写入新版本号。

!

迁移只发生在启动阶段。如果你手动把 config-version 改小,重启后会被再迁移一次,而这次「旧值」来自你当前的文件,结果可能不是你想要的。没有特殊需求不要动这个数字。

完整示例

下面是一份可直接使用的完整配置,含四套预设样式:

# 配置版本,请勿手改
config-version: 6

# 调试日志
debug: false

# 苦力怕变烟花的整体概率(0-100)
confetti_chance: 100

# 指令别名
command-aliases:
  enabled: true
  cc: true
  confetti: true

# 更新检查(GitHub Releases)
update-checker:
  enabled: true
  notify-ops: true
  github-token: ""

# 语言:auto / zh_cn / en_us / ...
language: auto

# 烟花样式:数量不限,爆炸时随机抽一种
firework_styles:
  classic:
    type: BALL
    flicker: true
    trail: false
    colors:
      - RED
      - YELLOW
      - WHITE
    fade-colors:
      - ORANGE
  starburst:
    type: STAR
    flicker: true
    trail: false
    colors:
      - AQUA
      - WHITE
      - BLUE
    fade-colors:
      - PURPLE
  rainbow:
    type: BURST
    flicker: false
    trail: true
    colors:
      - RED
      - ORANGE
      - YELLOW
      - GREEN
      - AQUA
    fade-colors:
      - WHITE
  creeper:
    type: CREEPER
    flicker: true
    trail: true
    colors:
      - GREEN
      - LIME
    fade-colors:
      - GREEN

# 各样式权重,自动归一化为 100%
firework_chances:
  classic: 40
  starburst: 30
  rainbow: 20
  creeper: 10

用指令改过样式后,配置会长得不一样

通过 /cc effect add、/cc effect chance 或图形界面做过修改后,插件会重写 firework_styles 与 firework_chances 两段。重写后的样式是 Bukkit 的序列化格式,看起来像这样:

firework_styles:
  classic:
  - ==: org.bukkit.FireworkEffect
    type: BALL
    flicker: true
    trail: false
    colors:
    - ==: org.bukkit.Color
      RGB: 16711680
    fade-colors:
    - ==: org.bukkit.Color
      RGB: 16755200

这是正常现象,不是配置损坏。这种格式依然可以正常加载,但手写起来很别扭。想回到可读的手写格式,有两种办法:

  • 执行 /cc effect reset 恢复内置四样式(同样是序列化格式);
  • 停服后手动把 firework_styles 整段替换成上面的手写示例,再启动。
v

建议的工作方式:样式用游戏内指令或 GUI 采集(/cc effect add 直接读取你手持的烟花),只有需要批量调整或版本管理时才手改 YAML。