diff --git a/src/main/java/com/gmail/nossr50/config/ConfigManager.java b/src/main/java/com/gmail/nossr50/config/ConfigManager.java index c20a7e910..94d475af0 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigManager.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigManager.java @@ -25,6 +25,7 @@ import com.gmail.nossr50.config.hocon.skills.acrobatics.ConfigAcrobatics; import com.gmail.nossr50.config.hocon.skills.alchemy.ConfigAlchemy; import com.gmail.nossr50.config.hocon.skills.archery.ConfigArchery; import com.gmail.nossr50.config.hocon.skills.axes.ConfigAxes; +import com.gmail.nossr50.config.hocon.skills.exampleconfigs.ConfigNameRegisterDefaults; import com.gmail.nossr50.config.hocon.skills.exampleconfigs.MinecraftMaterialWrapper; import com.gmail.nossr50.config.hocon.skills.excavation.ConfigExcavation; import com.gmail.nossr50.config.hocon.skills.fishing.ConfigFishing; @@ -129,6 +130,7 @@ public final class ConfigManager { private SerializedConfigLoader configWoodcutting; private SerializedConfigLoader configSmelting; private SerializedConfigLoader configSalvage; + private SerializedConfigLoader configDefaultExamples; private HashMap skillConfigLoaders; @@ -225,6 +227,7 @@ public final class ConfigManager { configMobs = new SerializedConfigLoader<>(ConfigMobs.class, "creatures.conf", "Creatures", null); configExperience = new SerializedConfigLoader<>(ConfigExperience.class, "experience.conf", "Experience", null); + configDefaultExamples = new SerializedConfigLoader<>(ConfigNameRegisterDefaults.class, "minecraft_item_block_name_examples.conf", "Minecraft", null); initSerializedSkillConfigs(); } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/MinecraftMaterialWrapperSerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/MinecraftMaterialWrapperSerializer.java index a3f771700..75e7563dd 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/MinecraftMaterialWrapperSerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/MinecraftMaterialWrapperSerializer.java @@ -9,10 +9,12 @@ import org.bukkit.Material; public class MinecraftMaterialWrapperSerializer implements TypeSerializer { + private static final String FULLY_QUALIFIED_NAME = "Fully-Qualified-Name"; + private static final String BUKKIT_MATERIAL_NAME = "Bukkit-Material-Name"; + @Override public MinecraftMaterialWrapper deserialize(TypeToken type, ConfigurationNode value) throws ObjectMappingException { - Material material = Material.matchMaterial(value.getValue(new TypeToken() {})); - + Material material = Material.matchMaterial(value.getNode(FULLY_QUALIFIED_NAME).getValue(TypeToken.of(String.class))); return new MinecraftMaterialWrapper(material); } @@ -20,7 +22,7 @@ public class MinecraftMaterialWrapperSerializer implements TypeSerializer type, MinecraftMaterialWrapper obj, ConfigurationNode value) { value.setValue(obj.getName()); //Name - value.getNode("Fully-Qualified-Name").setValue(obj.getFullyQualifiedName()); - value.getNode("Bukkit-Material-Name").setValue(obj.getBukkitMaterialName()); + value.getNode(FULLY_QUALIFIED_NAME).setValue(obj.getFullyQualifiedName()); + value.getNode(BUKKIT_MATERIAL_NAME).setValue(obj.getBukkitMaterialName()); } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/SalvageableSerializer.java b/src/main/java/com/gmail/nossr50/config/hocon/SalvageableSerializer.java index f2eb8bf0f..e0941e7f6 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/SalvageableSerializer.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/SalvageableSerializer.java @@ -44,7 +44,8 @@ public class SalvageableSerializer implements TypeSerializer { /* Repairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) */ String item = value.getNode(ITEM_NODE_NAME).getValue(TypeToken.of(String.class)); - String itemReturnedBySalvage = value.getNode(ITEM_RETURNED_BY_SALVAGE).getValue(new TypeToken() {}); +// String itemReturnedBySalvage = value.getNode(ITEM_RETURNED_BY_SALVAGE).getValue(new TypeToken() {}); + String itemReturnedBySalvage = value.getNode(ITEM_RETURNED_BY_SALVAGE).getValue(TypeToken.of(String.class)); int maximumQuantityReturned = value.getNode(MAXIMUM_QUANTITY_RETURNED).getValue(TypeToken.of(Integer.class)); int minimumLevel = value.getNode(OVERRIDE_LEVEL_REQUIREMENT).getValue(TypeToken.of(Integer.class)); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/party/ConfigParty.java b/src/main/java/com/gmail/nossr50/config/hocon/party/ConfigParty.java index 0eee76800..002a9bb8d 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/party/ConfigParty.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/party/ConfigParty.java @@ -93,32 +93,4 @@ public class ConfigParty { public boolean isPartySystemEnabled() { return partyGeneral.isEnablePartySystem(); } - /* - - - public int getPTPCommandCooldown() { - return getIntValue(COMMANDS, PTP, COOLDOWN); - } - - public int getPTPCommandWarmup() { - return getIntValue(COMMANDS, PTP, WARMUP); - } - - public int getPTPCommandRecentlyHurtCooldown() { - return getIntValue(COMMANDS, PTP, RECENTLY_HURT + COOLDOWN); - } - - public int getPTPCommandTimeout() { - return getIntValue(COMMANDS, PTP, REQUEST_TIMEOUT); - } - - public boolean getPTPCommandConfirmRequired() { - return getBooleanValue(COMMANDS, PTP, ACCEPT_REQUIRED); - } - - public boolean getPTPCommandWorldPermissions() { - return getBooleanValue(COMMANDS, PTP, WORLD_BASED_PERMISSIONS); - } - - */ } diff --git a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java index 8355bd0b7..771e60d7d 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/party/Party.java +++ b/src/main/java/com/gmail/nossr50/datatypes/party/Party.java @@ -386,7 +386,7 @@ public class Party { List nearbyPlayerList = getNearMembers(UserManager.getPlayer(player)); - boolean useDisplayNames = Config.getInstance().getPartyDisplayNames(); + boolean useDisplayNames = mcMMO.getConfigManager().getConfigParty().isPartyDisplayNamesEnabled(); if(isPartyLeaderOfflineOrHidden) { @@ -511,7 +511,7 @@ public class Party { if (party != null) { Player player = mcMMOPlayer.getPlayer(); - double range = Config.getInstance().getPartyShareRange(); + double range = mcMMO.getConfigManager().getConfigParty().getPartyXP().getPartyExperienceSharing().getPartyShareRange(); for (Player member : party.getOnlineMembers()) { if (!player.equals(member) && member.isValid() && Misc.isNear(player.getLocation(), member.getLocation(), range)) {