MASSIVE config overhaul - most keys are now based on the "proper" name

given to a material or entity by Bukkit.

This WILL wipe some custom values you may have set, so please verify
that your values are what you want them to be after the new config file
is generated.
This commit is contained in:
GJ
2013-02-20 16:44:15 -05:00
parent 17a85c94c6
commit c589c5556b
21 changed files with 356 additions and 780 deletions

View File

@ -45,7 +45,6 @@ public class Herbalism {
public static double doubleDropsMaxChance = AdvancedConfig.getInstance().getHerbalismDoubleDropsChanceMax();
public static int doubleDropsMaxLevel = AdvancedConfig.getInstance().getHerbalismDoubleDropsMaxLevel();
public static boolean doubleDropsDisabled = Config.getInstance().herbalismDoubleDropsDisabled();
public static double hylianLuckMaxChance = AdvancedConfig.getInstance().getHylianLuckChanceMax();
public static int hylianLuckMaxLevel = AdvancedConfig.getInstance().getHylianLucksMaxLevel();

View File

@ -8,46 +8,43 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.skills.utilities.SkillType;
import com.gmail.nossr50.util.Permissions;
import com.google.common.collect.Maps;
public enum HerbalismBlock {
BROWN_MUSHROOM(Material.BROWN_MUSHROOM, Config.getInstance().getHerbalismXPMushrooms(), Config.getInstance().getBrownMushroomsDoubleDropsEnabled()),
CACTUS(Material.CACTUS, Config.getInstance().getHerbalismXPCactus(), Config.getInstance().getCactiDoubleDropsEnabled()),
CARROT(Material.CARROT, Material.CARROT_ITEM, Config.getInstance().getHerbalismXPCarrot(), Config.getInstance().getCarrotDoubleDropsEnabled()),
COCOA(Material.COCOA, new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData()), Config.getInstance().getHerbalismXPCocoa(), Config.getInstance().getCocoaDoubleDropsEnabled()),
CROPS(Material.CROPS, Material.WHEAT, Config.getInstance().getHerbalismXPWheat(), Config.getInstance().getWheatDoubleDropsEnabled()),
MELON_BLOCK(Material.MELON_BLOCK, Material.MELON, Config.getInstance().getHerbalismXPMelon(), Config.getInstance().getMelonsDoubleDropsEnabled()),
NETHER_WARTS(Material.NETHER_WARTS, Material.NETHER_STALK, Config.getInstance().getHerbalismXPNetherWart(), Config.getInstance().getNetherWartsDoubleDropsEnabled()),
POTATO(Material.POTATO, Material.POTATO_ITEM, Config.getInstance().getHerbalismXPPotato(), Config.getInstance().getPotatoDoubleDropsEnabled()),
PUMPKIN(Material.PUMPKIN, Config.getInstance().getHerbalismXPPumpkin(), Config.getInstance().getPumpkinsDoubleDropsEnabled()),
RED_MUSHROOM(Material.RED_MUSHROOM, Config.getInstance().getHerbalismXPMushrooms(), Config.getInstance().getRedMushroomsDoubleDropsEnabled()),
RED_ROSE(Material.RED_ROSE, Config.getInstance().getHerbalismXPFlowers(), Config.getInstance().getRedRosesDoubleDropsEnabled()),
SUGAR_CANE_BLOCK(Material.SUGAR_CANE_BLOCK, Material.SUGAR_CANE, Config.getInstance().getHerbalismXPSugarCane(), Config.getInstance().getSugarCaneDoubleDropsEnabled()),
VINE(Material.VINE, Config.getInstance().getHerbalismXPVines(), Config.getInstance().getVinesDoubleDropsEnabled()),
WATER_LILY(Material.WATER_LILY, Config.getInstance().getHerbalismXPLilyPads(), Config.getInstance().getWaterLiliesDoubleDropsEnabled()),
YELLOW_FLOWER(Material.YELLOW_FLOWER, Config.getInstance().getHerbalismXPFlowers(), Config.getInstance().getYellowFlowersDoubleDropsEnabled());
BROWN_MUSHROOM(Material.BROWN_MUSHROOM),
CACTUS(Material.CACTUS),
CARROT(Material.CARROT, Material.CARROT_ITEM),
COCOA(Material.COCOA, new ItemStack(Material.INK_SACK, 1, DyeColor.BROWN.getDyeData())),
CROPS(Material.CROPS, Material.WHEAT),
MELON_BLOCK(Material.MELON_BLOCK, Material.MELON),
NETHER_WARTS(Material.NETHER_WARTS, Material.NETHER_STALK),
POTATO(Material.POTATO, Material.POTATO_ITEM),
PUMPKIN(Material.PUMPKIN),
RED_MUSHROOM(Material.RED_MUSHROOM),
RED_ROSE(Material.RED_ROSE),
SUGAR_CANE_BLOCK(Material.SUGAR_CANE_BLOCK, Material.SUGAR_CANE),
VINE(Material.VINE),
WATER_LILY(Material.WATER_LILY),
YELLOW_FLOWER(Material.YELLOW_FLOWER);
private Material blockType;
private ItemStack dropItem;
private int xpGain;
private boolean doubleDropsEnabled;
private final static Map<Material, HerbalismBlock> BY_MATERIAL = Maps.newHashMap();
private HerbalismBlock(Material blockType, int xpGain, boolean doubleDropsEnabled) {
this(blockType, new ItemStack(blockType), xpGain, doubleDropsEnabled);
private HerbalismBlock(Material blockType) {
this(blockType, new ItemStack(blockType));
}
private HerbalismBlock(Material blockType, Material dropType, int xpGain, boolean doubleDropsEnabled) {
this(blockType, new ItemStack(dropType), xpGain, doubleDropsEnabled);
private HerbalismBlock(Material blockType, Material dropType) {
this(blockType, new ItemStack(dropType));
}
private HerbalismBlock(Material blockType, ItemStack dropItem, int xpGain, boolean doubleDropsEnabled) {
private HerbalismBlock(Material blockType, ItemStack dropItem) {
this.blockType = blockType;
this.dropItem = dropItem;
this.xpGain = xpGain;
this.doubleDropsEnabled = doubleDropsEnabled;
}
static {
@ -61,11 +58,11 @@ public enum HerbalismBlock {
}
public int getXpGain() {
return xpGain;
return Config.getInstance().getXp(SkillType.HERBALISM, blockType);
}
public boolean canDoubleDrop() {
return doubleDropsEnabled;
return Config.getInstance().getDoubleDropsEnabled(SkillType.HERBALISM, blockType);
}
public boolean hasGreenThumbPermission(Player player) {

View File

@ -67,7 +67,7 @@ public class HerbalismCommand extends SkillCommand {
canGreenThumbBlocks = (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK));
canFarmersDiet = Permissions.farmersDiet(player);
canDoubleDrop = Permissions.doubleDrops(player, skill);
doubleDropsDisabled = Herbalism.doubleDropsDisabled;
doubleDropsDisabled = skill.getDoubleDropsDisabled();
}
@Override