worldedit.properties 配置项

基本信息

属性 值
配置文件路径 <游戏目录>/config/worldedit/worldedit.properties
路径构造 ForgeWorldEdit.java:107(工作目录)+ ForgeConfiguration.java:29(文件名)
默认值来源 src/main/resources/defaults/worldedit.properties(31 个键)
实际读取键数 35(PropertiesConfiguration 33 + ForgeConfiguration 2)
主读取类 com.sk89q.worldedit.util.PropertiesConfiguration(load() 第 62-135 行)
子类 com.sk89q.worldedit.forge.ForgeConfiguration(仅 42 行,仅覆写 loadExtra())

关键事实:默认值文件与实际读取不一致

对「源码中 getXxx("键") 读取的键」与「defaults/worldedit.properties 中声明的键」做双向差集,两种独立取法(正则扫 getString|getBool|getInt|getDouble|getIntSet 调用 vs 逐行解析 properties)结果一致:

  • 读取 35 键,默认文件声明 31 键,交集 30
  • 被读取但未写入默认文件(5 个):cheat-mode、default-max-polyhedron-points、max-polyhedron-points、nav-use-glass、use-in-creative 这 5 项在首次 load() 时由 getXxx 的缺省分支 properties.setProperty(key, def) 自动补写(PropertiesConfiguration.java:155、:172、:189、:212、:233)
  • 写入默认文件但从未被读取(1 个):allow-extra-data-values(defaults/worldedit.properties:4) 全仓检索 grep -rn 'allow-extra-data-values\|allowExtraData' src/ docs/ 仅命中该默认值行本身,无任何读取方 → 属于「声明但未接线」的死配置项

完整配置项表

键 类型 默认值 读取行 赋值字段 外部消费者
profile bool false PropertiesConfiguration.java:79 profile CommandManager.java:347(if (config.profile))
disallowed-blocks int 集合 32 个 id :80 disallowedBlocks 方块写入前校验
default-max-changed-blocks int -1 :81 defaultChangeLimit SessionManager.java:159(setBlockChangeLimit)、:175
max-changed-blocks int -1 :82 maxChangeLimit EditSession 抛 MaxChangedBlocksException 的阈值
default-max-polygon-points int -1 :83 defaultMaxPolygonalPoints ActorSelectorLimits.java:45-49
max-polygon-points int 20 :84 maxPolygonalPoints ActorSelectorLimits.java:47
default-max-polyhedron-points int -1(代码默认) :85 defaultMaxPolyhedronPoints ActorSelectorLimits.java:64-68
max-polyhedron-points int 20(代码默认) :86 maxPolyhedronPoints ActorSelectorLimits.java:66
shell-save-type string 空 :87 shellSaveType ChunkCommands.java:111、:113(bat)、:144(bash)
max-radius int -1 :88 maxRadius WorldEdit.java:471(>0 时校验)、UtilityCommands.java:328(-1 时用 40)
max-super-pickaxe-size int 5 :89 maxSuperPickaxeSize 超级镐单次作用方块数
max-brush-radius int 10 :90 maxBrushRadius 刷子半径上限
log-commands bool false :91 logCommands CommandManager.java:225(boolean logging = config.logCommands;)
log-file string worldedit.log :92 logFile CommandManager.java:226
register-help bool true :93 registerHelp 无消费者(死项,见下)
wand-item int 271 :94 wandItem //wand 发放的物品(ItemID.WOOD_AXE = 271,ItemID.java:39)
super-pickaxe-drop-items bool true :95 superPickaxeDrop 超级镐是否掉落物品
super-pickaxe-many-drop-items bool true :96 superPickaxeManyDrop 超级镐是否一次掉落全部
no-double-slash bool false :97 noDoubleSlash 禁用 // 双斜杠写法
use-inventory bool false :98 useInventory 物品来源
use-inventory-override bool false :99 useInventoryOverride 同上
use-inventory-creative-override bool false :100 useInventoryCreativeOverride 同上
nav-wand-item int 345 :101 navigationWand 导航法杖物品(ItemID.COMPASS = 345,ItemID.java:113)
nav-wand-distance int 50 :102 navigationWandMaxDistance 导航法杖最大距离
nav-use-glass bool false(代码默认,未写入默认文件) :103 navigationUseGlass NavigationCommands.java:164
scripting-timeout int 3000 :104 scriptTimeout CraftScript 执行超时(毫秒)
schematic-save-dir string schematics :105 saveDir SchematicCommands.java:94、:145、:210
craftscript-dir string craftscripts :106 scriptsDir CraftScript 目录
butcher-default-radius int -1 :107 butcherDefaultRadius //butcher 默认半径
butcher-max-radius int -1 :108 butcherMaxRadius //butcher 半径上限
allow-symbolic-links bool false :109 allowSymlinks 存档路径是否允许符号链接
history-size int 15 :111 LocalSession.MAX_HISTORY_SIZE 注意:赋值为 Math.max(15, 值),即配置低于 15 无效
snapshots-dir string 空 :113-116 snapshotRepo 非空才构造 SnapshotRepository;SnapshotCommands.java:63、:115、:159、:210、:251 与 SnapshotUtilCommands.java:66 均先判 == null
use-in-creative bool false(代码默认,未写入默认文件) ForgeConfiguration.java:34 creativeEnable 创造模式行为
cheat-mode bool false(代码默认,未写入默认文件) ForgeConfiguration.java:35 cheatMode 作弊模式

死配置项与跨平台缺口

对 LocalConfiguration + ForgeConfiguration 声明的全部 36 个字段做「声明 → 赋值 → 是否有配置类之外的消费者」三段核验(脚本以 \.字段名\b 全仓检索 src/main/java 并排除 3 个配置类),结果:

字段 状态 证据
registerHelp 死项 全仓仅 4 处命中,全部在配置类内部;LocalConfiguration.java:68 的声明处甚至自带上游注释 // what is the point of this, it's not even used
showHelpInfo Forge 侧死项 仅 YAMLConfiguration.java:103 赋值,全仓无任何读取方
allowedDataCycleBlocks Forge 侧不可配置 仅 YAMLConfiguration.java:74 赋值(键 limits.allowed-data-cycle-blocks),PropertiesConfiguration 不读。消费者在 command/tool/BlockDataCyler.java:49-50(注意类名拼作 Cyler,非 Cycler),条件为 !config.allowedDataCycleBlocks.isEmpty() && ...;Forge 侧该集合恒为 LocalConfiguration.java:80 的空 HashSet,故该限制永不触发
allow-extra-data-values 死项(连字段都没有) 只存在于 defaults/worldedit.properties:4,无对应字段、无读取方
snapshotRepo 活 消费者见上表(脚本对「条件块内赋值」误报为未赋值,已人工复核)

registerHelp 一项同时具备「源码注释承认」与「独立 grep 证据」两条,符合本项目对死代码的判定要求(注释本身不作数,以检索为准)。

特殊行为

  • history-size 有下限 15:LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15))(PropertiesConfiguration.java:111),字段初值也是 15(LocalSession.java:61)。配 5 或 0 都会得到 15。

    对比:同仓的 YAMLConfiguration.java:100 用的是 Math.max(0, ...),两者不一致。YAML 配置在 1.7.10 Forge 版未被使用(Forge 侧只构造 ForgeConfiguration),故不影响本条目所述行为。

  • 文件读写顺序:load() 先读已有文件(缺失则记 FileNotFoundException ignored 静默跳过,PropertiesConfiguration.java:67),再 loadExtra(),再逐项读取,最后无条件回写整个文件(:118-134),因此注释会在每次启动后被抹掉——这正是默认文件首行注释 “Don’t put comments; they get removed” 的由来。
  • 配置热重载://we reload 触发 we.getServer().reload() 并投递 ConfigurationLoadEvent。

静默失败点

  • getInt 遇到非数字值时吞掉异常并回退到默认值(catch (NumberFormatException e) → setProperty(key, def),PropertiesConfiguration.java:194-197)
  • getIntSet 逐项 try/catch 并 catch (NumberFormatException ignored) {} 跳过无法解析的条目(:246)——disallowed-blocks 中写错一个 id 只会静默丢该 id,不报错
  • 读文件时的 FileNotFoundException 被 ignored 静默忽略(:67)

相关条目