forked from virt-mirrors/Sit
Merge branch '1.21.1' into 1.20.6
# Conflicts: # gradle.properties
This commit is contained in:
commit
a971fa9926
11 changed files with 307 additions and 87 deletions
|
@ -28,6 +28,12 @@ public class CustomBlock {
|
|||
this.blockStates = blockStates;
|
||||
}
|
||||
|
||||
public CustomBlock(CustomBlock customBlock) {
|
||||
this.blockIds = new ArrayList<>(customBlock.blockIds);
|
||||
this.blockTags = new ArrayList<>(customBlock.blockTags);
|
||||
this.blockStates = new ArrayList<>(customBlock.blockStates);
|
||||
}
|
||||
|
||||
public ArrayList<String> getBlockIds() {
|
||||
return blockIds;
|
||||
}
|
||||
|
|
|
@ -89,9 +89,12 @@ public class FileData {
|
|||
));
|
||||
|
||||
public static final ArrayList<CustomBlock> INTERACTION_BLOCKS = new ArrayList<>(Arrays.asList(
|
||||
new CustomBlock(new ArrayList<>(Arrays.asList("minecraft:crafter")),new ArrayList<>(Arrays.asList(
|
||||
new CustomBlock(new ArrayList<>(Arrays.asList(
|
||||
"minecraft:crafter","minecraft:repeating_command_block","minecraft:chain_command_block","minecraft:command_block")),
|
||||
new ArrayList<>(Arrays.asList(
|
||||
"#minecraft:shulker_boxes","#c:player_workstations/furnaces","#c:player_workstations/crafting_tables",
|
||||
"#c:villager_job_sites","#minecraft:trapdoors","#c:chests")),new ArrayList<>())
|
||||
"#c:villager_job_sites","#minecraft:trapdoors","#c:chests")),
|
||||
new ArrayList<>())
|
||||
));
|
||||
|
||||
public static final HandSetting MAIN_HAND = new HandSetting(HandSetting.SittingRequirement.EMPTY, new HandSetting.Filter(
|
||||
|
|
|
@ -16,25 +16,33 @@ import java.nio.file.Files;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Properties;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ServerConfig implements CustomFile<ServerConfig> {
|
||||
|
||||
@SerializedName("version")
|
||||
private Double version = 2.1;
|
||||
private Double version = 2.2;
|
||||
|
||||
@SerializedName("lang")
|
||||
private String lang = "en_us";
|
||||
@SerializedName("lang-options")
|
||||
private final String langOptions = "en_us, it_it, pt_br, tr_tr, zh_tw";
|
||||
private final String langOptions = "en_us, it_it, pt_br, tr_tr, zh_tw, zh_ch, de_de";
|
||||
|
||||
@SerializedName("keep-active")
|
||||
private Boolean keepActive = true;
|
||||
@SerializedName("sit-while-seated")
|
||||
private Boolean sitWhileSeated = false;
|
||||
@SerializedName("preset-blocks")
|
||||
private PresetBlocks presetBlocks = new PresetBlocks();
|
||||
|
||||
@SerializedName("height-difference-limit")
|
||||
private YDifferenceLimit yDifferenceLimit = new YDifferenceLimit();
|
||||
|
||||
@SerializedName("custom-enabled")
|
||||
private Boolean customEnabled = false;
|
||||
@SerializedName("custom-blocks")
|
||||
private ArrayList<SittingBlock> sittingBlocks = FileData.Defaults.SITTING_BLOCKS;
|
||||
|
||||
@SerializedName("blacklisted-blocks")
|
||||
private ArrayList<CustomBlock> blacklistedBlocks = FileData.Defaults.BLACKLISTED_BLOCKS;
|
||||
@SerializedName("interaction-blocks")
|
||||
|
@ -43,15 +51,7 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
|||
public ServerConfig() {}
|
||||
|
||||
public ServerConfig(ServerConfig serverConfig) {
|
||||
this.version = serverConfig.version;
|
||||
this.lang = serverConfig.lang;
|
||||
this.keepActive = serverConfig.keepActive;
|
||||
this.sitWhileSeated = serverConfig.sitWhileSeated;
|
||||
this.presetBlocks = serverConfig.presetBlocks;
|
||||
this.customEnabled = serverConfig.customEnabled;
|
||||
this.sittingBlocks = serverConfig.sittingBlocks;
|
||||
this.blacklistedBlocks = serverConfig.blacklistedBlocks;
|
||||
this.interactionBlocks = serverConfig.interactionBlocks;
|
||||
loadFileData(serverConfig);
|
||||
}
|
||||
|
||||
public ServerConfig(Double version, String lang, boolean keepActive, boolean sitWhileSeated,
|
||||
|
@ -89,6 +89,10 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
|||
return presetBlocks;
|
||||
}
|
||||
|
||||
public YDifferenceLimit getYDifferenceLimit() {
|
||||
return yDifferenceLimit;
|
||||
}
|
||||
|
||||
public Boolean isCustomEnabled() {
|
||||
return customEnabled;
|
||||
}
|
||||
|
@ -125,6 +129,13 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
|||
this.fullBlocks = fullBlocks;
|
||||
}
|
||||
|
||||
public PresetBlocks(PresetBlocks presetBlocks) {
|
||||
this.stairs = presetBlocks.stairs;
|
||||
this.slabs = presetBlocks.slabs;
|
||||
this.carpets = presetBlocks.carpets;
|
||||
this.fullBlocks = presetBlocks.fullBlocks;
|
||||
}
|
||||
|
||||
public boolean isStairs() {
|
||||
return stairs;
|
||||
}
|
||||
|
@ -142,6 +153,42 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
|||
}
|
||||
}
|
||||
|
||||
public static class YDifferenceLimit {
|
||||
@SerializedName("above")
|
||||
private Double above = 1.0;
|
||||
@SerializedName("below")
|
||||
private Double below = 1.0;
|
||||
|
||||
public YDifferenceLimit() {
|
||||
}
|
||||
|
||||
public YDifferenceLimit(Double above, Double below) {
|
||||
this.above = above;
|
||||
this.below = below;
|
||||
}
|
||||
|
||||
public YDifferenceLimit(YDifferenceLimit yDifferenceLimit) {
|
||||
this.above = yDifferenceLimit.above;
|
||||
this.below = yDifferenceLimit.below;
|
||||
}
|
||||
|
||||
public Double getAbove() {
|
||||
return above;
|
||||
}
|
||||
|
||||
public void setAbove(Double above) {
|
||||
this.above = above;
|
||||
}
|
||||
|
||||
public Double getBelow() {
|
||||
return below;
|
||||
}
|
||||
|
||||
public void setBelow(Double below) {
|
||||
this.below = below;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
loadFileData(new ServerConfig());
|
||||
|
@ -158,17 +205,23 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
|||
this.lang = newFile.lang;
|
||||
this.keepActive = newFile.keepActive;
|
||||
this.sitWhileSeated = newFile.sitWhileSeated;
|
||||
this.presetBlocks = newFile.presetBlocks;
|
||||
|
||||
this.presetBlocks = new PresetBlocks(newFile.presetBlocks);
|
||||
|
||||
this.yDifferenceLimit = new YDifferenceLimit(newFile.yDifferenceLimit);
|
||||
|
||||
this.customEnabled = newFile.customEnabled;
|
||||
this.sittingBlocks = newFile.sittingBlocks;
|
||||
this.blacklistedBlocks = newFile.blacklistedBlocks;
|
||||
this.sittingBlocks = newFile.sittingBlocks.stream().map(SittingBlock::new).collect(Collectors.toCollection(ArrayList::new));
|
||||
this.blacklistedBlocks = newFile.blacklistedBlocks.stream().map(CustomBlock::new).collect(Collectors.toCollection(ArrayList::new));
|
||||
this.interactionBlocks = newFile.interactionBlocks.stream().map(CustomBlock::new).collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
/// update to 2.1, just a new list, nothing to change
|
||||
if (version == 2.0) {
|
||||
version = 2.1;
|
||||
/// update to 2.2, new settings, no changes
|
||||
if (version >= 2.0 && version <= 2.1) {
|
||||
version = 2.2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,4 +22,9 @@ public class SittingBlock extends CustomBlock {
|
|||
super(blockIds, blockTags, blockStates);
|
||||
this.sittingHeight = sittingHeight;
|
||||
}
|
||||
|
||||
public SittingBlock(SittingBlock sittingBlock) {
|
||||
super(sittingBlock);
|
||||
this.sittingHeight = sittingBlock.sittingHeight;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue