9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-28 11:29:12 +00:00

Configurable trading with the void

This commit is contained in:
violetc
2025-06-06 12:31:56 +08:00
parent 73bd42af2e
commit 59856751ab
5 changed files with 65 additions and 30 deletions

View File

@@ -30,7 +30,6 @@ import org.leavesmc.leaves.protocol.CarpetServerProtocol.CarpetRules;
import org.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeature;
import org.leavesmc.leaves.protocol.bladeren.BladerenProtocol.LeavesFeatureSet;
import org.leavesmc.leaves.region.RegionFileFormat;
import org.leavesmc.leaves.util.ElytraAeronauticsHelper;
import org.leavesmc.leaves.util.ForcePeacefulModeSwitchType;
import org.leavesmc.leaves.util.MathUtils;
@@ -336,6 +335,18 @@ public final class LeavesConfig {
VANILLA_20, VANILLA_21, MIXED
}
}
@GlobalConfig(value = "void-trade", validator = VoidTradeValidator.class)
public boolean voidTrade = false;
private static class VoidTradeValidator extends BooleanConfigValidator {
@Override
public void verify(Boolean old, Boolean value) throws IllegalArgumentException {
if (!value && old != null && LeavesConfig.modify.forceVoidTrade) {
throw new IllegalArgumentException("force-void-trade is enable, void-trade always need true");
}
}
}
}
public ElytraAeronauticsConfig elytraAeronautics = new ElytraAeronauticsConfig();
@@ -411,9 +422,25 @@ public final class LeavesConfig {
}
}
@GlobalConfig("force-void-trade")
@GlobalConfig(value = "force-void-trade", validator = ForceVoidTradeValidator.class)
public boolean forceVoidTrade = false;
private static class ForceVoidTradeValidator extends BooleanConfigValidator {
@Override
public void verify(Boolean old, Boolean value) throws IllegalArgumentException {
if (value) {
LeavesConfig.modify.oldMC.voidTrade = true;
}
}
@Override
public void runAfterLoader(Boolean value, boolean reload) {
if (value) {
LeavesConfig.modify.oldMC.voidTrade = true;
}
}
}
@GlobalConfig(value = "mc-technical-survival-mode", validator = McTechnicalModeValidator.class, lock = true)
public boolean mcTechnicalMode = true;