Simple Anti-Mob Lag
一款轻量级插件,用于减少实体卡顿
在许多服务器中,卡顿的主要来源是实体(mobs)。本插件的目的很简单:当服务器卡顿时冻结实体,而在服务器不卡顿时解冻它们。我们也力求以一种不会对游戏玩法产生显著影响的方式来实现这一功能。
默认情况下,我们仅冻结大群落的实体,而保留单独行动的实体处于活跃状态。这意味着会导致严重卡顿的大型动物养殖场会被冻结,但世界中随机生成的怪物则不会。此外,还有一个选项可以使用智能缩放系统,根据服务器的卡顿程度来调整此行为,即如果服务器卡顿严重,我们会冻结更多实体。所有这些功能均可配置。
安装与配置
安装非常简单。只需将 jar 文件放入你的 plugins 文件夹并重启或重载服务器即可。这将在插件目录中的 'SAML' 文件夹内生成该插件的配置文件。
有很多内容需要配置。以下是配置文件的样貌:
# Do you want a config file with more options to generate?
use-advanced-config: false
When the server's TPS drops below this, we will start freezing mobs.
tps-freezing-threshold: 18.5
When the server's TPS rises above this, we will begin unfreezing mobs again.
This should be higher than the tps-freezing-threshold!
tps-unfreezing-threshold: 19.0
Every how many ticks should we freeze or unfreeze mobs? There are 20 ticks per second.
Not recommended to set this below 600.
ticks-per-operation: 1200
How long (in milliseconds) should the freezing or unfreezing operation be allowed to take?
If this is set too high there may be noticeable lag spikes when we freeze mobs.
maximum-operation-time: 300
At most how many mobs should be unfrozen in any given operation?
unfreeze-limit: 100
Should we keep a list of chunks containing frozen mobs in them, so we may be able to unfreeze them if the plugin doesn't shut down correctly?
Keep this as true if you think you'll uninstall this plugin at some point. This will allow you to unfreeze all the frozen mobs in your world easily.
keep-frozen-chunk-cache: true
On startup, should we unfreeze mobs which were not unfrozen previously?
Warning: this operation loads chunks and therefore can cause a lot of lag.
unfreeze-cached-chunks-on-startup: false
Every how many ticks should we unfreeze these mobs?
ticks-per-cached-chunk-unfreeze: 40
Do you use Paper? If so, do you want this task (the cache unfreezing task) to run in a more efficient manner?
use-paper-get-chunk-async: false
Should we only freeze mobs that are in large groups, ignoring single mobs?
This is good if you want to freeze large player-made farms, but don't want to freeze random monsters in the world.
group-bias: true
Below what TPS should we ignore the option above and freeze EVERYTHING in accordance to the other options?
Set to 0 to disable this option.
group-bias-tps-threshold: 0
If there are any more than the group-minimum-size number of mobs within group-maximum-radius of each other this will constitute a group of mobs, which will be frozen if the server starts lagging.
group-minimum-size: 10
group-maximum-radius: 8.0
Should we scale the maximum radius and minimum size required of a group depending on how much the server is lagging?
use-smart-scaling: true
When we freeze mobs should we say so in the server console?
broadcast-to-console: true
When we freeze mobs should we tell people with the permission 'saml.notify'?
broadcast-to-ops: false
Should we stop mobs from targeting mobs that are frozen?
This includes things like zombies attacking frozen villagers and baby animals following frozen adult animals.
prevent-targeting-frozen: true
Should we stop mobs from being able to damage frozen mobs?
prevent-damaging-frozen: true
Should we stop players from being able to damage frozen mobs?
prevent-player-damaging-frozen: false
Should we unfreeze mobs when the chunk they are in is unloaded?
unfreeze-on-unload: true
Should we unfreeze all the loaded mobs when the plugin shuts down?
unfreeze-on-shutdown: true
Should we unfreeze mobs when interacted with by a player?
unfreeze-on-interact: true
Below what TPS should we ignore the option above and not unfreeze mobs that are interacted with?
Set to 0 to disable this option.
unfreeze-on-interact-tps-threshold: 0
Should we unfreeze mobs when they take damage?
unfreeze-on-damage: true
Below what TPS should we ignore the option above and not unfreeze mobs that take damage?
Set to 0 to disable this option.
unfreeze-on-damage-tps-threshold: 0
Should tamed mobs (cats, dogs, horses, etc.) never be frozen?
ignore-tamed: true
Below what TPS should we ignore the option above and start freezing mobs that are tamed?
Set to 0 to disable this option.
ignore-tamed-tps-threshold: 0
Should we ignore mobs named with a name tag?
ignore-named: true
Below what TPS should we ignore the option above and start freezing mobs that are named?
Set to 0 to disable this option.
ignore-named-tps-threshold: 0
Should mobs that are leashed never be frozen?
ignore-leashed: true
Below what TPS should we ignore the option above and start freezing mobs that are leashed?
Set to 0 to disable this option.
ignore-leashed-tps-threshold: 0
是否永远不冻结处于求偶模式(繁殖模式)的实体?
ignore-love-mode: true
TPS 低于多少时,我们应该忽略上述选项并开始冻结处于求偶模式的实体?
设置为 0 以禁用此选项。
ignore-love-mode-tps-threshold: 0
实体距离玩家多远(以方块为单位)时不应被冻结?
设置为 0 以禁用此选项。
ignore-player-proximity: 0
TPS 低于多少时,我们应该忽略上述选项并开始冻结靠近玩家的实体?
请注意,这是一个非常消耗资源的检查。如果玩家数量众多,可能会导致冻结操作显著变慢。
设置为 0 以禁用此选项。
ignore-player-proximity-tps-threshold: 0
我们永远不会冻结此类实体。
将那些如果被冻结可能会陷入危险的实体放在这里,比如村民。
类型列表请参阅 。
这是区分大小写的,必须全部大写!
never-freeze:
- VILLAGER
- WANDERING_TRADER
- PILLAGER
- VINDICATOR
- VEX
- WITCH
- RAVAGER
- ILLUSIONER
- EVOKER
TPS 低于多少时,我们应该忽略上述选项并开始冻结列表中的实体?
设置为 0 以禁用此选项。
never-freeze-tps-threshold: 0
如果服务器卡顿,我们将始终冻结此类实体。即使它们没有组成大型群体。
将那些资源占用高的实体放在这里,比如水生生物。
类型列表请参阅 。
这是区分大小写的,必须全部大写!
always-freeze:
- COD
- SALMON
- TROPICAL_FISH
- PUFFERFISH
- TURTLE
- SQUID
- DOLPHIN
我们永远不会在这些世界中冻结实体。
ignore-world:
命令与权限
命令:
- /saml - 插件的基础命令,显示版本号。
- /saml reload - 重新加载插件的配置文件。
- /saml stats - 显示全服及每个世界的已冻结实体总数。
权限:
- saml.saml - 授予使用 /saml 命令的权限。
- saml.notify - 当冻结操作开始和结束时你会收到通知(如果在配置中启用)。
兼容性
该插件支持 1.9 到 1.14 版本。然而,并非所有功能都适用于较低版本。在 1.13 以下版本中,无法在配置中使用 ignore-love-mode 或 use-paper-get-chunk-async 选项。这是因为这些选项使用了当时尚不存在的 API。遗憾的是,1.8 永远无法获得支持,因为我们用于“冻结”实体的主要 API 在 1.8 中并不存在。
你需要 Java 8 来运行此插件。
请注意: 如果你在配置中禁用了 unfreeze-on-unload 和 unfreeze-on-shutdown,冻结的实体将被保存到你的世界中。如果你随后卸载插件,这些实体将不会被解冻。如果你不想启用这两个选项,并且打算在未来某个时候卸载插件,建议将配置中的 'keep-frozen-chunk-cache' 选项设置为 true。
Simple Anti-Mob Lag
A lightweight plugin for reducing mob lag
On many servers, the main source of lag is ticking mobs. The purpose of this plugin is simple: freeze mobs when the server is lagging, and unfreeze them when it is not. We also try to do this in a way that does not significantly affect gameplay.
By default, we only freeze mobs in large groups while leaving lone mobs unfrozen. This means large animal farms which cause a lot of lag will be frozen, but random monsters throughout the world will not. There is also an option to use a smart scaling system to change this behaviour based on how much the server is lagging, i.e. if the server is lagging a lot, we freeze a lot. All of these features can be configured.
Installation and configuration
Installation is very simple. Just put the jar file in your plugins folder and restart or reload the server. This will generate the configuration files for the plugin in the 'SAML' folder in your plugin directory.
There's a lot for you to configure. Here's what the config file looks like:
# Do you want a config file with more options to generate?
use-advanced-config: false
When the server's TPS drops below this, we will start freezing mobs.
tps-freezing-threshold: 18.5
When the server's TPS rises above this, we will begin unfreezing mobs again.
This should be higher than the tps-freezing-threshold!
tps-unfreezing-threshold: 19.0
Every how many ticks should we freeze or unfreeze mobs? There are 20 ticks per second.
Not recommended to set this below 600.
ticks-per-operation: 1200
How long (in milliseconds) should the freezing or unfreezing operation be allowed to take?
If this is set too high there may be noticeable lag spikes when we freeze mobs.
maximum-operation-time: 300
At most how many mobs should be unfrozen in any given operation?
unfreeze-limit: 100
Should we keep a list of chunks containing frozen mobs in them, so we may be able to unfreeze them if the plugin doesn't shut down correctly?
Keep this as true if you think you'll uninstall this plugin at some point. This will allow you to unfreeze all the frozen mobs in your world easily.
keep-frozen-chunk-cache: true
On startup, should we unfreeze mobs which were not unfrozen previously?
Warning: this operation loads chunks and therefore can cause a lot of lag.
unfreeze-cached-chunks-on-startup: false
Every how many ticks should we unfreeze these mobs?
ticks-per-cached-chunk-unfreeze: 40
Do you use Paper? If so, do you want this task (the cache unfreezing task) to run in a more efficient manner?
use-paper-get-chunk-async: false
Should we only freeze mobs that are in large groups, ignoring single mobs?
This is good if you want to freeze large player-made farms, but don't want to freeze random monsters in the world.
group-bias: true
Below what TPS should we ignore the option above and freeze EVERYTHING in accordance to the other options?
Set to 0 to disable this option.
group-bias-tps-threshold: 0
If there are any more than the group-minimum-size number of mobs within group-maximum-radius of each other this will constitute a group of mobs, which will be frozen if the server starts lagging.
group-minimum-size: 10
group-maximum-radius: 8.0
Should we scale the maximum radius and minimum size required of a group depending on how much the server is lagging?
use-smart-scaling: true
When we freeze mobs should we say so in the server console?
broadcast-to-console: true
When we freeze mobs should we tell people with the permission 'saml.notify'?
broadcast-to-ops: false
Should we stop mobs from targeting mobs that are frozen?
This includes things like zombies attacking frozen villagers and baby animals following frozen adult animals.
prevent-targeting-frozen: true
Should we stop mobs from being able to damage frozen mobs?
prevent-damaging-frozen: true
Should we stop players from being able to damage frozen mobs?
prevent-player-damaging-frozen: false
Should we unfreeze mobs when the chunk they are in is unloaded?
unfreeze-on-unload: true
Should we unfreeze all the loaded mobs when the plugin shuts down?
unfreeze-on-shutdown: true
Should we unfreeze mobs when interacted with by a player?
unfreeze-on-interact: true
Below what TPS should we ignore the option above and not unfreeze mobs that are interacted with?
Set to 0 to disable this option.
unfreeze-on-interact-tps-threshold: 0
Should we unfreeze mobs when they take damage?
unfreeze-on-damage: true
Below what TPS should we ignore the option above and not unfreeze mobs that take damage?
Set to 0 to disable this option.
unfreeze-on-damage-tps-threshold: 0
Should tamed mobs (cats, dogs, horses, etc.) never be frozen?
ignore-tamed: true
Below what TPS should we ignore the option above and start freezing mobs that are tamed?
Set to 0 to disable this option.
ignore-tamed-tps-threshold: 0
Should we ignore mobs named with a name tag?
ignore-named: true
Below what TPS should we ignore the option above and start freezing mobs that are named?
Set to 0 to disable this option.
ignore-named-tps-threshold: 0
Should mobs that are leashed never be frozen?
ignore-leashed: true
Below what TPS should we ignore the option above and start freezing mobs that are leashed?
Set to 0 to disable this option.
ignore-leashed-tps-threshold: 0
Should mobs that are in love mode (breeding mode) never be frozen?
ignore-love-mode: true
Below what TPS should we ignore the option above and start freezing mobs that are in love mode?
Set to 0 to disable this option.
ignore-love-mode-tps-threshold: 0
At what distance (in blocks) should we not freeze mobs that are within that distance of a player?
Set to 0 to disable this option.
ignore-player-proximity: 0
Below that TPS should we ignore the option above and start freezing mobs that are close to players?
Note that this is quite an expensive check. If you have a lot of players it may make the freezing operation last significantly longer.
Set to 0 to disable this option.
ignore-player-proximity-tps-threshold: 0
We will never freeze mobs of this type.
Put mobs that might be in danger if frozen here, like villagers.
See for a list of types.
This is CaSE SenSiTIVe, it needs to be in all CAPS!
never-freeze:
- VILLAGER
- WANDERING_TRADER
- PILLAGER
- VINDICATOR
- VEX
- WITCH
- RAVAGER
- ILLUSIONER
- EVOKER
Below what TPS should we ignore the option above and start freezing mobs on this list?
Set to 0 to disable this option.
never-freeze-tps-threshold: 0
If the server is lagging, we will always freeze mobs of this type. Even if they're not in a large group.
Put mobs that are resource hogs here, like water mobs.
See for a list of types.
This is CaSE SenSiTIVe, it needs to be in all CAPS!
always-freeze:
- COD
- SALMON
- TROPICAL_FISH
- PUFFERFISH
- TURTLE
- SQUID
- DOLPHIN
We will never freeze mobs in these worlds.
ignore-world:
Commands and permissions
Commands:
- /saml - Base command for the plugin, tells you the version.
- /saml reload - Reloads the config files for the plugin.
- /saml stats - Displays the total number of frozen mobs server-wide and per world.
Permissions:
- saml.saml - Gives access to the /saml command.
- saml.notify - You will be notified when a freezing operation begins and ends (If enabled in config).
Compatibility
The plugin will run for versions between 1.9 and 1.14. However, not all features are available for lower versions. Below version 1.13 it is not possible to use the ignore-love-mode or use-paper-get-chunk-async options in the config. This is because it uses API which did not exist at the time. Unfortunately, 1.8 will never be able to be supported as the main API we use to 'freeze' mobs did not exist in 1.8.
You will require Java 8 to run this plugin.
Please note: If you disable unfreeze-on-unload and unfreeze-on-shutdown in the config, frozen entities will be saved to your world. If you then uninstall the plugin these entities will not be unfrozen. If you don't want either of these options enabled, and if you think you're going to uninstall the plugin at some point, it is recommended to have the 'keep-frozen-chunk-cache' option in the config set to true.
评论 0
登录后参与评分
还没有评论,来抢沙发吧