mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Wire up party config pt 5 - Actually need to redo how I'm deserializing maps, gonna do that tomorrow
This commit is contained in:
parent
80df1dd4bd
commit
f299f84a6f
@ -4,6 +4,7 @@ import com.gmail.nossr50.config.collectionconfigs.RepairConfig;
|
||||
import com.gmail.nossr50.config.collectionconfigs.SalvageConfig;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.config.hocon.CustomEnumValueSerializer;
|
||||
import com.gmail.nossr50.config.hocon.HOCONUtil;
|
||||
import com.gmail.nossr50.config.hocon.SerializedConfigLoader;
|
||||
import com.gmail.nossr50.config.hocon.admin.ConfigAdmin;
|
||||
import com.gmail.nossr50.config.hocon.antiexploit.ConfigExploitPrevention;
|
||||
@ -161,9 +162,6 @@ public final class ConfigManager {
|
||||
configSuperAbilities = new SerializedConfigLoader<>(ConfigSuperAbilities.class, "skill_super_abilities.conf", null);
|
||||
configAdmin = new SerializedConfigLoader<>(ConfigAdmin.class, "admin.conf", null);
|
||||
|
||||
mcMMO.p.getLogger().info("Value of Default from item map: " + configParty.getConfig().getPartyItemShare().getItemShareMap().get("DEFAULT"));
|
||||
mcMMO.p.getLogger().info("Value of Default keyset from item map: " + configParty.getConfig().getPartyItemShare().getItemShareMap().keySet().size());
|
||||
|
||||
//Assign Maps
|
||||
partyItemWeights = Maps.newHashMap(configParty.getConfig().getPartyItemShare().getItemShareMap()); //Item Share Weights
|
||||
partyFeatureUnlocks = Maps.newHashMap(configParty.getConfig().getPartyXP().getPartyLevel().getPartyFeatureUnlockMap()); //Party Progression
|
||||
@ -419,4 +417,12 @@ public final class ConfigManager {
|
||||
public ConfigSuperAbilities getConfigSuperAbilities() {
|
||||
return configSuperAbilities.getConfig();
|
||||
}
|
||||
|
||||
public HashMap<String, Integer> getPartyItemWeights() {
|
||||
return partyItemWeights;
|
||||
}
|
||||
|
||||
public HashMap<String, Integer> getPartyFeatureUnlocks() {
|
||||
return partyFeatureUnlocks;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ public class ConfigSectionPartyItemWeights {
|
||||
static {
|
||||
ITEM_WEIGHT_MAP_DEFAULT = new HashMap<>();
|
||||
|
||||
ITEM_WEIGHT_MAP_DEFAULT.put("Default", 5);
|
||||
ITEM_WEIGHT_MAP_DEFAULT.put(getHOCONFriendly(QUARTZ), 200);
|
||||
ITEM_WEIGHT_MAP_DEFAULT.put(getHOCONFriendly(NETHER_QUARTZ_ORE), 200);
|
||||
ITEM_WEIGHT_MAP_DEFAULT.put(getHOCONFriendly(EMERALD_ORE), 150);
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.gmail.nossr50.datatypes.party;
|
||||
|
||||
import com.gmail.nossr50.config.hocon.HOCONUtil;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -25,7 +27,7 @@ public enum ItemShareType {
|
||||
else if (ItemUtils.isWoodcuttingDrop(itemStack)) {
|
||||
return WOODCUTTING;
|
||||
}
|
||||
else if (ItemUtils.isMiscDrop(itemStack)) {
|
||||
else if (mcMMO.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(HOCONUtil.serializeENUMName(itemStack.getType().toString())) != null) {
|
||||
return MISC;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,6 @@ public class mcMMO extends JavaPlugin {
|
||||
registerCustomRecipes();
|
||||
|
||||
PartyManager.loadParties();
|
||||
PartyManager.reloadPartyFeatureHashMap();
|
||||
|
||||
formulaManager = new FormulaManager();
|
||||
holidayManager = new HolidayManager();
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gmail.nossr50.party;
|
||||
|
||||
import com.gmail.nossr50.config.MainConfig;
|
||||
import com.gmail.nossr50.config.hocon.HOCONUtil;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.party.*;
|
||||
@ -28,18 +29,9 @@ public final class PartyManager {
|
||||
private static String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
|
||||
private static List<Party> parties = new ArrayList<Party>();
|
||||
private static File partyFile = new File(partiesFilePath);
|
||||
private static HashMap<PartyFeature, Integer> partyFeatureUnlockMap;
|
||||
|
||||
private PartyManager() {}
|
||||
|
||||
/**
|
||||
* Sets the unlock feature map for parties to the currently loaded hash map representation from the User's Config File
|
||||
*/
|
||||
public static void reloadPartyFeatureHashMap()
|
||||
{
|
||||
partyFeatureUnlockMap = mcMMO.getPartyLevelSettings().getPartyFeatureUnlockMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Grab the appropriate unlock level for a party feature
|
||||
* @param partyFeature target party feature
|
||||
@ -47,7 +39,10 @@ public final class PartyManager {
|
||||
*/
|
||||
public static int getPartyFeatureUnlockLevel(PartyFeature partyFeature)
|
||||
{
|
||||
return partyFeatureUnlockMap.get(partyFeature);
|
||||
if(mcMMO.getConfigManager().getPartyFeatureUnlocks().get(HOCONUtil.serializeENUMName(partyFeature.toString())) == null)
|
||||
return 0;
|
||||
else
|
||||
return mcMMO.getConfigManager().getPartyFeatureUnlocks().get(HOCONUtil.serializeENUMName(partyFeature.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.party;
|
||||
|
||||
import com.gmail.nossr50.config.hocon.HOCONUtil;
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||
import com.gmail.nossr50.datatypes.party.ItemShareType;
|
||||
@ -146,10 +147,10 @@ public final class ShareHandler {
|
||||
}
|
||||
|
||||
public static int getItemWeight(Material material) {
|
||||
if(mcMMO.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(material) == null)
|
||||
if(mcMMO.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(HOCONUtil.serializeENUMName(material.toString())) == null)
|
||||
return 5;
|
||||
else
|
||||
return mcMMO.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(material);
|
||||
return mcMMO.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(HOCONUtil.serializeENUMName(material.toString()));
|
||||
}
|
||||
|
||||
public static XPGainReason getSharedXpGainReason(XPGainReason xpGainReason) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import com.gmail.nossr50.config.MainConfig;
|
||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||
import com.gmail.nossr50.config.hocon.HOCONUtil;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -747,7 +747,7 @@ public final class ItemUtils {
|
||||
* @return true if the item is a miscellaneous drop, false otherwise
|
||||
*/
|
||||
public static boolean isMiscDrop(ItemStack item) {
|
||||
return ItemWeightConfig.getInstance().getMiscItems().contains(item.getType());
|
||||
return mcMMO.getConfigManager().getConfigParty().getPartyItemShare().getItemShareMap().get(HOCONUtil.serializeENUMName(item.getType().toString())) != null;
|
||||
}
|
||||
|
||||
public static boolean isMcMMOItem(ItemStack item) {
|
||||
|
Loading…
Reference in New Issue
Block a user