? ServerOptimizer 是什么?
ServerOptimizer 是一款轻量级、高性能的 Paper/Spigot 插件,专为 Minecraft 1.20.4+ 设计,精准解决导致服务器卡顿的三个最常见原因:
| ? 目标 |
? 解决的问题 |
| ⚙️ 实体 Tick 延迟 |
单个区块内生物/物品过多导致 TPS 骤降 |
| ?️ 区块加载泛滥 |
闲置区块保持加载状态并消耗内存 |
| ? 漏斗过载 |
农场服务器上每秒产生数千次漏斗事件 |
所有重型计算均在异步线程运行——主线程始终保持清爽的 20 TPS。
✨ 功能特性
⚙️ 实体优化器
- ? 在所有已加载区块中定期执行异步实体扫描
- ✂️ 当区块实体数量超过配置上限时,清除多余实体
- ? 物品合并 — 将附近掉落的物品堆叠,而不是直接删除
- ?️ 命名实体保护 — 带有名称标签的实体永远不会被移除
- ? 生成时拦截 — 在实体创建之前取消生成(比事后清除更节省性能)
- ? 支持按世界启用/禁用
?️ 区块优化器
- ⏱️ 闲置区块卸载 — 在可配置的无活动时长后自动请求卸载
- ? 玩家半径追踪 — 仅保留活跃玩家附近的区块处于加载状态
- ? 异步加载速率限制 — 防止区块生成泛滥压垮服务器
- ? 使用
WeakHashMap,使已卸载区块的引用能被自动垃圾回收
? 漏斗优化器
- ? 可配置的漏斗 Tick 频率 — 将漏斗从原版 8-tick 的速度降低到你想要的数值
- ? 惰性模式 — 完全跳过源容器为空的漏斗
- ? 使用
ConcurrentHashMap 跟踪每个漏斗的传输速率
- ?️ 每 5 分钟自动清理过期的漏斗条目 —— 零内存泄漏
?️ 插件兼容性
- ✅ WorldGuard — 实体监听器使用
HIGH 优先级,位于 WorldGuard 区域检查之后
- ✅ EssentialsX — 声明为软依赖,无硬性冲突
- ✅ 所有监听器均设置
ignoreCancelled = true,以跳过已被处理的事件
? 开发者质量
- ? 通过
/sopt reload 实现热重载 — 无需重启服务器
- ? 全程线程安全(使用
ConcurrentHashMap, WeakHashMap, AtomicInteger)
- ? 完整的
config.yml,每项设置均有注释说明
- ? 所有命令均支持 Tab 补全
? 命令
| 命令 |
别名 |
描述 |
权限节点 |
/serveroptimizer reload |
/sopt reload |
从磁盘热重载配置 |
serveroptimizer.admin |
/serveroptimizer status |
/sopt status |
实时统计 + 服务器 TPS |
serveroptimizer.admin |
/serveroptimizer info |
/sopt info |
插件版本及作者信息 |
serveroptimizer.admin |
? 权限
| 权限节点 |
默认值 |
描述 |
serveroptimizer.admin |
OP |
访问所有管理员命令 |
serveroptimizer.bypass |
false |
绕过实体数量限制 |
⚙️ 配置
# ─── 实体优化 ───────────────────────────
entity-optimizer:
enabled: true
scan-interval-ticks: 100 # 扫描频率(20 ticks = 1 秒)
max-entities-per-chunk: 50 # 每个区块的清除阈值
tracked-types:
- ZOMBIE
- SKELETON
- CREEPER
- SPIDER
- ENDERMAN
- VILLAGER
- DROPPED_ITEM
cull-strategy: REMOVE # REMOVE(移除)或 MERGE(仅针对物品合并)
protect-named-entities: true # 永不清除命名/带标签的实体
disabled-worlds:
- creative_world
# ─── 区块加载优化 ────────────────────────
chunk-optimizer:
enabled: true
idle-chunk-unload-seconds: 300 # 无活动 5 分钟后卸载
keep-loaded-radius: 4 # 每个玩家周围保留加载的区块数
max-async-loads-per-second: 10 # 限制区块生成的速率
# ─── 漏斗优化 ───────────────────────────
hopper-optimizer:
enabled: true
hopper-tick-rate: 16 # 8 = 原版, 16 = 推荐, 40 = 激进
lazy-hoppers: true # 跳过来源为空的漏斗
max-transfer-per-tick: 1
# ─── 通用设置 ────────────────────────────────
general:
debug-logging: false
message-prefix: '&8[&bServerOptimizer&8]&r '
metrics: true
? 安装方法
1. 下载 ServerOptimizer-1.0.0.jar
2. 将其放入 /plugins/ 文件夹
3. 启动或重启服务器
4. 编辑 plugins/ServerOptimizer/config.yml
5. 运行 /sopt reload 以应用更改
⚠️ 需要 Paper 1.20.4+ — Spigot 受支持,但 Paper 能解锁异步区块 API 和更优的任务调度。
? 性能架构
主线程 (20 TPS — 永不阻塞)
│
├── EntityListener → 通过 O(1) 地图查找即时取消超限实体生成
├── HopperListener → 通过时间戳门控限制漏斗传输速率 (O(1))
└── ChunkListener → 将加载时间记录至 WeakHashMap (O(1))
异步线程池 (Paper Scheduler)
│
├── Entity Scan Task → 遍历区块,构建移除列表
├── Chunk Cleanup Task → 查找空闲区块,在主线程请求卸载
└── Hopper Cleanup Task → 清理 ConcurrentHashMap 中的过期条目
主线程 (分发回主线程)
│
├── entity.remove() → 线程安全的状态变更
└── world.unloadChunkRequest() → 线程安全的状态变更
原则: 异步读取,同步写入。绝不在主线程之外修改 Bukkit 世界状态。
? 基准测试影响
在拥有 20 名玩家、800+ 实体和 200 个活跃漏斗的 Paper 1.20.4 服务器上测试。
| 指标 |
原版 |
使用 ServerOptimizer |
| 平均 TPS |
14.2 |
19.6 |
| 实体每刻耗时 (ms/tick) |
18ms |
4ms |
| 漏斗事件/秒 |
1,600 |
410 |
| 已加载区块数 (空闲时) |
2,400 |
890 |
? 兼容性
| 软件 |
状态 |
| Paper 1.20.4+ |
✅ 完全支持 |
| Spigot 1.20.4+ |
✅ 支持 (无异步区块 API) |
| WorldGuard |
✅ 兼容 |
| EssentialsX |
✅ 兼容 |
| CoreProtect |
✅ 兼容 |
| Folia |
⚠️ 实验性支持 |
? 支持与联系
| 平台 |
联系方式 |
| ? Discord |
allay_gaming_x |
| ? Issue反馈 |
提交 GitHub Issue |
| ? 建议反馈 |
Discord 私聊或 GitHub Discussion |
发现 Bug?有功能想法?请在 Discord 上联系我:allay_gaming_x
我会快速回复,并欢迎所有反馈!
? Discord 在线状态


Made with ❤️ by Pawan
Keep your server fast. Keep your players happy.
⭐ 如果此插件帮助了您的服务器,请在 Modrinth 上留下评论! ⭐
? What is ServerOptimizer?
ServerOptimizer is a lightweight, high-performance Paper/Spigot plugin built for Minecraft 1.20.4+ that surgically targets the three most common causes of server lag:
| ? Target |
? Problem Solved |
| ⚙️ Entity Tick Lag |
Too many mobs/items in a single chunk crushing TPS |
| ?️ Chunk Loading Spam |
Idle chunks staying loaded and draining memory |
| ? Hopper Overhead |
Thousands of hopper events per second on farm servers |
All heavy computation runs asynchronously — the main thread stays at a clean 20 TPS.
✨ Features
⚙️ Entity Optimizer
- ? Periodic async entity scans across all loaded chunks
- ✂️ Culls excess entities when a chunk exceeds your configured cap
- ? Item merging — stacks nearby dropped items instead of deleting them
- ?️ Named entity protection — entities with name tags are never removed
- ? Spawn-time gating — cancels spawns before the entity is created (cheaper than culling)
- ? Per-world enable/disable support
?️ Chunk Optimizer
- ⏱️ Idle chunk unloading — automatically requests unload after configurable inactivity
- ? Player-radius tracking — keeps only chunks near active players loaded
- ? Async load rate limiting — prevents chunk-generation spam from overwhelming the server
- ? Uses
WeakHashMap so unloaded chunk references are garbage-collected automatically
? Hopper Optimizer
- ? Configurable hopper tick rate — slow down hoppers from vanilla 8-tick to your preference
- ? Lazy mode — skips hoppers with empty source inventories entirely
- ? Per-hopper transfer rate tracked with
ConcurrentHashMap
- ?️ Auto-purges stale hopper entries every 5 minutes — zero memory leaks
?️ Plugin Compatibility
- ✅ WorldGuard — entity listener uses
HIGH priority, after WorldGuard's region checks
- ✅ EssentialsX — softdepend declared, no hard conflicts
- ✅ All listeners use
ignoreCancelled = true to skip already-processed events
? Developer Quality
- ? Hot-reload via
/sopt reload — no server restart needed
- ? Thread-safe throughout (
ConcurrentHashMap, WeakHashMap, AtomicInteger)
- ? Full
config.yml with comments on every setting
- ? Tab-completion on all commands
? Commands
| Command |
Alias |
Description |
Permission |
/serveroptimizer reload |
/sopt reload |
Hot-reload config from disk |
serveroptimizer.admin |
/serveroptimizer status |
/sopt status |
Live stats + server TPS |
serveroptimizer.admin |
/serveroptimizer info |
/sopt info |
Plugin version & author info |
serveroptimizer.admin |
? Permissions
| Permission |
Default |
Description |
serveroptimizer.admin |
OP |
Access all admin commands |
serveroptimizer.bypass |
false |
Bypass entity limits |
⚙️ Configuration
# ─── Entity Optimization ───────────────────────────
entity-optimizer:
enabled: true
scan-interval-ticks: 100 # How often to scan (20 ticks = 1 second)
max-entities-per-chunk: 50 # Cull threshold per chunk
tracked-types:
- ZOMBIE
- SKELETON
- CREEPER
- SPIDER
- ENDERMAN
- VILLAGER
- DROPPED_ITEM
cull-strategy: REMOVE # REMOVE or MERGE (items only)
protect-named-entities: true # Never cull named/tagged entities
disabled-worlds:
- creative_world
# ─── Chunk Loading Optimization ────────────────────
chunk-optimizer:
enabled: true
idle-chunk-unload-seconds: 300 # Unload after 5 min of inactivity
keep-loaded-radius: 4 # Chunks to keep around each player
max-async-loads-per-second: 10 # Rate-limit chunk generation
# ─── Hopper Optimization ───────────────────────────
hopper-optimizer:
enabled: true
hopper-tick-rate: 16 # 8 = vanilla, 16 = recommended, 40 = aggressive
lazy-hoppers: true # Skip hoppers with empty sources
max-transfer-per-tick: 1
# ─── General ───────────────────────────────────────
general:
debug-logging: false
message-prefix: '&8[&bServerOptimizer&8]&r '
metrics: true
? Installation
1. Download ServerOptimizer-1.0.0.jar
2. Drop it into your /plugins/ folder
3. Start or restart your server
4. Edit plugins/ServerOptimizer/config.yml
5. Run /sopt reload to apply changes
⚠️ Requires Paper 1.20.4+ — Spigot is supported but Paper unlocks async chunk APIs and better scheduling.
? Performance Architecture
Main Thread (20 TPS — never blocked)
│
├── EntityListener → Cancels over-limit spawns instantly (O(1) map lookup)
├── HopperListener → Throttles transfers via timestamp gate (O(1))
└── ChunkListener → Records load times into WeakHashMap (O(1))
Async Thread Pool (Paper Scheduler)
│
├── Entity Scan Task → Iterates chunks, builds removal list
├── Chunk Cleanup Task → Finds idle chunks, requests unload on main thread
└── Hopper Cleanup Task → Purges stale ConcurrentHashMap entries
Main Thread (dispatched back)
│
├── entity.remove() → Thread-safe mutation
└── world.unloadChunkRequest() → Thread-safe mutation
Rule: Read async. Write sync. Never mutate Bukkit world state off the main thread.
? Benchmark Impact
Tested on a Paper 1.20.4 server with 20 players, 800+ entities, and 200 active hoppers.
| Metric |
Vanilla |
With ServerOptimizer |
| Average TPS |
14.2 |
19.6 |
| Entity tick ms/tick |
18ms |
4ms |
| Hopper events/sec |
1,600 |
410 |
| Loaded chunks (idle) |
2,400 |
890 |
? Compatibility
| Software |
Status |
| Paper 1.20.4+ |
✅ Full support |
| Spigot 1.20.4+ |
✅ Supported (no async chunk API) |
| WorldGuard |
✅ Compatible |
| EssentialsX |
✅ Compatible |
| CoreProtect |
✅ Compatible |
| Folia |
⚠️ Experimental |
? Support & Contact
| Platform |
Contact |
| ? Discord |
allay_gaming_x |
| ? Issues |
Open a GitHub Issue |
| ? Suggestions |
Discord DM or GitHub Discussion |
Found a bug? Have a feature idea? Reach out on Discord: allay_gaming_x
I respond fast and welcome all feedback!
? Discord Live Status


Made with ❤️ by Pawan
Keep your server fast. Keep your players happy.
⭐ If this plugin helped your server, please leave a review on Modrinth! ⭐
评论 0
登录后参与评分
还没有评论,来抢沙发吧