forked from virt-mirrors/Sit
server config interaction block list + version bump
This commit is contained in:
parent
5b812720ce
commit
40eb03c967
2 changed files with 28 additions and 5 deletions
|
@ -88,6 +88,12 @@ public class FileData {
|
||||||
new CustomBlock(new ArrayList<>(),new ArrayList<>(Arrays.asList("#minecraft:shulker_boxes")),new ArrayList<>())
|
new CustomBlock(new ArrayList<>(),new ArrayList<>(Arrays.asList("#minecraft:shulker_boxes")),new ArrayList<>())
|
||||||
));
|
));
|
||||||
|
|
||||||
|
public static final ArrayList<CustomBlock> INTERACTION_BLOCKS = new ArrayList<>(Arrays.asList(
|
||||||
|
new CustomBlock(new ArrayList<>(Arrays.asList("minecraft:crafter")),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<>())
|
||||||
|
));
|
||||||
|
|
||||||
public static final HandSetting MAIN_HAND = new HandSetting(HandSetting.SittingRequirement.EMPTY, new HandSetting.Filter(
|
public static final HandSetting MAIN_HAND = new HandSetting(HandSetting.SittingRequirement.EMPTY, new HandSetting.Filter(
|
||||||
false,new HandSetting.Filter.Presets(),
|
false,new HandSetting.Filter.Presets(),
|
||||||
new CustomItem(
|
new CustomItem(
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.Properties;
|
||||||
public class ServerConfig implements CustomFile<ServerConfig> {
|
public class ServerConfig implements CustomFile<ServerConfig> {
|
||||||
|
|
||||||
@SerializedName("version")
|
@SerializedName("version")
|
||||||
private Double version = 2.0;
|
private Double version = 2.1;
|
||||||
@SerializedName("lang")
|
@SerializedName("lang")
|
||||||
private String lang = "en_us";
|
private String lang = "en_us";
|
||||||
@SerializedName("lang-options")
|
@SerializedName("lang-options")
|
||||||
|
@ -37,6 +37,8 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
||||||
private ArrayList<SittingBlock> sittingBlocks = FileData.Defaults.SITTING_BLOCKS;
|
private ArrayList<SittingBlock> sittingBlocks = FileData.Defaults.SITTING_BLOCKS;
|
||||||
@SerializedName("blacklisted-blocks")
|
@SerializedName("blacklisted-blocks")
|
||||||
private ArrayList<CustomBlock> blacklistedBlocks = FileData.Defaults.BLACKLISTED_BLOCKS;
|
private ArrayList<CustomBlock> blacklistedBlocks = FileData.Defaults.BLACKLISTED_BLOCKS;
|
||||||
|
@SerializedName("interaction-blocks")
|
||||||
|
private ArrayList<CustomBlock> interactionBlocks = FileData.Defaults.INTERACTION_BLOCKS;
|
||||||
|
|
||||||
public ServerConfig() {}
|
public ServerConfig() {}
|
||||||
|
|
||||||
|
@ -49,11 +51,13 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
||||||
this.customEnabled = serverConfig.customEnabled;
|
this.customEnabled = serverConfig.customEnabled;
|
||||||
this.sittingBlocks = serverConfig.sittingBlocks;
|
this.sittingBlocks = serverConfig.sittingBlocks;
|
||||||
this.blacklistedBlocks = serverConfig.blacklistedBlocks;
|
this.blacklistedBlocks = serverConfig.blacklistedBlocks;
|
||||||
|
this.interactionBlocks = serverConfig.interactionBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerConfig(Double version, String lang, boolean keepActive, boolean sitWhileSeated,
|
public ServerConfig(Double version, String lang, boolean keepActive, boolean sitWhileSeated,
|
||||||
PresetBlocks presetBlocks, boolean customEnabled,
|
PresetBlocks presetBlocks, boolean customEnabled,
|
||||||
ArrayList<SittingBlock> sittingBlocks, ArrayList<CustomBlock> blacklistedBlocks) {
|
ArrayList<SittingBlock> sittingBlocks, ArrayList<CustomBlock> blacklistedBlocks,
|
||||||
|
ArrayList<CustomBlock> interactionBlocks) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.lang = lang;
|
this.lang = lang;
|
||||||
this.keepActive = keepActive;
|
this.keepActive = keepActive;
|
||||||
|
@ -62,6 +66,7 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
||||||
this.customEnabled = customEnabled;
|
this.customEnabled = customEnabled;
|
||||||
this.sittingBlocks = sittingBlocks;
|
this.sittingBlocks = sittingBlocks;
|
||||||
this.blacklistedBlocks = blacklistedBlocks;
|
this.blacklistedBlocks = blacklistedBlocks;
|
||||||
|
this.interactionBlocks = interactionBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getVersion() {
|
public Double getVersion() {
|
||||||
|
@ -96,6 +101,10 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
||||||
return blacklistedBlocks;
|
return blacklistedBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<CustomBlock> getInteractionBlocks() {
|
||||||
|
return interactionBlocks;
|
||||||
|
}
|
||||||
|
|
||||||
public static class PresetBlocks {
|
public static class PresetBlocks {
|
||||||
|
|
||||||
@SerializedName("stairs")
|
@SerializedName("stairs")
|
||||||
|
@ -135,7 +144,7 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
updateToNewFile(new ServerConfig());
|
loadFileData(new ServerConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -144,7 +153,7 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateToNewFile(ServerConfig newFile) {
|
public void loadFileData(ServerConfig newFile) {
|
||||||
this.version = newFile.version;
|
this.version = newFile.version;
|
||||||
this.lang = newFile.lang;
|
this.lang = newFile.lang;
|
||||||
this.keepActive = newFile.keepActive;
|
this.keepActive = newFile.keepActive;
|
||||||
|
@ -155,6 +164,14 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
||||||
this.blacklistedBlocks = newFile.blacklistedBlocks;
|
this.blacklistedBlocks = newFile.blacklistedBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
/// update to 2.1, just a new list, nothing to change
|
||||||
|
if (version == 2.0) {
|
||||||
|
version = 2.1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
return "server-config.json";
|
return "server-config.json";
|
||||||
|
@ -283,7 +300,7 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
||||||
Boolean.parseBoolean((String) properties.computeIfAbsent("custom", a -> String.valueOf(defaultConfig.isCustomEnabled()))),
|
Boolean.parseBoolean((String) properties.computeIfAbsent("custom", a -> String.valueOf(defaultConfig.isCustomEnabled()))),
|
||||||
getCustomBlocks(new Gson().fromJson((String)
|
getCustomBlocks(new Gson().fromJson((String)
|
||||||
properties.computeIfAbsent("custom-blocks", a -> "[]"), listType)),
|
properties.computeIfAbsent("custom-blocks", a -> "[]"), listType)),
|
||||||
new ArrayList<>()
|
new ArrayList<>(), FileData.Defaults.INTERACTION_BLOCKS
|
||||||
);
|
);
|
||||||
|
|
||||||
SittingConfig defaultSittingConfig = new SittingConfig();
|
SittingConfig defaultSittingConfig = new SittingConfig();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue