From b0b326d080984eaa2d1fb7749c978136b70ad2b2 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 18 Mar 2019 07:43:11 -0700 Subject: [PATCH] Convert Party data to HOCON serialization --- .../gmail/nossr50/config/ConfigManager.java | 7 ++++ .../hocon/party/data/ConfigPartyData.java | 13 +++++++ .../party/data/ConfigPartyDataStore.java | 38 +++++++++++++++++++ .../party/data/ConfigPartyMemberData.java | 8 ++++ 4 files changed, 66 insertions(+) create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyData.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyDataStore.java create mode 100644 src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyMemberData.java diff --git a/src/main/java/com/gmail/nossr50/config/ConfigManager.java b/src/main/java/com/gmail/nossr50/config/ConfigManager.java index c1f9b7d00..42b4e3c91 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigManager.java @@ -19,6 +19,7 @@ import com.gmail.nossr50.config.hocon.motd.ConfigMOTD; import com.gmail.nossr50.config.hocon.notifications.ConfigNotifications; import com.gmail.nossr50.config.hocon.particles.ConfigParticles; import com.gmail.nossr50.config.hocon.party.ConfigParty; +import com.gmail.nossr50.config.hocon.party.data.ConfigPartyData; import com.gmail.nossr50.config.hocon.playerleveling.ConfigLeveling; import com.gmail.nossr50.config.hocon.scoreboard.ConfigScoreboard; import com.gmail.nossr50.config.hocon.superabilities.ConfigSuperAbilities; @@ -103,6 +104,9 @@ public final class ConfigManager { private SerializedConfigLoader configSuperAbilities; private SerializedConfigLoader configAdmin; + //Data + private SerializedConfigLoader partyData; + private MainConfig mainConfig; private FishingTreasureConfig fishingTreasureConfig; private ExcavationTreasureConfig excavationTreasureConfig; @@ -161,6 +165,9 @@ public final class ConfigManager { configSuperAbilities = new SerializedConfigLoader<>(ConfigSuperAbilities.class, "skill_super_abilities.conf", null); configAdmin = new SerializedConfigLoader<>(ConfigAdmin.class, "admin.conf", null); + //Serialized Data + partyData = new SerializedConfigLoader<>(ConfigPartyData.class, "partydata.conf", null); + //Assign Maps partyItemWeights = Maps.newHashMap(configParty.getConfig().getPartyItemShare().getItemShareMap()); //Item Share Weights partyFeatureUnlocks = Maps.newHashMap(configParty.getConfig().getPartyXP().getPartyLevel().getPartyFeatureUnlockMap()); //Party Progression diff --git a/src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyData.java b/src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyData.java new file mode 100644 index 000000000..a3367dcd6 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyData.java @@ -0,0 +1,13 @@ +package com.gmail.nossr50.config.hocon.party.data; + +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +import java.util.HashMap; + +@ConfigSerializable +public class ConfigPartyData { + + @Setting(value = "Parties") + private HashMap partyName = new HashMap<>(); +} diff --git a/src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyDataStore.java b/src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyDataStore.java new file mode 100644 index 000000000..333cef934 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyDataStore.java @@ -0,0 +1,38 @@ +package com.gmail.nossr50.config.hocon.party.data; + +import com.gmail.nossr50.datatypes.party.ShareMode; +import ninja.leaping.configurate.objectmapping.Setting; +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +import java.util.ArrayList; +import java.util.UUID; + +@ConfigSerializable +public class ConfigPartyDataStore { + @Setting(value = "Party-Leader") + private UUID partyLeader; + + @Setting(value = "Party-Members") + private ArrayList partyMembers; + + @Setting(value = "Party-Name") + private String partyName; + + @Setting(value = "Party-XP-Share-Mode") + private ShareMode partyXPShareMode; + + @Setting(value = "Party-Level") + private int partyLevel; + + @Setting(value = "Party-XP") + private int partyXP; + + @Setting(value = "Party-Locked") + private boolean partyLocked; + + @Setting(value = "Party-Password") + private String partyPassword; + + @Setting(value = "Party-Item-Share-Mode") + private ShareMode partyItemShareMode; +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyMemberData.java b/src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyMemberData.java new file mode 100644 index 000000000..81fd80054 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/config/hocon/party/data/ConfigPartyMemberData.java @@ -0,0 +1,8 @@ +package com.gmail.nossr50.config.hocon.party.data; + +import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; + +@ConfigSerializable +public class ConfigPartyMemberData { + +} \ No newline at end of file