ChunkEntityLimiter

插件

· 作者 Kurt5

该系统通过在加载的区块和玩家附近区域自动限制实体/物品的数量来提升性能。

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

最新 1.3.1 · 26.3 · Bukkit / Folia

一键开服(送7天)

ChunkEntityLimiter

适用于 Folia、Paper、Bukkit、Purpur 和 Spigot 的高性能实体与物品限制插件。

本插件通过智能限制实体和物品数量来优化服务器性能。它采用双重检查系统(单区块限制 + 玩家周围区块限制)来防止因怪物农场或大量物品掉落导致的卡顿,同时确保重要实体受到保护。

主要特性

  • 原生 Folia 支持: 完全针对 Folia 的区域线程架构进行了优化。
  • 智能清理逻辑: 优先清除最旧的。 实体根据其生成时间被移除。保留新刷新的生物,首先移除存在时间最长的实体。
  • 双层限制: 限制分别应用于单个区块 以及 玩家周围的区块聚合组。
  • 精确的物品计数: 可配置选项,按物品的实际数量计算物品堆叠(例如,一组 64 个圆石算作 64,而不是 1)。
  • 细粒度通知: 清理报告和过载警告拥有独立的控制选项,并支持可配置的作用域(无、仅 OP 管理员、或附近所有玩家)。
  • 性能监控: 内置性能分析器,用于跟踪清理阶段的执行情况。

清理逻辑

  1. 分类: 实体被归类为“受保护”和“可移除”。
  2. 保护检查: 除非启用了 clean-protected-if-over-limit,否则受保护的实体(命名、拴绳、驯服、装备、Boss)将被跳过。
  3. 排序: 可移除的实体按生成时间排序。
  4. 执行: 插件从**最早生成(最旧)**的实体开始移除,直到数量降至限制以下。

命令与权限

主命令: /chunklimit 别名: /cl, /climit

命令 描述 权限
/chunklimit reload 重新加载配置文件。 chunklimiter.reload (默认: op)
/chunklimit stats 显示当前区块及周围半径内详细的实体统计信息。 chunklimiter.stats (默认: true)
/chunklimit notify [type] [scope] 设置通知偏好。
• 类型: report (清理结果) 或 warning (接近限制)
• 作用域: none (关闭), op (仅限管理员), all (附近所有人)
示例: /cl notify report op
chunklimiter.notify (默认: op)
/chunklimit performance [reset] 查看性能指标(分类、清理等的执行时间)。 chunklimiter.performance (默认: op)

config.yml

# Entity and item drop limits configuration. It will only clear parts that exceed the limits.
# 区块实体、掉落物限制配置,只会清理超出的部分
entity-limits:
  # Default maximum number of entities allowed per chunk (all entities except those with special configurations)
  # 默认每个区块允许的最大实体数量(除特殊配置外的所有实体)
  default-limit: 100

  # Maximum number of item entities allowed (item drops)
  # 物品实体的最大数量限制(掉落物)
  item-limit: 300

  # Check interval (in game ticks, 20 ticks = 1 second)
  # Recommended: 600 (30s) or 1200 (60s) for performance
  # 检查间隔(单位:游戏刻,20 ticks = 1秒)
  # 推荐设置:600 (30秒) 或 1200 (60秒) 以节省性能
  check-interval-ticks: 600

  # Whether to check chunks around the player. 0 means disabled.
  # Example: If chunk-check-radius: 1, the total limit for all chunks (3x3) within radius 1 around the player is calculated.
  # 是否包含检查玩家周围的区块,0表示禁用
  # 例如: 设置为 1 表示检查玩家周围 3x3 的区块范围
  chunk-check-radius: 2

  # Multiplier for entity limits in chunks around the player.
  # Example: If set to 1.5, the limit for chunks in the radius will be 1.5x the default limit.
  # 玩家周围的区块实体限制倍数 (宽松系数)
  # 例如: 设置为 1.5,则周围区块的实体上限是默认值的 1.5 倍
  chunk_entity_multiplier: 1.5

  # Multiplier for item entity limits in chunks around the player.
  # 玩家周围的区块物品实体限制倍数
  chunk_item_multiplier: 1.5

  # Whether to count item stack amounts towards the limit
  # If true, a stack of 64 items counts as 64. If false, it counts as 1 entity.
  # 是否计算物品堆叠数量
  # 若为 true,一组64个物品算作64。若为 false,算作1个实体。
  count-item-stack-amount: false

  # Ignored entity types (these will not be counted or cleared)
  # 忽略的实体类型(不会被计数和清理)
  ignored-types:
    - IRON_GOLEM    # Iron Golem / 铁傀儡
    - VILLAGER      # Villager / 村民

  # Ignored item types (these will not be counted or cleared)
  # 忽略的物品类型(不会被计数和清理)
  ignored-items:
    - DIAMOND                # Diamond / 钻石
    - NETHERITE_INGOT        # Netherite Ingot / 下界合金锭
    - ENCHANTED_GOLDEN_APPLE # Enchanted Golden Apple / 附魔金苹果

  # Custom entity limits (override the default limits)
  # 自定义实体限制(覆盖默认限制)
  custom-limits:
    ZOMBIE: 200     # Maximum number of Zombies / 僵尸最大数量
    CREEPER: 200    # Maximum number of Creepers / 苦力怕最大数量
    ZOMBIFIED_PIGLIN: 200  # Maximum number of Zombified Piglins / 猪人最大数量
    
# Protection Settings, entities exceeding the limit will not be prioritized for cleaning, and protected entities exceeding the limit will still be cleaned up
# 保护设置,实体超过限制时不会被优先清理,受保护的实体数量超过限制时仍将被清理
protection:
  # Protect entities with custom names
  # 保护被命名的实体
  protect-named-entities: true

  # Protect leashed mobs (horses/donkeys excluded by default)
  # 保护被拴住的实体
  protect-leashed-entities: true

  # Prevent harming tamed pets (dogs/cats/parrots)
  # 保护驯服的动物
  protect-tamed-animals: true

  # Protect mobs wearing armor/items (including dropped gear)
  # 保护有装备的实体
  protect-equipped-entities: true

  # Prevent altering boss-type mobs (Ender Dragon, Wither, etc.)
  # 保护Boss实体
  protect-boss-entities: true

通知设置

settings:

当数量超限时,是否强制清理受保护的实体

若为 true:先清理普通实体,若仍超限则清理保护实体。

若为 false:受保护实体永远不会被清理(但会占用数量名额)。

clean-protected-if-over-limit: true

是否启用全局单区块清理(阶段1)。

若为 false:跳过全局扫描,仅清理玩家附近的区块(阶段2)。Folia 端建议设为 false 以提升性能。

clean-all-loaded-chunks: true

清理报告通知范围(当实体被清理时)

选项: NONE (禁用), OP (仅管理员), ALL (所有玩家)

cleanup-report-scope: ALL

超限预警通知范围(当接近上限时)

选项: NONE (禁用), OP (仅管理员), ALL (所有玩家)

overload-warning-scope: ALL

是否向OP发送全局清理报告通知(全服广播给OP)

若为 true:OP 接收所有区块的报告。若为 false:OP 必须在附近。

op-global-cleanup-report: true

是否向OP发送全局超限预警通知(全服广播给OP)

若为 true:OP 接收所有区块的预警。若为 false:OP 必须在附近。

op-global-overload-warning: false

是否将清理报告发送到服务器控制台

console-cleanup-report: true

预警通知百分比(0-100)

notify-threshold: 90

预警冷却时间,单位秒

notify-cooldown: 10

玩家通知范围半径

notification-radius: 128.0

设为 true 启用性能监控

performance-monitoring: false

设为 true 启用调试模式(详细日志)

debug-mode: false

语言选项(en/zh)

language: en


----------------------------------------------------------------------------------------------------------

### bStats
![bStats](https://bstats.org/signatures/bukkit/ChunkEntityLimiter.svg)

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

评论 0

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

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源