mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-25 18:09:17 +00:00
[ci skip] cleanup work finished
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package org.dreeam.leaf.config;
|
||||
|
||||
public enum EnumConfigCategory {
|
||||
|
||||
ASYNC("async"),
|
||||
PERF("performance"),
|
||||
FIXES("fixes"),
|
||||
|
||||
@@ -20,7 +20,7 @@ public class AsyncLocator extends ConfigModules {
|
||||
Whether or not asynchronous locator should be enabled.
|
||||
This offloads structure locating to other threads.
|
||||
Only for locate command, dolphin treasure finding and eye of ender currently.""",
|
||||
"""
|
||||
"""
|
||||
是否启用异步结构搜索.
|
||||
目前可用于 /locate 指令, 海豚寻宝和末影之眼.""");
|
||||
enabled = config.getBoolean(getBasePath() + ".enabled", enabled);
|
||||
|
||||
@@ -20,7 +20,7 @@ public class AsyncMobSpawning extends ConfigModules {
|
||||
paper's per-player-mob-spawns setting set to true for this to work.
|
||||
One quick note - this does not actually spawn mobs async (that would be very unsafe).
|
||||
This just offloads some expensive calculations that are required for mob spawning.""",
|
||||
"""
|
||||
"""
|
||||
是否异步化生物生成.
|
||||
在实体较多的服务器上, 异步生成可最高带来15%的性能提升.
|
||||
须在Paper配置文件中打开 per-player-mob-spawns 才能生效.""");
|
||||
|
||||
@@ -16,12 +16,12 @@ public class AsyncPlayerDataSave extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
config.addCommentRegionBased(getBasePath(),
|
||||
"""
|
||||
**Experimental feature, may have data lost in some circumstances!**
|
||||
Make PlayerData saving asynchronously.""",
|
||||
"""
|
||||
**实验性功能, 在部分场景下可能丢失玩家数据!**
|
||||
异步保存玩家数据.""");
|
||||
"""
|
||||
**Experimental feature, may have data lost in some circumstances!**
|
||||
Make PlayerData saving asynchronously.""",
|
||||
"""
|
||||
**实验性功能, 在部分场景下可能丢失玩家数据!**
|
||||
异步保存玩家数据.""");
|
||||
|
||||
enabled = config().getBoolean(getBasePath() + ".enabled", enabled);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class MultithreadedTracker extends ConfigModules {
|
||||
config.addCommentRegionBased(getBasePath(), """
|
||||
Make entity tracking saving asynchronously, can improve performance significantly,
|
||||
especially in some massive entities in small area situations.""",
|
||||
"""
|
||||
"""
|
||||
异步实体跟踪,
|
||||
在实体数量多且密集的情况下效果明显.""");
|
||||
|
||||
@@ -30,14 +30,14 @@ public class MultithreadedTracker extends ConfigModules {
|
||||
Enable compat mode ONLY if Citizens or NPC plugins using real entity has installed,
|
||||
Compat mode fixed visible issue with player type NPCs of Citizens,
|
||||
But still recommend to use packet based / virtual entity NPC plugin, e.g. ZNPC Plus, Adyeshach, Fancy NPC or else.""",
|
||||
"""
|
||||
"""
|
||||
是否启用兼容模式,
|
||||
如果你的服务器安装了 Citizens 或其他类似非发包 NPC 插件, 请开启此项."""));
|
||||
autoResize = config.getBoolean(getBasePath() + ".auto-resize", autoResize, config.pickStringRegionBased("""
|
||||
Auto adjust thread pool size based on server load,
|
||||
This will tweak thread pool size dynamically,
|
||||
overrides max-threads and keepalive.""",
|
||||
"""
|
||||
"""
|
||||
根据服务器负载自动调整线程池大小,
|
||||
这会使线程池大小动态调整,
|
||||
覆盖设置 max-threads 和 keepalive."""));
|
||||
|
||||
@@ -17,7 +17,7 @@ public class DontPlacePlayerIfFull extends ConfigModules {
|
||||
Don't let player join server if the server is full.
|
||||
If enable this, you should use 'purpur.joinfullserver' permission instead of
|
||||
PlayerLoginEvent#allow to let player join full server.""",
|
||||
"""
|
||||
"""
|
||||
服务器已满时禁止玩家加入.
|
||||
开启后需使用权限 'purpur.joinfullserver' 而不是
|
||||
PlayerLoginEvent#allow 让玩家进入已满的服务器."""));
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ConfigurableMaxUseItemDistance extends ConfigModules {
|
||||
NOTE: if set to -1 to disable the check,
|
||||
players are able to use some packet modules of hack clients,
|
||||
and NoCom Exploit!!""",
|
||||
"""
|
||||
"""
|
||||
玩家 UseItem 的最大距离.
|
||||
设置为 -1 来禁用最大距离检测.
|
||||
注意: 禁用此项后,
|
||||
|
||||
@@ -14,9 +14,9 @@ public class DisableMovedWronglyThreshold extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".disable-moved-wrongly-threshold", enabled,
|
||||
config.pickStringRegionBased(
|
||||
"Disable moved quickly/wrongly checks.",
|
||||
"关闭 moved wrongly/too quickly! 警告."
|
||||
));
|
||||
config.pickStringRegionBased(
|
||||
"Disable moved quickly/wrongly checks.",
|
||||
"关闭 moved wrongly/too quickly! 警告."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,19 +16,19 @@ public class Knockback extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
snowballCanKnockback = config.getBoolean(getBasePath() + ".snowball-knockback-players", snowballCanKnockback,
|
||||
config.pickStringRegionBased(
|
||||
"Make snowball can knockback players.",
|
||||
"使雪球可以击退玩家."
|
||||
));
|
||||
config.pickStringRegionBased(
|
||||
"Make snowball can knockback players.",
|
||||
"使雪球可以击退玩家."
|
||||
));
|
||||
eggCanKnockback = config.getBoolean(getBasePath() + ".egg-knockback-players", eggCanKnockback,
|
||||
config.pickStringRegionBased(
|
||||
"Make egg can knockback players.",
|
||||
"使鸡蛋可以击退玩家."
|
||||
));
|
||||
config.pickStringRegionBased(
|
||||
"Make egg can knockback players.",
|
||||
"使鸡蛋可以击退玩家."
|
||||
));
|
||||
canPlayerKnockbackZombie = config.getBoolean(getBasePath() + ".can-player-knockback-zombie", canPlayerKnockbackZombie,
|
||||
config.pickStringRegionBased(
|
||||
"Make players can knockback zombie.",
|
||||
"使玩家可以击退僵尸."
|
||||
));
|
||||
config.pickStringRegionBased(
|
||||
"Make players can knockback zombie.",
|
||||
"使玩家可以击退僵尸."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@ public class SmoothTeleport extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath(), enabled, config.pickStringRegionBased(
|
||||
"""
|
||||
**Experimental feature, report any bugs you encounter!**
|
||||
Whether to make a "smooth teleport" when players changing dimension.
|
||||
This requires original world and target world have same logical height to work.""",
|
||||
"""
|
||||
**实验性功能, 请及时反馈你遇到的问题!**
|
||||
是否在玩家切换世界时尝试使用 "平滑传送".
|
||||
此项要求源世界和目标世界逻辑高度相同才会生效."""
|
||||
"""
|
||||
**Experimental feature, report any bugs you encounter!**
|
||||
Whether to make a "smooth teleport" when players changing dimension.
|
||||
This requires original world and target world have same logical height to work.""",
|
||||
"""
|
||||
**实验性功能, 请及时反馈你遇到的问题!**
|
||||
是否在玩家切换世界时尝试使用 "平滑传送".
|
||||
此项要求源世界和目标世界逻辑高度相同才会生效."""
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,13 @@ public class Cache extends ConfigModules {
|
||||
cachePlayerProfileResult = config.getBoolean(getBasePath() + ".cache-player-profile-result", cachePlayerProfileResult, config.pickStringRegionBased("""
|
||||
Cache the player profile result on they first join.
|
||||
It's useful if Mojang's verification server is down.""",
|
||||
"""
|
||||
"""
|
||||
玩家首次加入时缓存 PlayerProfile.
|
||||
正版验证服务器宕机时非常有用."""));
|
||||
cachePlayerProfileResultTimeout = config.getInt(getBasePath() + ".cache-player-profile-result-timeout", cachePlayerProfileResultTimeout,
|
||||
config.pickStringRegionBased(
|
||||
"The timeout of the cache. Unit: Minutes.",
|
||||
"缓存过期时间. 单位: 分钟."
|
||||
));
|
||||
config.pickStringRegionBased(
|
||||
"The timeout of the cache. Unit: Minutes.",
|
||||
"缓存过期时间. 单位: 分钟."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ConnectionMessage extends ConfigModules {
|
||||
available placeholders:
|
||||
%player_name% - player name
|
||||
%player_displayname% - player display name""",
|
||||
"""
|
||||
"""
|
||||
自定义加入 & 退出消息 (MiniMessage 格式), 设置为 'default' 将使用原版消息.
|
||||
可用的内置变量:
|
||||
%player_name% - 玩家名称
|
||||
@@ -29,14 +29,14 @@ public class ConnectionMessage extends ConfigModules {
|
||||
|
||||
joinEnabled = config.getBoolean(getBasePath() + ".join.enabled", joinEnabled);
|
||||
joinMessage = config.getString(getBasePath() + ".join.message", joinMessage, config.pickStringRegionBased(
|
||||
"Join message of player",
|
||||
"玩家加入服务器时的消息"
|
||||
"Join message of player",
|
||||
"玩家加入服务器时的消息"
|
||||
));
|
||||
|
||||
quitEnabled = config.getBoolean(getBasePath() + ".quit.enabled", quitEnabled);
|
||||
quitMessage = config.getString(getBasePath() + ".quit.message", quitMessage, config.pickStringRegionBased(
|
||||
"Quit message of player",
|
||||
"玩家退出服务器时的消息"));
|
||||
"Quit message of player",
|
||||
"玩家退出服务器时的消息"));
|
||||
|
||||
// Legacy compatibility
|
||||
// TODO: config migration
|
||||
|
||||
@@ -18,7 +18,7 @@ public class LagCompensation extends ConfigModules {
|
||||
config.addCommentRegionBased(getBasePath(), """
|
||||
This section contains lag compensation features,
|
||||
which could ensure basic playing experience during a lag.""",
|
||||
"""
|
||||
"""
|
||||
这部分包含滞后补偿功能,
|
||||
可以在卡顿情况下保障基本游戏体验.""");
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class RegionFormatConfig extends ConfigModules {
|
||||
Read Documentation before using: https://github.com/xymb-endcrystalme/LinearRegionFileFormatTools
|
||||
Disclaimer: This is an experimental feature, there is potential risk to lose chunk data.
|
||||
So backup your server before switching to Linear.""",
|
||||
"""
|
||||
"""
|
||||
Linear 是一种使用 ZSTD 压缩而非 ZLIB 的区域文件格式.
|
||||
该格式可节省约 50% 的磁盘空间.
|
||||
使用前请阅读文档: https://github.com/xymb-endcrystalme/LinearRegionFileFormatTools
|
||||
@@ -40,9 +40,9 @@ public class RegionFormatConfig extends ConfigModules {
|
||||
切换到Linear前请备份服务器.""");
|
||||
|
||||
regionFormatTypeName = config.getString(getBasePath() + ".region-format", regionFormatTypeName,
|
||||
config.pickStringRegionBased(
|
||||
"Available region formats: MCA, LINEAR",
|
||||
"可用格式: MCA, LINEAR"));
|
||||
config.pickStringRegionBased(
|
||||
"Available region formats: MCA, LINEAR",
|
||||
"可用格式: MCA, LINEAR"));
|
||||
linearCompressionLevel = config.getInt(getBasePath() + ".linear-compress-level", linearCompressionLevel);
|
||||
throwOnUnknownExtension = config().getBoolean(getBasePath() + ".throw-on-unknown-extension-detected", throwOnUnknownExtension);
|
||||
linearFlushFrequency = config.getInt(getBasePath() + ".flush-interval-seconds", linearFlushFrequency);
|
||||
|
||||
@@ -14,9 +14,9 @@ public class RemoveChangeNonEditableSignWarning extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".remove-change-non-editable-sign-warning", enabled,
|
||||
config.pickStringRegionBased(
|
||||
"Enable to prevent console spam.",
|
||||
"移除修改无法编辑的告示牌时输出的警告."
|
||||
));
|
||||
config.pickStringRegionBased(
|
||||
"Enable to prevent console spam.",
|
||||
"移除修改无法编辑的告示牌时输出的警告."
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class RemoveSpigotCheckBungee extends ConfigModules {
|
||||
enabled = config.getBoolean(getBasePath(), enabled, config.pickStringRegionBased("""
|
||||
Enable player enter backend server through proxy
|
||||
without backend server enabling its bungee mode.""",
|
||||
"""
|
||||
"""
|
||||
使服务器无需打开 bungee 模式即可让玩家加入后端服务器."""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class RemoveVanillaUsernameCheck extends ConfigModules {
|
||||
enabled = config.getBoolean(getBasePath(), enabled, config.pickStringRegionBased("""
|
||||
Remove Vanilla username check,
|
||||
allowing all characters as username.""",
|
||||
"""
|
||||
"""
|
||||
移除原版的用户名验证,
|
||||
让所有字符均可作为玩家名."""));
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class SecureSeed extends ConfigModules {
|
||||
config.addCommentRegionBased(getBasePath(), """
|
||||
Once you enable secure seed, all ores and structures are generated with 1024-bit seed
|
||||
instead of using 64-bit seed in vanilla, made seed cracker become impossible.""",
|
||||
"""
|
||||
"""
|
||||
安全种子开启后, 所有矿物与结构都将使用1024位的种子进行生成, 无法被破解.""");
|
||||
|
||||
enabled = config.getBoolean(getBasePath() + ".enabled", enabled);
|
||||
|
||||
@@ -21,19 +21,19 @@ public class SentryDSN extends ConfigModules {
|
||||
String sentryConfig = config.getString(sentryDsnConfigPath = getBasePath() + ".dsn", sentryDsn, config.pickStringRegionBased("""
|
||||
Sentry DSN for improved error logging, leave blank to disable,
|
||||
Obtain from https://sentry.io/""",
|
||||
"""
|
||||
"""
|
||||
Sentry DSN (出现严重错误时将发送至配置的Sentry DSN地址) (留空关闭)"""));
|
||||
|
||||
sentryDsn = sentryEnvironment == null
|
||||
? sentryConfig
|
||||
: sentryEnvironment;
|
||||
? sentryConfig
|
||||
: sentryEnvironment;
|
||||
logLevel = config.getString(getBasePath() + ".log-level", logLevel, config.pickStringRegionBased("""
|
||||
Logs with a level higher than or equal to this level will be recorded.""",
|
||||
"""
|
||||
"""
|
||||
大于等于该等级的日志会被记录."""));
|
||||
onlyLogThrown = config.getBoolean(getBasePath() + ".only-log-thrown", onlyLogThrown, config.pickStringRegionBased("""
|
||||
Only log with a Throwable will be recorded after enabling this.""",
|
||||
"""
|
||||
"""
|
||||
是否仅记录带有 Throwable 的日志."""));
|
||||
|
||||
if (sentryDsn != null && !sentryDsn.isBlank()) {
|
||||
|
||||
@@ -16,7 +16,7 @@ public class UnknownCommandMessage extends ConfigModules {
|
||||
unknownCommandMessage = config.getString(getBasePath() + ".unknown-command", unknownCommandMessage, config.pickStringRegionBased("""
|
||||
Unknown command message, using MiniMessage format, set to "default" to use vanilla message,
|
||||
placeholder: <detail>, shows detail of the unknown command information.""",
|
||||
"""
|
||||
"""
|
||||
发送未知命令时的消息, 使用 MiniMessage 格式, 设置为 "default" 使用原版消息.
|
||||
变量: <detail>, 显示未知命令详细信息."""));
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ChatMessageSignature extends ConfigModules {
|
||||
And also disables the popup when joining a server without
|
||||
'secure chat', such as offline-mode servers.
|
||||
""",
|
||||
"""
|
||||
"""
|
||||
是否启用聊天签名, 禁用后玩家无法进行聊天举报."""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@ public class DontSaveEntity extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
dontSavePrimedTNT = config.getBoolean(getBasePath() + ".dont-save-primed-tnt", dontSavePrimedTNT,
|
||||
config.pickStringRegionBased(
|
||||
config.pickStringRegionBased(
|
||||
"""
|
||||
Disable save primed tnt on chunk unloads.
|
||||
Useful for redstone/technical servers, can prevent machines from being exploded by TNT,
|
||||
when player disconnected caused by Internet issue.""",
|
||||
Disable save primed tnt on chunk unloads.
|
||||
Useful for redstone/technical servers, can prevent machines from being exploded by TNT,
|
||||
when player disconnected caused by Internet issue.""",
|
||||
"""
|
||||
区块卸载时不保存掉落的方块和激活的 TNT,
|
||||
可以避免在玩家掉线时机器被炸毁."""));
|
||||
区块卸载时不保存掉落的方块和激活的 TNT,
|
||||
可以避免在玩家掉线时机器被炸毁."""));
|
||||
dontSaveFallingBlock = config.getBoolean(getBasePath() + ".dont-save-falling-block", dontSaveFallingBlock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,34 +29,34 @@ public class DynamicActivationofBrain extends ConfigModules {
|
||||
config.addCommentRegionBased(getBasePath(), """
|
||||
Optimizes entity brains when
|
||||
they're far away from the player""",
|
||||
"""
|
||||
"""
|
||||
根据距离动态优化生物 AI""");
|
||||
|
||||
enabled = config.getBoolean(getBasePath() + ".enabled", enabled);
|
||||
dontEnableIfInWater = config.getBoolean(getBasePath() + ".dont-enable-if-in-water", dontEnableIfInWater, config.pickStringRegionBased("""
|
||||
After enabling this, non-aquatic entities in the water will not be affected by DAB.
|
||||
This could fix entities suffocate in the water.""",
|
||||
"""
|
||||
"""
|
||||
启用此项后, 在水中的非水生生物将不会被 DAB 影响.
|
||||
可以避免距离玩家较远的生物在水里淹死."""));
|
||||
startDistance = config.getInt(getBasePath() + ".start-distance", startDistance, config.pickStringRegionBased("""
|
||||
This value determines how far away an entity has to be
|
||||
from the player to start being effected by DEAR.""",
|
||||
"""
|
||||
"""
|
||||
生物距离玩家多少格 DAB 开始生效"""));
|
||||
maximumActivationPrio = config.getInt(getBasePath() + ".max-tick-freq", maximumActivationPrio, config.pickStringRegionBased("""
|
||||
This value defines how often in ticks, the furthest entity
|
||||
will get their pathfinders and behaviors ticked. 20 = 1s""",
|
||||
"""
|
||||
"""
|
||||
最远处的实体每隔多少刻tick一次"""));
|
||||
activationDistanceMod = config.getInt(getBasePath() + ".activation-dist-mod", activationDistanceMod, """
|
||||
This value defines how much distance modifies an entity's
|
||||
tick frequency. freq = (distanceToPlayer^2) / (2^value)",
|
||||
If you want further away entities to tick less often, use 7.
|
||||
If you want further away entities to tick more often, try 9.""");
|
||||
This value defines how much distance modifies an entity's
|
||||
tick frequency. freq = (distanceToPlayer^2) / (2^value)",
|
||||
If you want further away entities to tick less often, use 7.
|
||||
If you want further away entities to tick more often, try 9.""");
|
||||
blackedEntities = config.getList(getBasePath() + ".blacklisted-entities", blackedEntities,
|
||||
config.pickStringRegionBased("A list of entities to ignore for activation",
|
||||
"不会被 DAB 影响的实体列表"));
|
||||
config.pickStringRegionBased("A list of entities to ignore for activation",
|
||||
"不会被 DAB 影响的实体列表"));
|
||||
|
||||
startDistanceSquared = startDistance * startDistance;
|
||||
|
||||
@@ -72,8 +72,8 @@ public class DynamicActivationofBrain extends ConfigModules {
|
||||
String typeId = name.toLowerCase().startsWith(DEFAULT_PREFIX) ? name : DEFAULT_PREFIX + name;
|
||||
|
||||
EntityType.byString(typeId).ifPresentOrElse(entityType ->
|
||||
entityType.dabEnabled = false,
|
||||
() -> LeafConfig.LOGGER.warn("Skip unknown entity {}, in {}", name, getBasePath() + ".blacklisted-entities")
|
||||
entityType.dabEnabled = false,
|
||||
() -> LeafConfig.LOGGER.warn("Skip unknown entity {}, in {}", name, getBasePath() + ".blacklisted-entities")
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class EnableCachedMTBEntityTypeConvert extends ConfigModules {
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".enable-cached-minecraft-to-bukkit-entitytype-convert", enabled, config.pickStringRegionBased("""
|
||||
Whether to cache expensive CraftEntityType#minecraftToBukkit call.""",
|
||||
"""
|
||||
"""
|
||||
是否缓存Minecraft到Bukkit的实体类型转换."""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,44 +18,45 @@ public class FastRNG extends ConfigModules {
|
||||
public static boolean warnForSlimeChunk = true;
|
||||
public static boolean useLegacyForSlimeChunk = false;
|
||||
|
||||
public static boolean worldgenEnabled() { return enabled && enableForWorldgen; } // Helper function
|
||||
public static boolean worldgenEnabled() {return enabled && enableForWorldgen;} // Helper function
|
||||
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
config.addCommentRegionBased(getBasePath(), """
|
||||
Use faster random generator?
|
||||
Requires a JVM that supports RandomGenerator.
|
||||
Some JREs don't support this.""",
|
||||
"""
|
||||
"""
|
||||
是否使用更快的随机生成器?
|
||||
需要支持 RandomGenerator 的 JVM.
|
||||
一些 JRE 不支持此功能.""");
|
||||
|
||||
enabled = config.getBoolean(getBasePath() + ".enabled", enabled);
|
||||
randomGenerator = config.getString(getBasePath() + ".random-generator", randomGenerator,
|
||||
config.pickStringRegionBased(
|
||||
"""
|
||||
Which random generator will be used?
|
||||
See https://openjdk.org/jeps/356""",
|
||||
"""
|
||||
使用什么种类的随机生成器.
|
||||
请参阅 https://openjdk.org/jeps/356"""));
|
||||
enableForWorldgen = config.getBoolean(getBasePath() + ".enable-for-worldgen", enableForWorldgen,
|
||||
config.pickStringRegionBased(
|
||||
"""
|
||||
Enable faster random generator for world generation.
|
||||
WARNING: This will affect world generation!!!""",
|
||||
"""
|
||||
是否为世界生成启用更快的随机生成器.
|
||||
警告: 此项会影响世界生成!!!"""));
|
||||
warnForSlimeChunk = config.getBoolean(getBasePath() + ".warn-for-slime-chunk", warnForSlimeChunk,
|
||||
config.pickStringRegionBased(
|
||||
"Warn if you are not using legacy random source for slime chunk generation.",
|
||||
"是否在没有为史莱姆区块使用原版随机生成器的情况下进行警告."));
|
||||
useLegacyForSlimeChunk = config.getBoolean(getBasePath() + ".use-legacy-random-for-slime-chunk", useLegacyForSlimeChunk, config.pickStringRegionBased(
|
||||
config.pickStringRegionBased(
|
||||
"""
|
||||
Which random generator will be used?
|
||||
See https://openjdk.org/jeps/356""",
|
||||
"""
|
||||
使用什么种类的随机生成器.
|
||||
请参阅 https://openjdk.org/jeps/356"""));
|
||||
enableForWorldgen = config.getBoolean(getBasePath() + ".enable-for-worldgen", enableForWorldgen,
|
||||
config.pickStringRegionBased(
|
||||
"""
|
||||
Enable faster random generator for world generation.
|
||||
WARNING: This will affect world generation!!!""",
|
||||
"""
|
||||
是否为世界生成启用更快的随机生成器.
|
||||
警告: 此项会影响世界生成!!!"""));
|
||||
warnForSlimeChunk = config.getBoolean(getBasePath() + ".warn-for-slime-chunk", warnForSlimeChunk,
|
||||
config.pickStringRegionBased(
|
||||
"Warn if you are not using legacy random source for slime chunk generation.",
|
||||
"是否在没有为史莱姆区块使用原版随机生成器的情况下进行警告."));
|
||||
useLegacyForSlimeChunk = config.getBoolean(getBasePath() + ".use-legacy-random-for-slime-chunk", useLegacyForSlimeChunk, config.pickStringRegionBased(
|
||||
"""
|
||||
Use legacy random source for slime chunk generation,
|
||||
to follow vanilla behavior.""",
|
||||
"""
|
||||
"""
|
||||
是否使用原版随机生成器来生成史莱姆区块."""));
|
||||
|
||||
if (enabled) {
|
||||
@@ -63,7 +64,7 @@ public class FastRNG extends ConfigModules {
|
||||
RandomGeneratorFactory.of(randomGenerator);
|
||||
} catch (Exception e) {
|
||||
LeafConfig.LOGGER.error("Faster random generator is enabled but {} is not supported by your JVM, " +
|
||||
"falling back to legacy random source.", randomGenerator);
|
||||
"falling back to legacy random source.", randomGenerator);
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
@@ -72,9 +73,9 @@ public class FastRNG extends ConfigModules {
|
||||
LeafConfig.LOGGER.warn("You enabled faster random generator, it will offset location of slime chunk");
|
||||
LeafConfig.LOGGER.warn("If your server has slime farms or facilities need vanilla slime chunk,");
|
||||
LeafConfig.LOGGER.warn("set performance.faster-random-generator.use-legacy-random-for-slime-chunk " +
|
||||
"to true to use LegacyRandomSource for slime chunk generation.");
|
||||
"to true to use LegacyRandomSource for slime chunk generation.");
|
||||
LeafConfig.LOGGER.warn("Set performance.faster-random-generator.warn-for-slime-chunk to false to " +
|
||||
"disable this warning.");
|
||||
"disable this warning.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ public class FasterStructureGenFutureSequencing extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".faster-structure-gen-future-sequencing", enabled,
|
||||
config.pickStringRegionBased(
|
||||
"May cause the inconsistent order of future compose tasks.",
|
||||
"更快的结构生成任务分段."));
|
||||
config.pickStringRegionBased(
|
||||
"May cause the inconsistent order of future compose tasks.",
|
||||
"更快的结构生成任务分段."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ public class ThrottleHopperWhenFull extends ConfigModules {
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".enabled", enabled, config.pickStringRegionBased("""
|
||||
Throttles the hopper if target container is full.""",
|
||||
"""
|
||||
"""
|
||||
是否在目标容器已满时阻塞漏斗."""));
|
||||
skipTicks = config.getInt(getBasePath() + ".skip-ticks", skipTicks, config.pickStringRegionBased("""
|
||||
How many ticks to throttle when the Hopper is throttled.""",
|
||||
"""
|
||||
"""
|
||||
每次阻塞多少 tick."""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ThrottleInactiveGoalSelectorTick extends ConfigModules {
|
||||
enabled = config.getBoolean(getBasePath() + ".inactive-goal-selector-throttle", enabled, config.pickStringRegionBased("""
|
||||
Throttles the AI goal selector in entity inactive ticks.
|
||||
This can improve performance by a few percent, but has minor gameplay implications.""",
|
||||
"""
|
||||
"""
|
||||
是否在实体不活跃 tick 时阻塞 AI 目标选择器.
|
||||
有助于提升性能, 但对游戏有轻微影响."""));
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ public class VT4BukkitScheduler extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".use-virtual-thread-for-async-scheduler", enabled,
|
||||
config.pickStringRegionBased(
|
||||
"Use the new Virtual Thread introduced in JDK 21 for CraftAsyncScheduler.",
|
||||
"是否为异步任务调度器使用虚拟线程."));
|
||||
config.pickStringRegionBased(
|
||||
"Use the new Virtual Thread introduced in JDK 21 for CraftAsyncScheduler.",
|
||||
"是否为异步任务调度器使用虚拟线程."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ public class VT4ChatExecutor extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".use-virtual-thread-for-async-chat-executor", enabled,
|
||||
config.pickStringRegionBased(
|
||||
"Use the new Virtual Thread introduced in JDK 21 for Async Chat Executor.",
|
||||
"是否为异步聊天线程使用虚拟线程."));
|
||||
config.pickStringRegionBased(
|
||||
"Use the new Virtual Thread introduced in JDK 21 for Async Chat Executor.",
|
||||
"是否为异步聊天线程使用虚拟线程."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ public class VT4UserAuthenticator extends ConfigModules {
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config.getBoolean(getBasePath() + ".use-virtual-thread-for-user-authenticator", enabled,
|
||||
config.pickStringRegionBased(
|
||||
"Use the new Virtual Thread introduced in JDK 21 for User Authenticator.",
|
||||
"是否为用户验证器使用虚拟线程."));
|
||||
config.pickStringRegionBased(
|
||||
"Use the new Virtual Thread introduced in JDK 21 for User Authenticator.",
|
||||
"是否为用户验证器使用虚拟线程."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ public class LagCompensation {
|
||||
}
|
||||
|
||||
public static class TPSCalculator {
|
||||
|
||||
public static Long lastTick;
|
||||
public static Long currentTick;
|
||||
private static double allMissedTicks = 0;
|
||||
@@ -51,6 +52,7 @@ public class LagCompensation {
|
||||
}
|
||||
|
||||
currentTick = System.currentTimeMillis();
|
||||
|
||||
addToHistory(getTPS());
|
||||
clearMissedTicks();
|
||||
missedTick();
|
||||
@@ -70,9 +72,11 @@ public class LagCompensation {
|
||||
|
||||
public static double getAverageTPS() {
|
||||
double sum = 0.0;
|
||||
|
||||
for (double value : tpsHistory) {
|
||||
sum += value;
|
||||
}
|
||||
|
||||
return tpsHistory.isEmpty() ? 0.1 : sum / tpsHistory.size();
|
||||
}
|
||||
|
||||
@@ -81,6 +85,7 @@ public class LagCompensation {
|
||||
if (getMSPT() <= 0) return 0.1;
|
||||
|
||||
double tps = 1000 / (double) getMSPT();
|
||||
|
||||
return tps > MAX_TPS ? MAX_TPS : tps;
|
||||
}
|
||||
|
||||
@@ -89,6 +94,7 @@ public class LagCompensation {
|
||||
|
||||
long mspt = getMSPT() <= 0 ? 50 : getMSPT();
|
||||
double missedTicks = (mspt / (double) FULL_TICK) - 1;
|
||||
|
||||
allMissedTicks += missedTicks <= 0 ? 0 : missedTicks;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,16 +7,17 @@ import java.util.function.IntFunction;
|
||||
|
||||
public class CachedOrNewBitsGetter {
|
||||
|
||||
private static final IntFunction<BitSet> bitSetConstructor = BitSet::new;
|
||||
|
||||
public static ThreadLocal<Int2ObjectOpenHashMap<BitSet>> BITSETS = ThreadLocal.withInitial(Int2ObjectOpenHashMap::new);
|
||||
private static final IntFunction<BitSet> BITSET_CONSTRUCTOR = BitSet::new;
|
||||
private static final ThreadLocal<Int2ObjectOpenHashMap<BitSet>> BITSETS = ThreadLocal.withInitial(Int2ObjectOpenHashMap::new);
|
||||
|
||||
private CachedOrNewBitsGetter() {
|
||||
}
|
||||
|
||||
public static BitSet getCachedOrNewBitSet(int bits) {
|
||||
final BitSet bitSet = BITSETS.get().computeIfAbsent(bits, bitSetConstructor);
|
||||
final BitSet bitSet = BITSETS.get().computeIfAbsent(bits, BITSET_CONSTRUCTOR);
|
||||
|
||||
bitSet.clear();
|
||||
|
||||
return bitSet;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user