mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Some of these should not have been blockdata, also this should check age of crops.
This commit is contained in:
@ -1,18 +1,17 @@
|
||||
package com.gmail.nossr50.config.experience;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.gmail.nossr50.config.AutoUpdateConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
private static ExperienceConfig instance;
|
||||
@ -218,7 +217,20 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
return config.getInt(wildcardString);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
public boolean isSkillBlock(SkillType skill, Material data)
|
||||
{
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||
if (config.contains(explicitString))
|
||||
return true;
|
||||
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
||||
if (config.contains(friendlyString))
|
||||
return true;
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
||||
return config.contains(wildcardString);
|
||||
}
|
||||
|
||||
public boolean isSkillBlock(SkillType skill, BlockData data)
|
||||
{
|
||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||
@ -229,9 +241,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
|
||||
if (config.contains(friendlyString))
|
||||
return true;
|
||||
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
||||
if (config.contains(wildcardString))
|
||||
return true;
|
||||
return false;
|
||||
return config.contains(wildcardString);
|
||||
}
|
||||
|
||||
/* Acrobatics */
|
||||
|
@ -1,29 +1,27 @@
|
||||
package com.gmail.nossr50.config.mods;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
|
||||
public class CustomBlockConfig extends ConfigLoader {
|
||||
private boolean needsUpdate = false;
|
||||
|
||||
public List<BlockData> customExcavationBlocks = new ArrayList<BlockData>();
|
||||
public List<BlockData> customHerbalismBlocks = new ArrayList<BlockData>();
|
||||
public List<BlockData> customMiningBlocks = new ArrayList<BlockData>();
|
||||
public List<BlockData> customOres = new ArrayList<BlockData>();
|
||||
public List<BlockData> customLogs = new ArrayList<BlockData>();
|
||||
public List<BlockData> customLeaves = new ArrayList<BlockData>();
|
||||
public List<BlockData> customAbilityBlocks = new ArrayList<BlockData>();
|
||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
||||
public List<Material> customOres = new ArrayList<>();
|
||||
public List<Material> customLogs = new ArrayList<>();
|
||||
public List<Material> customLeaves = new ArrayList<>();
|
||||
public List<Material> customAbilityBlocks = new ArrayList<>();
|
||||
|
||||
public HashMap<BlockData, CustomBlock> customBlockMap = new HashMap<BlockData, CustomBlock>();
|
||||
public HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
|
||||
|
||||
protected CustomBlockConfig(String fileName) {
|
||||
super("mods", fileName);
|
||||
@ -44,7 +42,7 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBlocks(String skillType, List<BlockData> blockList) {
|
||||
private void loadBlocks(String skillType, List<Material> blockList) {
|
||||
if (needsUpdate) {
|
||||
return;
|
||||
}
|
||||
@ -72,11 +70,8 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
continue;
|
||||
}
|
||||
|
||||
byte blockData = (blockInfo.length == 2) ? Byte.valueOf(blockInfo[1]) : 0;
|
||||
BlockData blockBlockData = blockMaterial.createBlockData();
|
||||
|
||||
if (blockList != null) {
|
||||
blockList.add(blockBlockData);
|
||||
blockList.add(blockMaterial);
|
||||
}
|
||||
|
||||
if (skillType.equals("Ability_Blocks")) {
|
||||
@ -87,20 +82,20 @@ public class CustomBlockConfig extends ConfigLoader {
|
||||
int smeltingXp = 0;
|
||||
|
||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||
customOres.add(blockBlockData);
|
||||
customOres.add(blockMaterial);
|
||||
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
||||
}
|
||||
else if (skillType.equals("Woodcutting")) {
|
||||
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
|
||||
customLogs.add(blockBlockData);
|
||||
customLogs.add(blockMaterial);
|
||||
}
|
||||
else {
|
||||
customLeaves.add(blockBlockData);
|
||||
customLeaves.add(blockMaterial);
|
||||
xp = 0; // Leaves don't grant XP
|
||||
}
|
||||
}
|
||||
|
||||
customBlockMap.put(blockBlockData, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
||||
customBlockMap.put(blockMaterial, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user