mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
comment out contents of mod configs until we need them again
This commit is contained in:
parent
e7d8e51722
commit
3fc0bbb466
@ -3,17 +3,12 @@ package com.gmail.nossr50.config;
|
|||||||
import com.gmail.nossr50.config.collectionconfigs.CollectionClassType;
|
import com.gmail.nossr50.config.collectionconfigs.CollectionClassType;
|
||||||
import com.gmail.nossr50.config.collectionconfigs.MultiConfigContainer;
|
import com.gmail.nossr50.config.collectionconfigs.MultiConfigContainer;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.mods.ArmorConfigManager;
|
|
||||||
import com.gmail.nossr50.config.mods.BlockConfigManager;
|
|
||||||
import com.gmail.nossr50.config.mods.EntityConfigManager;
|
|
||||||
import com.gmail.nossr50.config.mods.ToolConfigManager;
|
|
||||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
|
import com.gmail.nossr50.skills.repair.repairables.SimpleRepairableManager;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager;
|
import com.gmail.nossr50.skills.salvage.salvageables.SimpleSalvageableManager;
|
||||||
import com.gmail.nossr50.util.ModManager;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -50,7 +45,7 @@ public final class ConfigManager {
|
|||||||
|
|
||||||
//TODO: Add these back when modded servers become a thing again
|
//TODO: Add these back when modded servers become a thing again
|
||||||
|
|
||||||
private ModManager modManager;
|
//private ModManager modManager;
|
||||||
|
|
||||||
/*private ToolConfigManager toolConfigManager;
|
/*private ToolConfigManager toolConfigManager;
|
||||||
private ArmorConfigManager armorConfigManager;
|
private ArmorConfigManager armorConfigManager;
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
package com.gmail.nossr50.config.mods;
|
//package com.gmail.nossr50.config.mods;
|
||||||
|
//
|
||||||
public class ArmorConfigManager {
|
//public class ArmorConfigManager {
|
||||||
//TODO: Commented out until modded servers appear again
|
// //TODO: Commented out until modded servers appear again
|
||||||
/*public ArmorConfigManager() {
|
// /*public ArmorConfigManager() {
|
||||||
Pattern middlePattern = Pattern.compile("armor\\.(?:.+)\\.yml");
|
// Pattern middlePattern = Pattern.compile("armor\\.(?:.+)\\.yml");
|
||||||
Pattern startPattern = Pattern.compile("(?:.+)\\.armor\\.yml");
|
// Pattern startPattern = Pattern.compile("(?:.+)\\.armor\\.yml");
|
||||||
//File dataFolder = new File(McmmoCore.getModDataFolderPath());
|
// //File dataFolder = new File(McmmoCore.getModDataFolderPath());
|
||||||
File dataFolder = new File(mcMMO.p.getModDirectory());
|
// File dataFolder = new File(mcMMO.p.getModDirectory());
|
||||||
File vanilla = new File(dataFolder, "armor.default.yml");
|
// File vanilla = new File(dataFolder, "armor.default.yml");
|
||||||
ModManager modManager = mcMMO.getModManager();
|
// ModManager modManager = mcMMO.getModManager();
|
||||||
|
//
|
||||||
if (!vanilla.exists()) {
|
// if (!vanilla.exists()) {
|
||||||
mcMMO.p.saveResource(vanilla.getParentFile().getName() + File.separator + "armor.default.yml", false);
|
// mcMMO.p.saveResource(vanilla.getParentFile().getName() + File.separator + "armor.default.yml", false);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
for (String fileName : dataFolder.list()) {
|
// for (String fileName : dataFolder.list()) {
|
||||||
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
|
// if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
File file = new File(dataFolder, fileName);
|
// File file = new File(dataFolder, fileName);
|
||||||
|
//
|
||||||
if (file.isDirectory()) {
|
// if (file.isDirectory()) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
modManager.registerCustomArmor(new CustomArmorConfig(fileName));
|
// modManager.registerCustomArmor(new CustomArmorConfig(fileName));
|
||||||
}
|
// }
|
||||||
}*/
|
// }*/
|
||||||
}
|
//}
|
||||||
|
@ -1,31 +1,31 @@
|
|||||||
package com.gmail.nossr50.config.mods;
|
//package com.gmail.nossr50.config.mods;
|
||||||
|
//
|
||||||
public class BlockConfigManager {
|
//public class BlockConfigManager {
|
||||||
//TODO: Commented out until modded servers appear again
|
// //TODO: Commented out until modded servers appear again
|
||||||
/*public BlockConfigManager() {
|
// /*public BlockConfigManager() {
|
||||||
Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
|
// Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
|
||||||
Pattern startPattern = Pattern.compile("(?:.+)\\.blocks\\.yml");
|
// Pattern startPattern = Pattern.compile("(?:.+)\\.blocks\\.yml");
|
||||||
//File dataFolder = new File(McmmoCore.getModDataFolderPath());
|
// //File dataFolder = new File(McmmoCore.getModDataFolderPath());
|
||||||
File dataFolder = new File(mcMMO.getModDirectory());
|
// File dataFolder = new File(mcMMO.getModDirectory());
|
||||||
File vanilla = new File(dataFolder, "blocks.default.yml");
|
// File vanilla = new File(dataFolder, "blocks.default.yml");
|
||||||
ModManager modManager = mcMMO.getModManager();
|
// ModManager modManager = mcMMO.getModManager();
|
||||||
|
//
|
||||||
if (!vanilla.exists()) {
|
// if (!vanilla.exists()) {
|
||||||
mcMMO.p.saveResource(vanilla.getParentFile().getName() + File.separator + "blocks.default.yml", false);
|
// mcMMO.p.saveResource(vanilla.getParentFile().getName() + File.separator + "blocks.default.yml", false);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
for (String fileName : dataFolder.list()) {
|
// for (String fileName : dataFolder.list()) {
|
||||||
if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
|
// if (!middlePattern.matcher(fileName).matches() && !startPattern.matcher(fileName).matches()) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
File file = new File(dataFolder, fileName);
|
// File file = new File(dataFolder, fileName);
|
||||||
|
//
|
||||||
if (file.isDirectory()) {
|
// if (file.isDirectory()) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
modManager.registerCustomBlocks(new CustomBlockConfig(fileName));
|
// modManager.registerCustomBlocks(new CustomBlockConfig(fileName));
|
||||||
}
|
// }
|
||||||
}*/
|
// }*/
|
||||||
}
|
//}
|
||||||
|
@ -1,111 +1,111 @@
|
|||||||
package com.gmail.nossr50.config.mods;
|
//package com.gmail.nossr50.config.mods;
|
||||||
|
//
|
||||||
import com.gmail.nossr50.config.ConfigCollection;
|
//import com.gmail.nossr50.config.ConfigCollection;
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
//import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
//import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
//import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
//import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
//import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
import org.bukkit.Material;
|
//import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
//import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
//import org.bukkit.inventory.ItemStack;
|
||||||
|
//
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Set;
|
//import java.util.Set;
|
||||||
|
//
|
||||||
public class CustomArmorConfig extends ConfigCollection {
|
//public class CustomArmorConfig extends ConfigCollection {
|
||||||
public List<Material> customBoots = new ArrayList<Material>();
|
// public List<Material> customBoots = new ArrayList<Material>();
|
||||||
public List<Material> customChestplates = new ArrayList<Material>();
|
// public List<Material> customChestplates = new ArrayList<Material>();
|
||||||
public List<Material> customHelmets = new ArrayList<Material>();
|
// public List<Material> customHelmets = new ArrayList<Material>();
|
||||||
public List<Material> customLeggings = new ArrayList<Material>();
|
// public List<Material> customLeggings = new ArrayList<Material>();
|
||||||
public List<Repairable> repairables = new ArrayList<Repairable>();
|
// public List<Repairable> repairables = new ArrayList<Repairable>();
|
||||||
private boolean needsUpdate = false;
|
// private boolean needsUpdate = false;
|
||||||
|
//
|
||||||
protected CustomArmorConfig(String fileName) {
|
// protected CustomArmorConfig(String fileName) {
|
||||||
//super(McmmoCore.getDataFolderPath().getPath() + "mods", fileName, false);
|
// //super(McmmoCore.getDataFolderPath().getPath() + "mods", fileName, false);
|
||||||
super(mcMMO.p.getDataFolder().getPath() + "mods", fileName, false); register();
|
// super(mcMMO.p.getDataFolder().getPath() + "mods", fileName, false); register();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* The version of this config
|
// * The version of this config
|
||||||
*
|
// *
|
||||||
* @return
|
// * @return
|
||||||
*/
|
// */
|
||||||
@Override
|
// @Override
|
||||||
public double getConfigVersion() {
|
// public double getConfigVersion() {
|
||||||
return 1;
|
// return 1;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void register() {
|
// public void register() {
|
||||||
loadArmor("Boots", customBoots);
|
// loadArmor("Boots", customBoots);
|
||||||
loadArmor("Chestplates", customChestplates);
|
// loadArmor("Chestplates", customChestplates);
|
||||||
loadArmor("Helmets", customHelmets);
|
// loadArmor("Helmets", customHelmets);
|
||||||
loadArmor("Leggings", customLeggings);
|
// loadArmor("Leggings", customLeggings);
|
||||||
|
//
|
||||||
if (needsUpdate) {
|
// if (needsUpdate) {
|
||||||
needsUpdate = false;
|
// needsUpdate = false;
|
||||||
backup();
|
// backup();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void loadArmor(String armorType, List<Material> materialList) {
|
// private void loadArmor(String armorType, List<Material> materialList) {
|
||||||
if (needsUpdate) {
|
// if (needsUpdate) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
ConfigurationSection armorSection = config.getConfigurationSection(armorType);
|
// ConfigurationSection armorSection = config.getConfigurationSection(armorType);
|
||||||
|
//
|
||||||
if (armorSection == null) {
|
// if (armorSection == null) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Set<String> armorConfigSet = armorSection.getKeys(false);
|
// Set<String> armorConfigSet = armorSection.getKeys(false);
|
||||||
|
//
|
||||||
for (String armorName : armorConfigSet) {
|
// for (String armorName : armorConfigSet) {
|
||||||
if (config.contains(armorType + "." + armorName + "." + ".ID")) {
|
// if (config.contains(armorType + "." + armorName + "." + ".ID")) {
|
||||||
needsUpdate = true;
|
// needsUpdate = true;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Material armorMaterial = Material.matchMaterial(armorName);
|
// Material armorMaterial = Material.matchMaterial(armorName);
|
||||||
|
//
|
||||||
if (armorMaterial == null) {
|
// if (armorMaterial == null) {
|
||||||
plugin.getLogger().warning("Invalid material name. This item will be skipped. - " + armorName);
|
// plugin.getLogger().warning("Invalid material name. This item will be skipped. - " + armorName);
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
boolean repairable = getBooleanValue(armorType + "." + armorName + ".Repairable");
|
// boolean repairable = getBooleanValue(armorType + "." + armorName + ".Repairable");
|
||||||
Material repairMaterial = Material.matchMaterial(getStringValue(armorType + "." + armorName + ".Repair_Material", ""));
|
// Material repairMaterial = Material.matchMaterial(getStringValue(armorType + "." + armorName + ".Repair_Material", ""));
|
||||||
|
//
|
||||||
if (repairable && (repairMaterial == null)) {
|
// if (repairable && (repairMaterial == null)) {
|
||||||
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + armorName);
|
// plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + armorName);
|
||||||
repairable = false;
|
// repairable = false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (repairable) {
|
// if (repairable) {
|
||||||
byte repairData = (byte) getIntValue(armorType + "." + armorName + ".Repair_Material_Data_Value", -1);
|
// byte repairData = (byte) getIntValue(armorType + "." + armorName + ".Repair_Material_Data_Value", -1);
|
||||||
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
// int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
||||||
|
//
|
||||||
if (repairQuantity == 0) {
|
// if (repairQuantity == 0) {
|
||||||
repairQuantity = getIntValue(armorType + "." + armorName + ".Repair_Material_Quantity", 2);
|
// repairQuantity = getIntValue(armorType + "." + armorName + ".Repair_Material_Quantity", 2);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String repairItemName = getStringValue(armorType + "." + armorName + ".Repair_Material_Pretty_Name");
|
// String repairItemName = getStringValue(armorType + "." + armorName + ".Repair_Material_Pretty_Name");
|
||||||
int repairMinimumLevel = getIntValue(armorType + "." + armorName + ".Repair_MinimumLevel", 0);
|
// int repairMinimumLevel = getIntValue(armorType + "." + armorName + ".Repair_MinimumLevel", 0);
|
||||||
double repairXpMultiplier = getDoubleValue(armorType + "." + armorName + ".Repair_XpMultiplier", 1);
|
// double repairXpMultiplier = getDoubleValue(armorType + "." + armorName + ".Repair_XpMultiplier", 1);
|
||||||
|
//
|
||||||
short durability = armorMaterial.getMaxDurability();
|
// short durability = armorMaterial.getMaxDurability();
|
||||||
|
//
|
||||||
if (durability == 0) {
|
// if (durability == 0) {
|
||||||
durability = (short) getIntValue(armorType + "." + armorName + ".Durability", 70);
|
// durability = (short) getIntValue(armorType + "." + armorName + ".Durability", 70);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ConfigItemCategory.ARMOR, MaterialType.OTHER, repairXpMultiplier));
|
// repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ConfigItemCategory.ARMOR, MaterialType.OTHER, repairXpMultiplier));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
materialList.add(armorMaterial);
|
// materialList.add(armorMaterial);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -1,99 +1,99 @@
|
|||||||
package com.gmail.nossr50.config.mods;
|
//package com.gmail.nossr50.config.mods;
|
||||||
|
//
|
||||||
import com.gmail.nossr50.config.ConfigCollection;
|
//import com.gmail.nossr50.config.ConfigCollection;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
//import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||||
import com.gmail.nossr50.mcMMO;
|
//import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.Material;
|
//import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
//import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
//
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
//import java.util.HashMap;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
import java.util.Set;
|
//import java.util.Set;
|
||||||
|
//
|
||||||
public class CustomBlockConfig extends ConfigCollection {
|
//public class CustomBlockConfig extends ConfigCollection {
|
||||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
// public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
// public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
// public List<Material> customMiningBlocks = new ArrayList<>();
|
||||||
public List<Material> customOres = new ArrayList<>();
|
// public List<Material> customOres = new ArrayList<>();
|
||||||
public List<Material> customLogs = new ArrayList<>();
|
// public List<Material> customLogs = new ArrayList<>();
|
||||||
public List<Material> customLeaves = new ArrayList<>();
|
// public List<Material> customLeaves = new ArrayList<>();
|
||||||
public List<Material> customAbilityBlocks = new ArrayList<>();
|
// public List<Material> customAbilityBlocks = new ArrayList<>();
|
||||||
public HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
// public HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
||||||
private boolean needsUpdate = false;
|
// private boolean needsUpdate = false;
|
||||||
|
//
|
||||||
protected CustomBlockConfig(String fileName) {
|
// protected CustomBlockConfig(String fileName) {
|
||||||
//super(McmmoCore.getDataFolderPath().getPath() + "mods", fileName, false);
|
// //super(McmmoCore.getDataFolderPath().getPath() + "mods", fileName, false);
|
||||||
super(mcMMO.p.getDataFolder().getPath() + "mods", fileName, false);
|
// super(mcMMO.p.getDataFolder().getPath() + "mods", fileName, false);
|
||||||
register();
|
// register();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
protected void register() {
|
// protected void register() {
|
||||||
loadBlocks("Excavation", customExcavationBlocks);
|
// loadBlocks("Excavation", customExcavationBlocks);
|
||||||
loadBlocks("Herbalism", customHerbalismBlocks);
|
// loadBlocks("Herbalism", customHerbalismBlocks);
|
||||||
loadBlocks("Mining", customMiningBlocks);
|
// loadBlocks("Mining", customMiningBlocks);
|
||||||
loadBlocks("Woodcutting", null);
|
// loadBlocks("Woodcutting", null);
|
||||||
loadBlocks("Ability_Blocks", customAbilityBlocks);
|
// loadBlocks("Ability_Blocks", customAbilityBlocks);
|
||||||
|
//
|
||||||
if (needsUpdate) {
|
// if (needsUpdate) {
|
||||||
needsUpdate = false;
|
// needsUpdate = false;
|
||||||
backup();
|
// backup();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void loadBlocks(String skillType, List<Material> blockList) {
|
// private void loadBlocks(String skillType, List<Material> blockList) {
|
||||||
if (needsUpdate) {
|
// if (needsUpdate) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
ConfigurationSection skillSection = config.getConfigurationSection(skillType);
|
// ConfigurationSection skillSection = config.getConfigurationSection(skillType);
|
||||||
|
//
|
||||||
if (skillSection == null) {
|
// if (skillSection == null) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Set<String> skillConfigSet = skillSection.getKeys(false);
|
// Set<String> skillConfigSet = skillSection.getKeys(false);
|
||||||
|
//
|
||||||
for (String blockName : skillConfigSet) {
|
// for (String blockName : skillConfigSet) {
|
||||||
if (config.contains(skillType + "." + blockName + ".Drop_Item")) {
|
// if (config.contains(skillType + "." + blockName + ".Drop_Item")) {
|
||||||
needsUpdate = true;
|
// needsUpdate = true;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String[] blockInfo = blockName.split("[|]");
|
// String[] blockInfo = blockName.split("[|]");
|
||||||
|
//
|
||||||
Material blockMaterial = Material.matchMaterial(blockInfo[0]);
|
// Material blockMaterial = Material.matchMaterial(blockInfo[0]);
|
||||||
|
//
|
||||||
if (blockMaterial == null) {
|
// if (blockMaterial == null) {
|
||||||
plugin.getLogger().warning("Invalid material name. This item will be skipped. - " + blockInfo[0]);
|
// plugin.getLogger().warning("Invalid material name. This item will be skipped. - " + blockInfo[0]);
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (blockList != null) {
|
// if (blockList != null) {
|
||||||
blockList.add(blockMaterial);
|
// blockList.add(blockMaterial);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (skillType.equals("Ability_Blocks")) {
|
// if (skillType.equals("Ability_Blocks")) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
int xp = getIntValue(skillType + "." + blockName + ".XP_Gain");
|
// int xp = getIntValue(skillType + "." + blockName + ".XP_Gain");
|
||||||
int smeltingXp = 0;
|
// int smeltingXp = 0;
|
||||||
|
//
|
||||||
if (skillType.equals("Mining") && getBooleanValue(skillType + "." + blockName + ".Is_Ore")) {
|
// if (skillType.equals("Mining") && getBooleanValue(skillType + "." + blockName + ".Is_Ore")) {
|
||||||
customOres.add(blockMaterial);
|
// customOres.add(blockMaterial);
|
||||||
smeltingXp = getIntValue(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
// smeltingXp = getIntValue(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
||||||
} else if (skillType.equals("Woodcutting")) {
|
// } else if (skillType.equals("Woodcutting")) {
|
||||||
if (getBooleanValue(skillType + "." + blockName + ".Is_Log")) {
|
// if (getBooleanValue(skillType + "." + blockName + ".Is_Log")) {
|
||||||
customLogs.add(blockMaterial);
|
// customLogs.add(blockMaterial);
|
||||||
} else {
|
// } else {
|
||||||
customLeaves.add(blockMaterial);
|
// customLeaves.add(blockMaterial);
|
||||||
xp = 0; // Leaves don't grant XP
|
// xp = 0; // Leaves don't grant XP
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
customBlockMap.put(blockMaterial, new CustomBlock(xp, getBooleanValue(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
// customBlockMap.put(blockMaterial, new CustomBlock(xp, getBooleanValue(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -1,61 +1,63 @@
|
|||||||
package com.gmail.nossr50.config.mods;
|
//
|
||||||
|
//package com.gmail.nossr50.config.mods;
|
||||||
import com.gmail.nossr50.config.Config;
|
//
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
//import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.mcMMO;
|
//import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
||||||
import org.apache.commons.lang.ClassUtils;
|
//import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.Material;
|
//import org.apache.commons.lang.ClassUtils;
|
||||||
import org.bukkit.inventory.ItemStack;
|
//import org.bukkit.Material;
|
||||||
|
//import org.bukkit.inventory.ItemStack;
|
||||||
import java.util.HashMap;
|
//
|
||||||
|
//import java.util.HashMap;
|
||||||
public class CustomEntityConfig extends Config {
|
//
|
||||||
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
|
//public class CustomEntityConfig extends Config {
|
||||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
|
// public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
|
||||||
|
// public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
|
||||||
protected CustomEntityConfig(String fileName) {
|
//
|
||||||
//super(McmmoCore.getDataFolderPath().getPath() + "mods", fileName, false);
|
// protected CustomEntityConfig(String fileName) {
|
||||||
super(mcMMO.p.getDataFolder().getPath() + "mods", fileName, false);
|
// //super(McmmoCore.getDataFolderPath().getPath() + "mods", fileName, false);
|
||||||
}
|
// super(mcMMO.p.getDataFolder().getPath() + "mods", fileName, false);
|
||||||
|
// }
|
||||||
@Override
|
//
|
||||||
protected void loadKeys() {
|
// @Override
|
||||||
if (config.getConfigurationSection("Hostile") != null) {
|
// protected void loadKeys() {
|
||||||
backup();
|
// if (config.getConfigurationSection("Hostile") != null) {
|
||||||
return;
|
// backup();
|
||||||
}
|
// return;
|
||||||
|
// }
|
||||||
for (String entityName : config.getKeys(false)) {
|
//
|
||||||
Class<?> clazz = null;
|
// for (String entityName : config.getKeys(false)) {
|
||||||
String className = getStringValue(entityName + ".Class", "");
|
// Class<?> clazz = null;
|
||||||
|
// String className = getStringValue(entityName + ".Class", "");
|
||||||
try {
|
//
|
||||||
clazz = ClassUtils.getClass(className);
|
// try {
|
||||||
} catch (ClassNotFoundException e) {
|
// clazz = ClassUtils.getClass(className);
|
||||||
plugin.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + ".");
|
// } catch (ClassNotFoundException e) {
|
||||||
plugin.getLogger().warning("This custom entity may not function properly.");
|
// plugin.getLogger().warning("Invalid class (" + className + ") detected for " + entityName + ".");
|
||||||
}
|
// plugin.getLogger().warning("This custom entity may not function properly.");
|
||||||
|
// }
|
||||||
String entityTypeName = entityName.replace("_", ".");
|
//
|
||||||
double xpMultiplier = getDoubleValue(entityName + ".XP_Multiplier", 1.0D);
|
// String entityTypeName = entityName.replace("_", ".");
|
||||||
|
// double xpMultiplier = getDoubleValue(entityName + ".XP_Multiplier", 1.0D);
|
||||||
boolean canBeTamed = getBooleanValue(entityName + ".Tameable");
|
//
|
||||||
int tamingXp = getIntValue(entityName + ".Taming_XP");
|
// boolean canBeTamed = getBooleanValue(entityName + ".Tameable");
|
||||||
|
// int tamingXp = getIntValue(entityName + ".Taming_XP");
|
||||||
boolean canBeSummoned = getBooleanValue(entityName + ".CanBeSummoned");
|
//
|
||||||
Material callOfTheWildMaterial = Material.matchMaterial(getStringValue(entityName + ".COTW_Material", ""));
|
// boolean canBeSummoned = getBooleanValue(entityName + ".CanBeSummoned");
|
||||||
byte callOfTheWildData = (byte) getIntValue(entityName + ".COTW_Material_Data");
|
// Material callOfTheWildMaterial = Material.matchMaterial(getStringValue(entityName + ".COTW_Material", ""));
|
||||||
int callOfTheWildAmount = getIntValue(entityName + ".COTW_Material_Amount");
|
// byte callOfTheWildData = (byte) getIntValue(entityName + ".COTW_Material_Data");
|
||||||
|
// int callOfTheWildAmount = getIntValue(entityName + ".COTW_Material_Amount");
|
||||||
if (canBeSummoned && (callOfTheWildMaterial == null || callOfTheWildAmount == 0)) {
|
//
|
||||||
plugin.getLogger().warning("Incomplete Call of the Wild information. This entity will not be able to be summoned by Call of the Wild.");
|
// if (canBeSummoned && (callOfTheWildMaterial == null || callOfTheWildAmount == 0)) {
|
||||||
canBeSummoned = false;
|
// plugin.getLogger().warning("Incomplete Call of the Wild information. This entity will not be able to be summoned by Call of the Wild.");
|
||||||
}
|
// canBeSummoned = false;
|
||||||
|
// }
|
||||||
CustomEntity entity = new CustomEntity(xpMultiplier, canBeTamed, tamingXp, canBeSummoned, (canBeSummoned ? new ItemStack(callOfTheWildMaterial) : null), callOfTheWildAmount);
|
//
|
||||||
|
// CustomEntity entity = new CustomEntity(xpMultiplier, canBeTamed, tamingXp, canBeSummoned, (canBeSummoned ? new ItemStack(callOfTheWildMaterial) : null), callOfTheWildAmount);
|
||||||
customEntityTypeMap.put(entityTypeName, entity);
|
//
|
||||||
customEntityClassMap.put(clazz == null ? null : clazz.getName(), entity);
|
// customEntityTypeMap.put(entityTypeName, entity);
|
||||||
}
|
// customEntityClassMap.put(clazz == null ? null : clazz.getName(), entity);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//}
|
||||||
|
//*/
|
||||||
|
@ -16,10 +16,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
/*
|
||||||
public class CustomToolConfig extends Config {
|
public class CustomToolConfig extends Config {
|
||||||
//TODO: Disabled until modded servers come back
|
//TODO: Disabled until modded servers come back
|
||||||
/*public List<Material> customAxes = new ArrayList<Material>();
|
public List<Material> customAxes = new ArrayList<Material>();
|
||||||
public List<Material> customBows = new ArrayList<Material>();
|
public List<Material> customBows = new ArrayList<Material>();
|
||||||
public List<Material> customHoes = new ArrayList<Material>();
|
public List<Material> customHoes = new ArrayList<Material>();
|
||||||
public List<Material> customPickaxes = new ArrayList<Material>();
|
public List<Material> customPickaxes = new ArrayList<Material>();
|
||||||
@ -114,5 +114,5 @@ public class CustomToolConfig extends Config {
|
|||||||
materialList.add(toolMaterial);
|
materialList.add(toolMaterial);
|
||||||
customToolMap.put(toolMaterial, tool);
|
customToolMap.put(toolMaterial, tool);
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
/*
|
||||||
package com.gmail.nossr50.config.mods;
|
package com.gmail.nossr50.config.mods;
|
||||||
|
|
||||||
|
|
||||||
public class EntityConfigManager {
|
public class EntityConfigManager {
|
||||||
//TODO: Commented out until modded servers appear again
|
//TODO: Commented out until modded servers appear again
|
||||||
|
*/
|
||||||
/*public EntityConfigManager(mcMMO plugin) {
|
/*public EntityConfigManager(mcMMO plugin) {
|
||||||
Pattern middlePattern = Pattern.compile("entities\\.(?:.+)\\.yml");
|
Pattern middlePattern = Pattern.compile("entities\\.(?:.+)\\.yml");
|
||||||
Pattern startPattern = Pattern.compile("(?:.+)\\.entities\\.yml");
|
Pattern startPattern = Pattern.compile("(?:.+)\\.entities\\.yml");
|
||||||
@ -27,5 +29,7 @@ public class EntityConfigManager {
|
|||||||
|
|
||||||
modManager.registerCustomEntities(new CustomEntityConfig(fileName));
|
modManager.registerCustomEntities(new CustomEntityConfig(fileName));
|
||||||
}
|
}
|
||||||
}*/
|
}*//*
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
/*
|
||||||
package com.gmail.nossr50.config.mods;
|
package com.gmail.nossr50.config.mods;
|
||||||
|
|
||||||
|
|
||||||
public class ToolConfigManager {
|
public class ToolConfigManager {
|
||||||
//TODO: Commented out until modded servers appear again
|
//TODO: Commented out until modded servers appear again
|
||||||
|
*/
|
||||||
/*public ToolConfigManager(mcMMO plugin) {
|
/*public ToolConfigManager(mcMMO plugin) {
|
||||||
Pattern middlePattern = Pattern.compile("tools\\.(?:.+)\\.yml");
|
Pattern middlePattern = Pattern.compile("tools\\.(?:.+)\\.yml");
|
||||||
Pattern startPattern = Pattern.compile("(?:.+)\\.tools\\.yml");
|
Pattern startPattern = Pattern.compile("(?:.+)\\.tools\\.yml");
|
||||||
@ -27,5 +29,7 @@ public class ToolConfigManager {
|
|||||||
|
|
||||||
modManager.registerCustomTools(new CustomToolConfig(fileName));
|
modManager.registerCustomTools(new CustomToolConfig(fileName));
|
||||||
}
|
}
|
||||||
}*/
|
}*//*
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@ -1,282 +1,282 @@
|
|||||||
package com.gmail.nossr50.util;
|
//package com.gmail.nossr50.util;
|
||||||
|
//
|
||||||
import com.gmail.nossr50.config.MainConfig;
|
//import com.gmail.nossr50.config.MainConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
//import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomBlockConfig;
|
//import com.gmail.nossr50.config.mods.CustomBlockConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomEntityConfig;
|
//import com.gmail.nossr50.config.mods.CustomEntityConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomToolConfig;
|
//import com.gmail.nossr50.config.mods.CustomToolConfig;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
//import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
//import com.gmail.nossr50.datatypes.mods.CustomEntity;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
//import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||||
import com.gmail.nossr50.mcMMO;
|
//import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
//import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||||
import org.bukkit.Material;
|
//import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockState;
|
//import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
//import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Entity;
|
//import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
//import org.bukkit.inventory.ItemStack;
|
||||||
|
//
|
||||||
import java.io.File;
|
//import java.io.File;
|
||||||
import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
//import java.util.HashMap;
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
public class ModManager {
|
//public class ModManager {
|
||||||
/*private List<Repairable> repairables = new ArrayList<Repairable>();
|
// /*private List<Repairable> repairables = new ArrayList<Repairable>();
|
||||||
|
//
|
||||||
// Armor Mods
|
// // Armor Mods
|
||||||
private List<Material> customBoots = new ArrayList<Material>();
|
// private List<Material> customBoots = new ArrayList<Material>();
|
||||||
private List<Material> customChestplates = new ArrayList<Material>();
|
// private List<Material> customChestplates = new ArrayList<Material>();
|
||||||
private List<Material> customHelmets = new ArrayList<Material>();
|
// private List<Material> customHelmets = new ArrayList<Material>();
|
||||||
private List<Material> customLeggings = new ArrayList<Material>();
|
// private List<Material> customLeggings = new ArrayList<Material>();
|
||||||
|
//
|
||||||
// Block Mods
|
// // Block Mods
|
||||||
private List<Material> customExcavationBlocks = new ArrayList<Material>();
|
// private List<Material> customExcavationBlocks = new ArrayList<Material>();
|
||||||
private List<Material> customHerbalismBlocks = new ArrayList<Material>();
|
// private List<Material> customHerbalismBlocks = new ArrayList<Material>();
|
||||||
private List<Material> customMiningBlocks = new ArrayList<Material>();
|
// private List<Material> customMiningBlocks = new ArrayList<Material>();
|
||||||
private List<Material> customOres = new ArrayList<Material>();
|
// private List<Material> customOres = new ArrayList<Material>();
|
||||||
private List<Material> customLogs = new ArrayList<Material>();
|
// private List<Material> customLogs = new ArrayList<Material>();
|
||||||
private List<Material> customLeaves = new ArrayList<Material>();
|
// private List<Material> customLeaves = new ArrayList<Material>();
|
||||||
private List<Material> customAbilityBlocks = new ArrayList<Material>();
|
// private List<Material> customAbilityBlocks = new ArrayList<Material>();
|
||||||
private HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
// private HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
||||||
|
//
|
||||||
// Entity Mods
|
// // Entity Mods
|
||||||
private HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
|
// private HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
|
||||||
private HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
|
// private HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
|
||||||
|
//
|
||||||
// Tool Mods
|
// // Tool Mods
|
||||||
private List<Material> customAxes = new ArrayList<Material>();
|
// private List<Material> customAxes = new ArrayList<Material>();
|
||||||
private List<Material> customBows = new ArrayList<Material>();
|
// private List<Material> customBows = new ArrayList<Material>();
|
||||||
private List<Material> customHoes = new ArrayList<Material>();
|
// private List<Material> customHoes = new ArrayList<Material>();
|
||||||
private List<Material> customPickaxes = new ArrayList<Material>();
|
// private List<Material> customPickaxes = new ArrayList<Material>();
|
||||||
private List<Material> customShovels = new ArrayList<Material>();
|
// private List<Material> customShovels = new ArrayList<Material>();
|
||||||
private List<Material> customSwords = new ArrayList<Material>();
|
// private List<Material> customSwords = new ArrayList<Material>();
|
||||||
private HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
|
// private HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
|
||||||
|
//
|
||||||
public void registerCustomArmor(CustomArmorConfig config) {
|
// public void registerCustomArmor(CustomArmorConfig config) {
|
||||||
customBoots.addAll(config.customBoots);
|
// customBoots.addAll(config.customBoots);
|
||||||
customChestplates.addAll(config.customChestplates);
|
// customChestplates.addAll(config.customChestplates);
|
||||||
customHelmets.addAll(config.customHelmets);
|
// customHelmets.addAll(config.customHelmets);
|
||||||
customLeggings.addAll(config.customLeggings);
|
// customLeggings.addAll(config.customLeggings);
|
||||||
repairables.addAll(config.repairables);
|
// repairables.addAll(config.repairables);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void registerCustomBlocks(CustomBlockConfig config) {
|
// public void registerCustomBlocks(CustomBlockConfig config) {
|
||||||
customExcavationBlocks.addAll(config.customExcavationBlocks);
|
// customExcavationBlocks.addAll(config.customExcavationBlocks);
|
||||||
customHerbalismBlocks.addAll(config.customHerbalismBlocks);
|
// customHerbalismBlocks.addAll(config.customHerbalismBlocks);
|
||||||
customMiningBlocks.addAll(config.customMiningBlocks);
|
// customMiningBlocks.addAll(config.customMiningBlocks);
|
||||||
customOres.addAll(config.customOres);
|
// customOres.addAll(config.customOres);
|
||||||
customLogs.addAll(config.customLogs);
|
// customLogs.addAll(config.customLogs);
|
||||||
customLeaves.addAll(config.customLeaves);
|
// customLeaves.addAll(config.customLeaves);
|
||||||
customAbilityBlocks.addAll(config.customAbilityBlocks);
|
// customAbilityBlocks.addAll(config.customAbilityBlocks);
|
||||||
customBlockMap.putAll(config.customBlockMap);
|
// customBlockMap.putAll(config.customBlockMap);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void registerCustomEntities(CustomEntityConfig config) {
|
// public void registerCustomEntities(CustomEntityConfig config) {
|
||||||
customEntityClassMap.putAll(config.customEntityClassMap);
|
// customEntityClassMap.putAll(config.customEntityClassMap);
|
||||||
customEntityTypeMap.putAll(config.customEntityTypeMap);
|
// customEntityTypeMap.putAll(config.customEntityTypeMap);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void registerCustomTools(CustomToolConfig config) {
|
// public void registerCustomTools(CustomToolConfig config) {
|
||||||
customAxes.addAll(config.customAxes);
|
// customAxes.addAll(config.customAxes);
|
||||||
customBows.addAll(config.customBows);
|
// customBows.addAll(config.customBows);
|
||||||
customHoes.addAll(config.customHoes);
|
// customHoes.addAll(config.customHoes);
|
||||||
customPickaxes.addAll(config.customPickaxes);
|
// customPickaxes.addAll(config.customPickaxes);
|
||||||
customShovels.addAll(config.customShovels);
|
// customShovels.addAll(config.customShovels);
|
||||||
customSwords.addAll(config.customSwords);
|
// customSwords.addAll(config.customSwords);
|
||||||
customToolMap.putAll(config.customToolMap);
|
// customToolMap.putAll(config.customToolMap);
|
||||||
repairables.addAll(config.repairables);
|
// repairables.addAll(config.repairables);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomBoots(Material material) {
|
// public boolean isCustomBoots(Material material) {
|
||||||
return MainConfig.getInstance().getArmorModsEnabled() && customBoots.contains(material);
|
// return MainConfig.getInstance().getArmorModsEnabled() && customBoots.contains(material);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomChestplate(Material material) {
|
// public boolean isCustomChestplate(Material material) {
|
||||||
return MainConfig.getInstance().getArmorModsEnabled() && customChestplates.contains(material);
|
// return MainConfig.getInstance().getArmorModsEnabled() && customChestplates.contains(material);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomHelmet(Material material) {
|
// public boolean isCustomHelmet(Material material) {
|
||||||
return MainConfig.getInstance().getArmorModsEnabled() && customHelmets.contains(material);
|
// return MainConfig.getInstance().getArmorModsEnabled() && customHelmets.contains(material);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomLeggings(Material material) {
|
// public boolean isCustomLeggings(Material material) {
|
||||||
return MainConfig.getInstance().getArmorModsEnabled() && customLeggings.contains(material);
|
// return MainConfig.getInstance().getArmorModsEnabled() && customLeggings.contains(material);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomAxe(Material material) {
|
// public boolean isCustomAxe(Material material) {
|
||||||
return MainConfig.getInstance().getToolModsEnabled() && customAxes.contains(material);
|
// return MainConfig.getInstance().getToolModsEnabled() && customAxes.contains(material);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomBow(Material material) {
|
// public boolean isCustomBow(Material material) {
|
||||||
return MainConfig.getInstance().getToolModsEnabled() && customBows.contains(material);
|
// return MainConfig.getInstance().getToolModsEnabled() && customBows.contains(material);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomHoe(Material material) {
|
// public boolean isCustomHoe(Material material) {
|
||||||
return MainConfig.getInstance().getToolModsEnabled() && customHoes.contains(material);
|
// return MainConfig.getInstance().getToolModsEnabled() && customHoes.contains(material);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomPickaxe(Material material) {
|
// public boolean isCustomPickaxe(Material material) {
|
||||||
return MainConfig.getInstance().getToolModsEnabled() && customPickaxes.contains(material);
|
// return MainConfig.getInstance().getToolModsEnabled() && customPickaxes.contains(material);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomShovel(Material material) {
|
// public boolean isCustomShovel(Material material) {
|
||||||
return MainConfig.getInstance().getToolModsEnabled() && customShovels.contains(material);
|
// return MainConfig.getInstance().getToolModsEnabled() && customShovels.contains(material);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomSword(Material material) {
|
// public boolean isCustomSword(Material material) {
|
||||||
return MainConfig.getInstance().getToolModsEnabled() && customSwords.contains(material);
|
// return MainConfig.getInstance().getToolModsEnabled() && customSwords.contains(material);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomOre(Material data) {
|
// public boolean isCustomOre(Material data) {
|
||||||
return MainConfig.getInstance().getBlockModsEnabled() && customOres.contains(data);
|
// return MainConfig.getInstance().getBlockModsEnabled() && customOres.contains(data);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomLog(BlockState state) {
|
// public boolean isCustomLog(BlockState state) {
|
||||||
return MainConfig.getInstance().getBlockModsEnabled() && customLogs.contains(state.getType());
|
// return MainConfig.getInstance().getBlockModsEnabled() && customLogs.contains(state.getType());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomLeaf(BlockState state) {
|
// public boolean isCustomLeaf(BlockState state) {
|
||||||
return MainConfig.getInstance().getBlockModsEnabled() && customLeaves.contains(state.getType());
|
// return MainConfig.getInstance().getBlockModsEnabled() && customLeaves.contains(state.getType());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomAbilityBlock(BlockState state) {
|
// public boolean isCustomAbilityBlock(BlockState state) {
|
||||||
return MainConfig.getInstance().getBlockModsEnabled() && customAbilityBlocks.contains(state.getType());
|
// return MainConfig.getInstance().getBlockModsEnabled() && customAbilityBlocks.contains(state.getType());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomExcavationBlock(BlockState state) {
|
// public boolean isCustomExcavationBlock(BlockState state) {
|
||||||
return MainConfig.getInstance().getBlockModsEnabled() && customExcavationBlocks.contains(state.getType());
|
// return MainConfig.getInstance().getBlockModsEnabled() && customExcavationBlocks.contains(state.getType());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomHerbalismBlock(BlockState state) {
|
// public boolean isCustomHerbalismBlock(BlockState state) {
|
||||||
return MainConfig.getInstance().getBlockModsEnabled() && customHerbalismBlocks.contains(state.getType());
|
// return MainConfig.getInstance().getBlockModsEnabled() && customHerbalismBlocks.contains(state.getType());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomMiningBlock(BlockState state) {
|
// public boolean isCustomMiningBlock(BlockState state) {
|
||||||
return MainConfig.getInstance().getBlockModsEnabled() && customMiningBlocks.contains(state.getType());
|
// return MainConfig.getInstance().getBlockModsEnabled() && customMiningBlocks.contains(state.getType());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public CustomBlock getBlock(BlockState state) {
|
// public CustomBlock getBlock(BlockState state) {
|
||||||
return customBlockMap.get(state.getType());
|
// return customBlockMap.get(state.getType());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public CustomBlock getBlock(Material data) {
|
// public CustomBlock getBlock(Material data) {
|
||||||
return customBlockMap.get(data);
|
// return customBlockMap.get(data);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
*//**
|
// *//**
|
||||||
* Checks to see if an item is a custom tool.
|
// * Checks to see if an item is a custom tool.
|
||||||
*
|
// *
|
||||||
* @param item Item to check
|
// * @param item Item to check
|
||||||
* @return true if the item is a custom tool, false otherwise
|
// * @return true if the item is a custom tool, false otherwise
|
||||||
*//*
|
// *//*
|
||||||
public boolean isCustomTool(ItemStack item) {
|
// public boolean isCustomTool(ItemStack item) {
|
||||||
return MainConfig.getInstance().getToolModsEnabled() && item != null && customToolMap.containsKey(item.getType());
|
// return MainConfig.getInstance().getToolModsEnabled() && item != null && customToolMap.containsKey(item.getType());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
*//**
|
// *//**
|
||||||
* Get the custom tool associated with an item.
|
// * Get the custom tool associated with an item.
|
||||||
*
|
// *
|
||||||
* @param item The item to check
|
// * @param item The item to check
|
||||||
* @return the tool if it exists, null otherwise
|
// * @return the tool if it exists, null otherwise
|
||||||
*//*
|
// *//*
|
||||||
public CustomTool getTool(ItemStack item) {
|
// public CustomTool getTool(ItemStack item) {
|
||||||
return item == null ? null : customToolMap.get(item.getType());
|
// return item == null ? null : customToolMap.get(item.getType());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public List<Repairable> getLoadedRepairables() {
|
// public List<Repairable> getLoadedRepairables() {
|
||||||
return repairables;
|
// return repairables;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public boolean isCustomEntity(Entity entity) {
|
// public boolean isCustomEntity(Entity entity) {
|
||||||
if (!MainConfig.getInstance().getEntityModsEnabled()) {
|
// if (!MainConfig.getInstance().getEntityModsEnabled()) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (customEntityTypeMap.containsKey(entity.getType().toString())) {
|
// if (customEntityTypeMap.containsKey(entity.getType().toString())) {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
return customEntityClassMap.containsKey(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
|
// return customEntityClassMap.containsKey(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
|
||||||
}
|
// }
|
||||||
catch (Exception e) {
|
// catch (Exception e) {
|
||||||
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
// if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
||||||
return customEntityClassMap.containsKey(entity.getClass().getName());
|
// return customEntityClassMap.containsKey(entity.getClass().getName());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public CustomEntity getEntity(Entity entity) {
|
// public CustomEntity getEntity(Entity entity) {
|
||||||
CustomEntity customEntity = customEntityTypeMap.get(entity.getType().toString());
|
// CustomEntity customEntity = customEntityTypeMap.get(entity.getType().toString());
|
||||||
|
//
|
||||||
if (customEntity == null) {
|
// if (customEntity == null) {
|
||||||
try {
|
// try {
|
||||||
customEntity = customEntityClassMap.get(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
|
// customEntity = customEntityClassMap.get(((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName());
|
||||||
}
|
// }
|
||||||
catch (Exception e) {
|
// catch (Exception e) {
|
||||||
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
// if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
||||||
customEntity = customEntityClassMap.get(entity.getClass().getName());
|
// customEntity = customEntityClassMap.get(entity.getClass().getName());
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return customEntity;
|
// return customEntity;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void addCustomEntity(Entity entity) {
|
// public void addCustomEntity(Entity entity) {
|
||||||
if (!MainConfig.getInstance().getEntityModsEnabled()) {
|
// if (!MainConfig.getInstance().getEntityModsEnabled()) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
File entityFile = new File(mcMMO.p.getDataFolder(), "mods" + File.separator + "entities.default.yml");
|
// File entityFile = new File(mcMMO.p.getDataFolder(), "mods" + File.separator + "entities.default.yml");
|
||||||
YamlConfiguration entitiesFile = YamlConfiguration.loadConfiguration(entityFile);
|
// YamlConfiguration entitiesFile = YamlConfiguration.loadConfiguration(entityFile);
|
||||||
|
//
|
||||||
String entityName = entity.getType().toString();
|
// String entityName = entity.getType().toString();
|
||||||
String sanitizedEntityName = entityName.replace(".", "_");
|
// String sanitizedEntityName = entityName.replace(".", "_");
|
||||||
|
//
|
||||||
if (entitiesFile.getKeys(false).contains(sanitizedEntityName)) {
|
// if (entitiesFile.getKeys(false).contains(sanitizedEntityName)) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
entitiesFile.set(sanitizedEntityName + ".XP_Multiplier", 1.0D);
|
// entitiesFile.set(sanitizedEntityName + ".XP_Multiplier", 1.0D);
|
||||||
entitiesFile.set(sanitizedEntityName + ".Tameable", false);
|
// entitiesFile.set(sanitizedEntityName + ".Tameable", false);
|
||||||
entitiesFile.set(sanitizedEntityName + ".Taming_XP", 0);
|
// entitiesFile.set(sanitizedEntityName + ".Taming_XP", 0);
|
||||||
entitiesFile.set(sanitizedEntityName + ".CanBeSummoned", false);
|
// entitiesFile.set(sanitizedEntityName + ".CanBeSummoned", false);
|
||||||
entitiesFile.set(sanitizedEntityName + ".COTW_Material", "");
|
// entitiesFile.set(sanitizedEntityName + ".COTW_Material", "");
|
||||||
entitiesFile.set(sanitizedEntityName + ".COTW_Material_Data", 0);
|
// entitiesFile.set(sanitizedEntityName + ".COTW_Material_Data", 0);
|
||||||
entitiesFile.set(sanitizedEntityName + ".COTW_Material_Amount", 0);
|
// entitiesFile.set(sanitizedEntityName + ".COTW_Material_Amount", 0);
|
||||||
|
//
|
||||||
String className = "";
|
// String className = "";
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
className = ((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName();
|
// className = ((Class<?>) entity.getClass().getDeclaredField("entityClass").get(entity)).getName();
|
||||||
}
|
// }
|
||||||
catch (Exception e) {
|
// catch (Exception e) {
|
||||||
if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
// if (e instanceof NoSuchFieldException || e instanceof IllegalArgumentException || e instanceof IllegalAccessException) {
|
||||||
className = entity.getClass().getName();
|
// className = entity.getClass().getName();
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
CustomEntity customEntity = new CustomEntity(1.0D, false, 0, false, null, 0);
|
// CustomEntity customEntity = new CustomEntity(1.0D, false, 0, false, null, 0);
|
||||||
customEntityTypeMap.put(entityName, customEntity);
|
// customEntityTypeMap.put(entityName, customEntity);
|
||||||
customEntityClassMap.put(className, customEntity);
|
// customEntityClassMap.put(className, customEntity);
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
entitiesFile.save(entityFile);
|
// entitiesFile.save(entityFile);
|
||||||
mcMMO.p.debug(entity.getType().toString() + " was added to the custom entities file!");
|
// mcMMO.p.debug(entity.getType().toString() + " was added to the custom entities file!");
|
||||||
}
|
// }
|
||||||
catch (Exception e) {
|
// catch (Exception e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
}*/
|
// }*/
|
||||||
}
|
//}
|
||||||
|
Loading…
Reference in New Issue
Block a user