Feature: simulationDistance rule (#1280)
* simulationDistance rule Closes gnembon/fabric-carpet#1200 * Update translation of zh_cn for simulationDistance
This commit is contained in:
1 parent
77092924bc
commit
8a7ca3a876
2 files changed
+45
No files matched your search
@@ -715,6 +715,47 @@ public class CarpetSettings
|
|||||||
)
|
)
|
||||||
public static int viewDistance = 0;
|
public static int viewDistance = 0;
|
||||||
|
|
||||||
|
private static class SimulationDistanceValidator extends Validator<Integer>
|
||||||
|
{
|
||||||
|
@Override public Integer validate(ServerCommandSource source, ParsedRule<Integer> currentRule, Integer newValue, String string)
|
||||||
|
{
|
||||||
|
if (currentRule.get().equals(newValue) || source == null)
|
||||||
|
{
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
if (newValue < 0 || newValue > 32)
|
||||||
|
{
|
||||||
|
Messenger.m(source, "r simulation distance has to be between 0 and 32");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MinecraftServer server = source.getServer();
|
||||||
|
|
||||||
|
if (server.isDedicated())
|
||||||
|
{
|
||||||
|
int vd = (newValue >= 2)?newValue:((DedicatedServer) server).getProperties().simulationDistance;
|
||||||
|
if (vd != server.getPlayerManager().getSimulationDistance())
|
||||||
|
server.getPlayerManager().setSimulationDistance(vd);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Messenger.m(source, "r simulation distance can only be changed on a server");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String description() { return "You must choose a value from 0 (use server settings) to 32";}
|
||||||
|
}
|
||||||
|
@Rule(
|
||||||
|
desc = "Changes the simulation distance of the server.",
|
||||||
|
extra = "Set to 0 to not override the value in server settings.",
|
||||||
|
options = {"0", "12", "16", "32"},
|
||||||
|
category = CREATIVE,
|
||||||
|
strict = false,
|
||||||
|
validate = SimulationDistanceValidator.class
|
||||||
|
)
|
||||||
|
public static int simulationDistance = 0;
|
||||||
|
|
||||||
public static class ChangeSpawnChunksValidator extends Validator<Integer> {
|
public static class ChangeSpawnChunksValidator extends Validator<Integer> {
|
||||||
public static void changeSpawnSize(int size)
|
public static void changeSpawnSize(int size)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -187,6 +187,10 @@
|
|||||||
"rule.viewDistance.desc": "改变服务器视距,设为0以使用默认值",
|
"rule.viewDistance.desc": "改变服务器视距,设为0以使用默认值",
|
||||||
"rule.viewDistance.extra.0": "你必须在0(使用服务器默认设置)-32取一个整数",
|
"rule.viewDistance.extra.0": "你必须在0(使用服务器默认设置)-32取一个整数",
|
||||||
|
|
||||||
|
"rule.simulationDistance.name": "自定义模拟视距",
|
||||||
|
"rule.simulationDistance.desc": "改变服务器模拟视距,设为0以使用默认值",
|
||||||
|
"rule.simulationDistance.extra.0": "你必须在0(使用服务器默认设置)-32取一个整数",
|
||||||
|
|
||||||
"rule.xpNoCooldown.name": "经验吸收无冷却",
|
"rule.xpNoCooldown.name": "经验吸收无冷却",
|
||||||
"rule.xpNoCooldown.desc": "玩家吸收经验球时不会有冷却时间",
|
"rule.xpNoCooldown.desc": "玩家吸收经验球时不会有冷却时间",
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user