2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.skills.excavation;
|
|
|
|
|
2013-08-23 10:16:22 +02:00
|
|
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
2019-01-13 08:54:53 +01:00
|
|
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
2013-03-01 06:52:01 +01:00
|
|
|
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
2018-10-10 03:48:47 +02:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
2017-06-10 19:47:20 +02:00
|
|
|
import com.gmail.nossr50.util.StringUtils;
|
2018-10-10 03:48:47 +02:00
|
|
|
import org.bukkit.block.BlockState;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2013-03-01 06:52:01 +01:00
|
|
|
|
|
|
|
public class Excavation {
|
|
|
|
/**
|
|
|
|
* Get the list of possible {@link ExcavationTreasure|ExcavationTreasures} obtained from a given block.
|
|
|
|
*
|
|
|
|
* @param blockState The {@link BlockState} of the block to check.
|
|
|
|
* @return the list of treasures that could be found
|
|
|
|
*/
|
|
|
|
protected static List<ExcavationTreasure> getTreasures(BlockState blockState) {
|
2018-07-27 01:53:29 +02:00
|
|
|
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
|
2017-06-10 19:47:20 +02:00
|
|
|
if (TreasureConfig.getInstance().excavationMap.containsKey(friendly))
|
|
|
|
return TreasureConfig.getInstance().excavationMap.get(friendly);
|
|
|
|
return new ArrayList<ExcavationTreasure>();
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected static int getBlockXP(BlockState blockState) {
|
2019-01-13 08:54:53 +01:00
|
|
|
int xp = ExperienceConfig.getInstance().getXp(PrimarySkillType.EXCAVATION, blockState.getType());
|
2013-03-01 06:52:01 +01:00
|
|
|
|
2014-02-03 20:48:43 +01:00
|
|
|
if (xp == 0 && mcMMO.getModManager().isCustomExcavationBlock(blockState)) {
|
|
|
|
xp = mcMMO.getModManager().getBlock(blockState).getXpGain();
|
2013-03-01 06:52:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return xp;
|
|
|
|
}
|
|
|
|
}
|