2013-03-01 06:52:01 +01:00
|
|
|
package com.gmail.nossr50.skills.excavation;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.bukkit.block.BlockState;
|
|
|
|
|
2014-03-03 18:27:45 +01:00
|
|
|
import com.gmail.nossr50.mcMMO;
|
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;
|
|
|
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
|
|
|
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
|
|
|
|
|
|
|
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) {
|
|
|
|
switch (blockState.getType()) {
|
|
|
|
case DIRT:
|
|
|
|
return TreasureConfig.getInstance().excavationFromDirt;
|
|
|
|
|
|
|
|
case GRASS:
|
|
|
|
return TreasureConfig.getInstance().excavationFromGrass;
|
|
|
|
|
|
|
|
case SAND:
|
|
|
|
return TreasureConfig.getInstance().excavationFromSand;
|
|
|
|
|
|
|
|
case GRAVEL:
|
|
|
|
return TreasureConfig.getInstance().excavationFromGravel;
|
|
|
|
|
|
|
|
case CLAY:
|
|
|
|
return TreasureConfig.getInstance().excavationFromClay;
|
|
|
|
|
|
|
|
case MYCEL:
|
|
|
|
return TreasureConfig.getInstance().excavationFromMycel;
|
|
|
|
|
|
|
|
case SOUL_SAND:
|
|
|
|
return TreasureConfig.getInstance().excavationFromSoulSand;
|
|
|
|
|
2014-01-31 23:43:32 +01:00
|
|
|
case SNOW:
|
|
|
|
return TreasureConfig.getInstance().excavationFromSnow;
|
|
|
|
|
2013-03-01 06:52:01 +01:00
|
|
|
default:
|
|
|
|
return new ArrayList<ExcavationTreasure>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected static int getBlockXP(BlockState blockState) {
|
2013-08-23 10:16:22 +02:00
|
|
|
int xp = ExperienceConfig.getInstance().getXp(SkillType.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;
|
|
|
|
}
|
|
|
|
}
|