功能介绍
SiegeCannon 是一款可骑乘的 TNT 攻城炮,专为合作型 PvE 服务器设计。
与大多数依赖红石建造套件和多玩家装载组的火炮插件不同,SiegeCannon 采取相反的设计理念:一人一炮一触发,拥有扇形射击角度,更强调站位而非瞄准辅助。右键骑乘,潜行下马,左键开火。
特性
- 骑乘与射击 — 右键骑乘,左键射击,潜行下马
- ±45° 扇形角度 — 通过转身来瞄准,火炮本体不会自动旋转
- 可破坏耐久度 — 火炮会受到爆炸和怪物伤害;被摧毁时会产生壮观的爆炸效果
- 两级引信机制 — 左键触发保险窗口;TNT 在配置好的延迟后(默认 1 秒)实际发射
- 方块分区处理 — 爆炸产生的掉落物分为“作为掉落物飞行 / 原版销毁 / 保留”三类,营造战场废墟感
- 仅对怪物范围伤害 — 默认抑制友军伤害
- 后坐力反馈 — 每次射击都会产生视角抖动和炮身后退效果
- TPS 感知 — 全局设置掉落物生成上限,防止多炮齐射导致服务器卡顿
- 可选资源包 — 开箱即用原版 TNT 模型;如果资源包提供了
siegecannon:cannon_tnt 则自动加载自定义模型
- 双语支持 — 内置
zh_CN / en_US,根据玩家客户端语言自动切换
- 公开 API — 提供
CannonFireEvent(可取消)和 CannonDestroyEvent 供第三方插件调用
安装方法
- 将
siegecannon-1.0.0.jar 放入服务器的 plugins/ 文件夹
- 启动服务器。
plugins/SiegeCannon/config.yml 和 lang/{zh_CN,en_US}.yml 会自动生成
- 运行
/cannon spawn(默认情况下所有玩家都有权限使用)
⚠️ 在 1.0.0 版本中,火炮数据仅存储在内存中。 服务器重启会清除已生成的火炮。持久化功能已在开发计划中。
命令说明
| 命令 |
权限 |
描述 |
/cannon spawn |
siegecannon.use (默认开启) |
在你脚下生成一门火炮 |
/cannon spawn <x> <y> <z> [world] |
siegecannon.admin |
在指定坐标生成火炮 |
/cannon remove |
siegecannon.use |
移除最近的一门火炮(6 格范围内) |
/cannon list |
siegecannon.admin |
列出所有已生成的火炮 |
/cannon removeall |
siegecannon.admin |
移除世界中的所有火炮 |
/cannon reload |
siegecannon.admin |
重新加载 config.yml |
别名:/sc, /siegecannon。
配置说明
大多数服务器只需调整四个“核心”参数即可:
cannon:
tnt:
cooldown-seconds: 2.5 # 开火冷却时间
yaw-limit-deg: 45.0 # 扇形角度半角
damage-multiplier: 1.0 # 对怪物的伤害倍率
hp: 100.0 # 火炮耐久度
protect-blocks: false # true = 爆炸不会损坏地图方块
model:
use-custom: true # false = 仅使用原版 TNT 模型
language:
default: en_US
超出范围的数值会在加载时被限制到安全边界内,并记录为警告日志——插件不会因为配置错误导致服务器崩溃。
API 示例
// 在禁火区内取消开火
@EventHandler
public void onFire(CannonFireEvent event) {
if (isInsideSafeZone(event.getMuzzle())) {
event.setCancelled(true);
}
}
// 统计被摧毁的火炮数量
@EventHandler
public void onDestroy(CannonDestroyEvent event) {
statsService.recordCannonLoss(event.getLocation());
}
资源包
插件默认使用原版 TNT 模型。若要使用自定义模型:请提供一个包含 assets/siegecannon/models/item/cannon_tnt.json 模型的资源包,并将 cannon.model.use-custom 设置为 true。没有该资源包的客户端会自动无缝回退到原版 TNT 模型。社区资源包已在开发计划中。
指标统计
本插件使用 bStats 收集匿名的安装量和版本统计数据。可通过编辑 plugins/bStats/config.yml 选择退出。
开发计划
- 附带自定义火炮模型的整合资源包
- 持久化存储:火炮数据可跨服务器重启保留
- 演示 GIF / 视频
CannonRegistry:允许第三方插件注册自定义火炮类型
- PlaceholderAPI 集成
- WorldGuard 区域标志支持 (
siegecannon-allowed)
- 多类型火炮变体(重型 / 轻型 / 穿甲型)
- 更多语言支持(欢迎社区翻译)
开源协议
MIT — 允许分叉、修改和再分发。建议注明出处,但非强制要求。
源代码
github.com/Yangzhiganlu7/siegecannon — 欢迎提交 Issue / PR。
What it does
SiegeCannon is a ridable TNT siege cannon designed for cooperative PvE servers.
Unlike most cannon plugins which lean on redstone build kits and multi-player loading crews, SiegeCannon takes the opposite stance: one player, one cannon, one trigger, with a fan-shaped firing arc that rewards positioning over aimbots. Right-click to mount, sneak to dismount, left-click to fire.
Features
- Mount-and-fire — right-click to ride, left-click to shoot, sneak to dismount
- ±45° fan arc — turn your body to aim, the cannon doesn't pivot for you
- Breakable durability — cannons take damage from explosions and mobs; destroyed cannons explode dramatically
- Two-stage ignition — left-click triggers a fuse window; TNT actually launches after a configurable delay (default 1s)
- Block partitioning — explosion blocks split into "fly as falling block / vanilla destroy / preserve" buckets for battlefield rubble feel
- Mob-only AoE damage — friendly fire is suppressed by default
- Recoil feedback — view kick + cannon-body kickback on every shot
- TPS-aware — global FallingBlock spawn cap protects servers from many-cannon volleys
- Resource pack optional — works with vanilla TNT model out of the box; custom model auto-loaded if your pack provides
siegecannon:cannon_tnt
- Bilingual —
zh_CN / en_US shipped, auto-resolves by player client locale
- Public API —
CannonFireEvent (cancellable) + CannonDestroyEvent for third-party hooks
Installation
- Drop
siegecannon-1.0.0.jar into your server's plugins/ folder
- Start the server.
plugins/SiegeCannon/config.yml and lang/{zh_CN,en_US}.yml are generated
- Run
/cannon spawn (any player has it by default)
⚠️ Cannons are in-memory only in 1.0.0. Server restart wipes spawned cannons. Persistence is on the roadmap.
Commands
| Command |
Permission |
Description |
/cannon spawn |
siegecannon.use (default true) |
Spawn a cannon at your feet |
/cannon spawn <x> <y> <z> [world] |
siegecannon.admin |
Spawn at explicit coordinates |
/cannon remove |
siegecannon.use |
Remove the nearest cannon (within 6 blocks) |
/cannon list |
siegecannon.admin |
List all spawned cannons |
/cannon removeall |
siegecannon.admin |
Remove every cannon in the world |
/cannon reload |
siegecannon.admin |
Reload config.yml |
Aliases: /sc, /siegecannon.
Configuration
Most servers only need to tune four "core" parameters:
cannon:
tnt:
cooldown-seconds: 2.5 # fire cooldown
yaw-limit-deg: 45.0 # fan arc half-angle
damage-multiplier: 1.0 # vs mobs
hp: 100.0 # cannon durability
protect-blocks: false # true = explosions don't damage map
model:
use-custom: true # false = vanilla TNT model only
language:
default: en_US
Out-of-range values are clamped to safe bounds at load time and logged as warnings — the plugin won't crash your server because of a config typo.
API
// Cancel firing inside a no-fire zone
@EventHandler
public void onFire(CannonFireEvent event) {
if (isInsideSafeZone(event.getMuzzle())) {
event.setCancelled(true);
}
}
// Tally destroyed cannons
@EventHandler
public void onDestroy(CannonDestroyEvent event) {
statsService.recordCannonLoss(event.getLocation());
}
Resource pack
The plugin uses the vanilla TNT model by default. To use a custom model: ship a resource pack with a model at assets/siegecannon/models/item/cannon_tnt.json and set cannon.model.use-custom: true. Clients without the pack fall back to vanilla TNT seamlessly. A community resource pack is on the roadmap.
Metrics
This plugin uses bStats for anonymous install / version statistics. Opt-out via plugins/bStats/config.yml.
Roadmap
- Bundled resource pack with custom cannon model
- Persistence: cannons survive server restart
- Demo GIF / video
CannonRegistry: third-party plugins register custom cannon types
- PlaceholderAPI integration
- WorldGuard region flag (
siegecannon-allowed)
- Multi-cannon variants (heavy / light / piercing)
- More languages (community translations welcome)
License
MIT — fork, modify, redistribute. Attribution appreciated but not required.
Source code
github.com/Yangzhiganlu7/siegecannon — issues / PRs welcome.
评论 0
登录后参与评分
还没有评论,来抢沙发吧