Convert Party data to HOCON serialization

This commit is contained in:
nossr50 2019-03-18 07:43:11 -07:00
parent 16d4c160c6
commit b0b326d080
4 changed files with 66 additions and 0 deletions

View File

@ -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.notifications.ConfigNotifications;
import com.gmail.nossr50.config.hocon.particles.ConfigParticles; import com.gmail.nossr50.config.hocon.particles.ConfigParticles;
import com.gmail.nossr50.config.hocon.party.ConfigParty; 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.playerleveling.ConfigLeveling;
import com.gmail.nossr50.config.hocon.scoreboard.ConfigScoreboard; import com.gmail.nossr50.config.hocon.scoreboard.ConfigScoreboard;
import com.gmail.nossr50.config.hocon.superabilities.ConfigSuperAbilities; import com.gmail.nossr50.config.hocon.superabilities.ConfigSuperAbilities;
@ -103,6 +104,9 @@ public final class ConfigManager {
private SerializedConfigLoader<ConfigSuperAbilities> configSuperAbilities; private SerializedConfigLoader<ConfigSuperAbilities> configSuperAbilities;
private SerializedConfigLoader<ConfigAdmin> configAdmin; private SerializedConfigLoader<ConfigAdmin> configAdmin;
//Data
private SerializedConfigLoader<ConfigPartyData> partyData;
private MainConfig mainConfig; private MainConfig mainConfig;
private FishingTreasureConfig fishingTreasureConfig; private FishingTreasureConfig fishingTreasureConfig;
private ExcavationTreasureConfig excavationTreasureConfig; private ExcavationTreasureConfig excavationTreasureConfig;
@ -161,6 +165,9 @@ public final class ConfigManager {
configSuperAbilities = new SerializedConfigLoader<>(ConfigSuperAbilities.class, "skill_super_abilities.conf", null); configSuperAbilities = new SerializedConfigLoader<>(ConfigSuperAbilities.class, "skill_super_abilities.conf", null);
configAdmin = new SerializedConfigLoader<>(ConfigAdmin.class, "admin.conf", null); configAdmin = new SerializedConfigLoader<>(ConfigAdmin.class, "admin.conf", null);
//Serialized Data
partyData = new SerializedConfigLoader<>(ConfigPartyData.class, "partydata.conf", null);
//Assign Maps //Assign Maps
partyItemWeights = Maps.newHashMap(configParty.getConfig().getPartyItemShare().getItemShareMap()); //Item Share Weights partyItemWeights = Maps.newHashMap(configParty.getConfig().getPartyItemShare().getItemShareMap()); //Item Share Weights
partyFeatureUnlocks = Maps.newHashMap(configParty.getConfig().getPartyXP().getPartyLevel().getPartyFeatureUnlockMap()); //Party Progression partyFeatureUnlocks = Maps.newHashMap(configParty.getConfig().getPartyXP().getPartyLevel().getPartyFeatureUnlockMap()); //Party Progression

View File

@ -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<String, ConfigPartyDataStore> partyName = new HashMap<>();
}

View File

@ -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<UUID> 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;
}

View File

@ -0,0 +1,8 @@
package com.gmail.nossr50.config.hocon.party.data;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigPartyMemberData {
}