Added config options for specific double drops. Implements MCCORE-226

This commit is contained in:
GJ 2012-05-01 01:14:32 -04:00
parent c8ad2bb454
commit dbede7f81a
11 changed files with 441 additions and 192 deletions

View File

@ -13,6 +13,7 @@ Version 1.3.07
+ Added a permission node for Archery bonus damage
+ Added a permission node for Greater Impact ability
+ Added permission nodes for Treasure & Magic Hunter for Fishing
+ Added config options for enabling/disabling specific double drops
= Fixed bug where the permission node for Impact didn't work
= Fixed some bypass nodes defaulting true for Ops
! Changed Mining to ignore blocks when the pick is enchanted with Silk Touch

View File

@ -19,7 +19,6 @@ public class Config extends ConfigLoader {
* GENERAL SETTINGS
*/
/* General Settings */
public String getLocale() { return config.getString("General.Locale", "en_us"); }
public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); }
@ -137,12 +136,26 @@ public class Config extends ConfigLoader {
public int getHerbalismXPNetherWart() { return config.getInt("Experience.Herbalism.Nether_Wart", 50); }
public int getHerbalismXPLilyPads() { return config.getInt("Experience.Herbalism.Lily_Pads", 100); }
public int getHerbalismXPVines() { return config.getInt("Experience.Herbalism.Vines", 10); }
public boolean getHerbalismHungerBonusEnabled() { return config.getBoolean("Skills.Herbalism.Hunger_Bonus", true); }
public boolean getHerbalismWheatRegrowth() { return config.getBoolean("Skills.Herbalism.Instant_Wheat_Regrowth", true); }
public boolean getHerbalismGreenThumbCobbleToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); }
public boolean getHerbalismGreenThumbSmoothbrickToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); }
public boolean getHerbalismGreenThumbDirtToGrass() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Dirt_To_Grass", true); }
public boolean getBrownMushroomsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Brown_Mushrooms", true); }
public boolean getCactiDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Cacti", true); }
public boolean getWheatDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Wheat", true); }
public boolean getMelonsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Melons", true); }
public boolean getNetherWartsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Nether_Warts", true); }
public boolean getPumpkinsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Pumpkins", true); }
public boolean getRedMushroomsDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Red_Mushrooms", true); }
public boolean getRedRosesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Red_Roses", true); }
public boolean getSugarCaneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Sugar_Cane", true); }
public boolean getVinesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Vines", true); }
public boolean getWaterLiliesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Water_Lilies", true); }
public boolean getYellowFlowersDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Yellow_Flowers", true); }
/* Mining */
public int getMiningXPGoldOre() { return config.getInt("Experience.Mining.Gold", 250); }
public int getMiningXPDiamondOre() { return config.getInt("Experience.Mining.Diamond", 750); }
@ -158,6 +171,20 @@ public class Config extends ConfigLoader {
public int getMiningXPEndStone() { return config.getInt("Experience.Mining.End_Stone", 150); }
public int getMiningXPMossyStone() { return config.getInt("Experience.Mining.Moss_Stone", 30); }
public boolean getCoalDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Coal", true); }
public boolean getDiamondDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Diamond", true); }
public boolean getEndStoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.End_Stone", true); }
public boolean getGlowstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Glowstone", true); }
public boolean getGoldDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Gold", true); }
public boolean getIronDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Iron", true); }
public boolean getLapisDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Lapis", true); }
public boolean getMossyCobblestoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Moss_Stone", true); }
public boolean getNetherrackDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Netherrack", true); }
public boolean getObsidianDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Obsidian", true); }
public boolean getRedstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Redstone", true); }
public boolean getSandstoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Sandstone", true); }
public boolean getStoneDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Mining.Stone", true); }
public int getDetonatorItemID() { return config.getInt("Skills.Mining.Detonator_ID", 259); }
/* Repair */
@ -192,6 +219,11 @@ public class Config extends ConfigLoader {
public int getWoodcuttingXPSpruce() { return config.getInt("Experience.Woodcutting.Spruce", 80); }
public int getWoodcuttingXPJungle() { return config.getInt("Experience.Woodcutting.Jungle", 100); }
public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }
public boolean getBirchDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Birch", true); }
public boolean getSpruceDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Spruce", true); }
public boolean getJungleDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Jungle", true); }
/* Arcane Forging */
public boolean getArcaneForgingDowngradeEnabled() { return config.getBoolean("Arcane_Forging.Downgrades.Enabled", true); }
public int getArcaneForgingDowngradeChanceRank1() { return config.getInt("Arcane_Forging.Downgrades.Chance.Rank_1", 75); }

View File

@ -5,9 +5,7 @@ import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.Excavation;
import com.gmail.nossr50.skills.Herbalism;
import com.gmail.nossr50.skills.Mining;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Permissions;
public enum AbilityType {
@ -130,33 +128,35 @@ public enum AbilityType {
* @return true if the player has permissions, false otherwise
*/
public boolean getPermissions(Player player) {
Permissions permInstance = Permissions.getInstance();
switch (this) {
case BERSERK:
return Permissions.getInstance().berserk(player);
return permInstance.berserk(player);
case BLAST_MINING:
return Permissions.getInstance().blastMining(player);
return permInstance.blastMining(player);
case GIGA_DRILL_BREAKER:
return Permissions.getInstance().gigaDrillBreaker(player);
return permInstance.gigaDrillBreaker(player);
case GREEN_TERRA:
return Permissions.getInstance().greenTerra(player);
return permInstance.greenTerra(player);
case LEAF_BLOWER:
return Permissions.getInstance().leafBlower(player);
return permInstance.leafBlower(player);
case SERRATED_STRIKES:
return Permissions.getInstance().serratedStrikes(player);
return permInstance.serratedStrikes(player);
case SKULL_SPLIITER:
return Permissions.getInstance().skullSplitter(player);
return permInstance.skullSplitter(player);
case SUPER_BREAKER:
return Permissions.getInstance().superBreaker(player);
return permInstance.superBreaker(player);
case TREE_FELLER:
return Permissions.getInstance().treeFeller(player);
return permInstance.treeFeller(player);
default:
return false;
@ -172,19 +172,19 @@ public enum AbilityType {
public boolean blockCheck(Material material) {
switch (this) {
case BERSERK:
return (Excavation.canBeGigaDrillBroken(material) || material.equals(Material.SNOW));
return (BlockChecks.canBeGigaDrillBroken(material) || material.equals(Material.SNOW));
case GIGA_DRILL_BREAKER:
return Excavation.canBeGigaDrillBroken(material);
return BlockChecks.canBeGigaDrillBroken(material);
case GREEN_TERRA:
return Herbalism.makeMossy(material);
return BlockChecks.makeMossy(material);
case LEAF_BLOWER:
return material.equals(Material.LEAVES);
case SUPER_BREAKER:
return Mining.canBeSuperBroken(material);
return BlockChecks.canBeSuperBroken(material);
case TREE_FELLER:
return material.equals(Material.LOG);

View File

@ -146,16 +146,16 @@ public class BlockListener implements Listener {
*/
/* Green Terra */
if (PP.getToolPreparationMode(ToolType.HOE) && Permissions.getInstance().greenTerra(player) && ((mat.equals(Material.CROPS) && block.getData() == CropState.RIPE.getData()) || Herbalism.canBeGreenTerra(mat))) {
if (PP.getToolPreparationMode(ToolType.HOE) && Permissions.getInstance().greenTerra(player) && ((mat.equals(Material.CROPS) && block.getData() == CropState.RIPE.getData()) || BlockChecks.canBeGreenTerra(mat))) {
Skills.abilityCheck(player, SkillType.HERBALISM);
}
/* Triple drops */
if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && Herbalism.canBeGreenTerra(mat)) {
if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && BlockChecks.canBeGreenTerra(mat)) {
Herbalism.herbalismProcCheck(block, player, event, plugin);
}
if (Permissions.getInstance().herbalism(player) && Herbalism.canBeGreenTerra(mat)) {
if (Permissions.getInstance().herbalism(player) && BlockChecks.canBeGreenTerra(mat)) {
Herbalism.herbalismProcCheck(block, player, event, plugin);
}
@ -163,7 +163,7 @@ public class BlockListener implements Listener {
* MINING
*/
if (Permissions.getInstance().mining(player) && Mining.canBeSuperBroken(mat)) {
if (Permissions.getInstance().mining(player) && BlockChecks.canBeSuperBroken(mat)) {
if (Config.getInstance().getMiningRequiresTool() && ItemChecks.isMiningPick(inhand)) {
Mining.miningBlockCheck(player, block);
}
@ -193,7 +193,7 @@ public class BlockListener implements Listener {
* EXCAVATION
*/
if (Excavation.canBeGigaDrillBroken(mat) && Permissions.getInstance().excavation(player) && !block.hasMetadata("mcmmoPlacedBlock")) {
if (BlockChecks.canBeGigaDrillBroken(mat) && Permissions.getInstance().excavation(player) && !block.hasMetadata("mcmmoPlacedBlock")) {
if (Config.getInstance().getExcavationRequiresTool() && ItemChecks.isShovel(inhand)) {
Excavation.excavationProcCheck(block, player);
}
@ -227,19 +227,19 @@ public class BlockListener implements Listener {
* ABILITY PREPARATION CHECKS
*/
if (BlockChecks.abilityBlockCheck(mat)) {
if (PP.getToolPreparationMode(ToolType.HOE) && (Herbalism.canBeGreenTerra(mat) || Herbalism.makeMossy(mat))) {
if (PP.getToolPreparationMode(ToolType.HOE) && (BlockChecks.canBeGreenTerra(mat) || BlockChecks.makeMossy(mat))) {
Skills.abilityCheck(player, SkillType.HERBALISM);
}
else if (PP.getToolPreparationMode(ToolType.AXE) && mat.equals(Material.LOG) && Permissions.getInstance().treeFeller(player)) { //Why are we checking the permissions here?
else if (PP.getToolPreparationMode(ToolType.AXE) && mat.equals(Material.LOG) && Permissions.getInstance().treeFeller(player)) { //TODO: Why are we checking the permissions here?
Skills.abilityCheck(player, SkillType.WOODCUTTING);
}
else if (PP.getToolPreparationMode(ToolType.PICKAXE) && Mining.canBeSuperBroken(mat)) {
else if (PP.getToolPreparationMode(ToolType.PICKAXE) && BlockChecks.canBeSuperBroken(mat)) {
Skills.abilityCheck(player, SkillType.MINING);
}
else if (PP.getToolPreparationMode(ToolType.SHOVEL) && Excavation.canBeGigaDrillBroken(mat)) {
else if (PP.getToolPreparationMode(ToolType.SHOVEL) && BlockChecks.canBeGigaDrillBroken(mat)) {
Skills.abilityCheck(player, SkillType.EXCAVATION);
}
else if (PP.getToolPreparationMode(ToolType.FISTS) && (Excavation.canBeGigaDrillBroken(mat) || mat.equals(Material.SNOW))) {
else if (PP.getToolPreparationMode(ToolType.FISTS) && (BlockChecks.canBeGigaDrillBroken(mat) || mat.equals(Material.SNOW))) {
Skills.abilityCheck(player, SkillType.UNARMED);
}
}
@ -252,7 +252,7 @@ public class BlockListener implements Listener {
/*
* ABILITY TRIGGER CHECKS
*/
if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && Permissions.getInstance().greenTerra(player) && Herbalism.makeMossy(mat)) {
if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && Permissions.getInstance().greenTerra(player) && BlockChecks.makeMossy(mat)) {
Herbalism.greenTerra(player, block);
}
else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) {

View File

@ -222,7 +222,7 @@ public class PlayerListener implements Listener {
}
/* GREEN THUMB CHECK */
if (Permissions.getInstance().greenThumbBlocks(player) && Herbalism.makeMossy(mat) && is.getType().equals(Material.SEEDS)) {
if (Permissions.getInstance().greenThumbBlocks(player) && BlockChecks.makeMossy(mat) && is.getType().equals(Material.SEEDS)) {
Herbalism.greenThumbBlocks(is, player, block);
}

View File

@ -28,28 +28,6 @@ public class Excavation {
private static Random random = new Random();
/**
* Check to see if a block can be broken by Giga Drill Breaker.
*
* @param material The type of block to check
* @return
*/
public static boolean canBeGigaDrillBroken(Material type) {
switch (type) {
case CLAY:
case DIRT:
case GRASS:
case GRAVEL:
case MYCEL:
case SAND:
case SOUL_SAND:
return true;
default:
return false;
}
}
/**
* Check to see if treasures were found.
*

View File

@ -62,52 +62,6 @@ public class Herbalism {
}
}
/**
* Check if a block can be made mossy.
*
* @param material The type of Block to check
* @return true if the block can be made mossy, false otherwise
*/
public static Boolean makeMossy(Material type) {
switch (type) {
case COBBLESTONE:
case DIRT:
case SMOOTH_BRICK:
return true;
default:
return false;
}
}
/**
* Check if a block is affected by Herbalism abilities.
*
* @param type The type of Block to check
* @return true if the block is affected, false otherwise
*/
public static Boolean canBeGreenTerra(Material type){
switch (type) {
case BROWN_MUSHROOM:
case CACTUS:
case CROPS:
case JACK_O_LANTERN:
case MELON_BLOCK:
case NETHER_WARTS:
case PUMPKIN:
case RED_MUSHROOM:
case RED_ROSE:
case SUGAR_CANE_BLOCK:
case VINE:
case WATER_LILY:
case YELLOW_FLOWER:
return true;
default:
return false;
}
}
/**
* Check for extra Herbalism drops.
*
@ -231,27 +185,86 @@ public class Herbalism {
if (mat == null) {
return;
} else if (Permissions.getInstance().herbalismDoubleDrops(player)) {
}
if (Permissions.getInstance().herbalismDoubleDrops(player)) {
ItemStack is = new ItemStack(mat);
if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(1000) <= herbLevel) {
if (type.equals(Material.CACTUS)) {
Config configInstance = Config.getInstance();
switch (type) {
case BROWN_MUSHROOM:
if (configInstance.getBrownMushroomsDoubleDropsEnabled()) {
Misc.mcDropItem(loc, is);
}
break;
case CACTUS:
if (configInstance.getCactiDoubleDropsEnabled()) {
Misc.mcDropItems(loc, is, catciDrops);
}
else if (type.equals(Material.MELON_BLOCK)) {
break;
case CROPS:
if (configInstance.getWheatDoubleDropsEnabled()) {
Misc.mcDropItem(loc, is);
}
break;
case MELON_BLOCK:
if (configInstance.getMelonsDoubleDropsEnabled()) {
Misc.mcDropItems(loc, is, 3);
Misc.mcRandomDropItems(loc, is, 50, 4);
}
else if (type.equals(Material.NETHER_WARTS)) {
break;
case NETHER_WARTS:
if (configInstance.getNetherWartsDoubleDropsEnabled()) {
Misc.mcDropItems(loc, is, 2);
Misc.mcRandomDropItems(loc, is, 50, 3);
}
else if (type.equals(Material.SUGAR_CANE_BLOCK)) {
break;
case PUMPKIN:
if (configInstance.getPumpkinsDoubleDropsEnabled()) {
Misc.mcDropItem(loc, is);
}
break;
case RED_MUSHROOM:
if (configInstance.getRedMushroomsDoubleDropsEnabled()) {
Misc.mcDropItem(loc, is);
}
break;
case SUGAR_CANE_BLOCK:
if (configInstance.getSugarCaneDoubleDropsEnabled()) {
Misc.mcDropItems(loc, is, caneDrops);
}
else {
break;
case VINE:
if (configInstance.getVinesDoubleDropsEnabled()) {
Misc.mcDropItem(loc, is);
}
break;
case WATER_LILY:
if (configInstance.getWaterLiliesDoubleDropsEnabled()) {
Misc.mcDropItem(loc, is);
}
break;
case YELLOW_FLOWER:
if (configInstance.getYellowFlowersDoubleDropsEnabled()) {
Misc.mcDropItem(loc, is);
}
break;
default:
break;
}
}
}

View File

@ -13,6 +13,7 @@ import org.bukkit.enchantments.Enchantment;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;
@ -34,44 +35,98 @@ public class Mining {
Location loc = block.getLocation();
Material type = block.getType();
ItemStack item = new ItemStack(type);
Config configInstance = Config.getInstance();
switch (type) {
case COAL_ORE:
if (configInstance.getCoalDoubleDropsEnabled()) {
item = new ItemStack(Material.COAL, 1, (short) 0, CoalType.COAL.getData());
Misc.mcDropItem(loc, item);
}
break;
case DIAMOND_ORE:
if (configInstance.getDiamondDoubleDropsEnabled()) {
item = new ItemStack(Material.DIAMOND);
Misc.mcDropItem(loc, item);
}
break;
case ENDER_STONE:
if (configInstance.getEndStoneDoubleDropsEnabled()) {
Misc.mcDropItem(loc, item);
}
break;
case GLOWING_REDSTONE_ORE:
case REDSTONE_ORE:
if (configInstance.getRedstoneDoubleDropsEnabled()) {
item = new ItemStack(Material.REDSTONE);
Misc.mcDropItems(loc, item, 4);
Misc.mcRandomDropItem(loc, item, 50);
}
break;
case GLOWSTONE:
if (configInstance.getGlowstoneDoubleDropsEnabled()) {
item = new ItemStack(Material.GLOWSTONE_DUST);
Misc.mcDropItems(loc, item, 2);
Misc.mcRandomDropItems(loc, item, 50, 2);
}
break;
case GOLD_ORE:
if (configInstance.getGoldDoubleDropsEnabled()) {
Misc.mcDropItem(loc, item);
}
break;
case IRON_ORE:
if (configInstance.getIronDoubleDropsEnabled()) {
Misc.mcDropItem(loc, item);
}
break;
case LAPIS_ORE:
if (configInstance.getLapisDoubleDropsEnabled()) {
item = new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x4);
Misc.mcDropItems(loc, item, 4);
Misc.mcRandomDropItems(loc, item, 50, 4);
}
break;
case MOSSY_COBBLESTONE:
if (configInstance.getMossyCobblestoneDoubleDropsEnabled()) {
Misc.mcDropItem(loc, item);
}
break;
case NETHERRACK:
if (configInstance.getNetherrackDoubleDropsEnabled()) {
Misc.mcDropItem(loc, item);
}
break;
case OBSIDIAN:
if (configInstance.getObsidianDoubleDropsEnabled()) {
Misc.mcDropItem(loc, item);
}
break;
case SANDSTONE:
if (configInstance.getSandstoneDoubleDropsEnabled()) {
Misc.mcDropItem(loc, item);
}
break;
case STONE:
if (configInstance.getStoneDoubleDropsEnabled()) {
item = new ItemStack(Material.COBBLESTONE);
Misc.mcDropItem(loc, item);
}
break;
default:
Misc.mcDropItem(loc, item);
break;
}
}
@ -162,7 +217,7 @@ public class Mining {
miningXP(player, block);
if (canBeSuperBroken(block.getType())) {
if (BlockChecks.canBeSuperBroken(block.getType())) {
final int MAX_BONUS_LEVEL = 1000;
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
@ -173,35 +228,6 @@ public class Mining {
}
}
/**
* Check to see if a block is broken by Super Breaker.
*
* @param type The type of Block to check
* @return true if the block would be broken by Super Breaker, false otherwise
*/
public static Boolean canBeSuperBroken(Material type) {
switch (type) {
case COAL_ORE:
case DIAMOND_ORE:
case ENDER_STONE:
case GLOWING_REDSTONE_ORE:
case GLOWSTONE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case MOSSY_COBBLESTONE:
case NETHERRACK:
case OBSIDIAN:
case REDSTONE_ORE:
case SANDSTONE:
case STONE:
return true;
default:
return false;
}
}
/**
* Handle the Super Breaker ability.
*

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.skills;
import java.util.ArrayList;
import java.util.Random;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.TreeSpecies;
import org.bukkit.block.Block;
@ -18,6 +19,7 @@ import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.spout.SpoutSounds;
import com.gmail.nossr50.util.BlockChecks;
import com.gmail.nossr50.util.Combat;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions;
@ -140,9 +142,38 @@ public class WoodCutting {
x.setData((byte) 0x0);
x.setType(Material.AIR);
Config configInstance = Config.getInstance();
/* Drop the block */
switch (species) {
case GENERIC:
if (configInstance.getOakDoubleDropsEnabled()) {
Misc.mcDropItem(x.getLocation(), item);
}
break;
case REDWOOD:
if (configInstance.getSpruceDoubleDropsEnabled()) {
Misc.mcDropItem(x.getLocation(), item);
}
break;
case BIRCH:
if (configInstance.getBirchDoubleDropsEnabled()) {
Misc.mcDropItem(x.getLocation(), item);
}
break;
case JUNGLE:
if (configInstance.getJungleDoubleDropsEnabled()) {
Misc.mcDropItem(x.getLocation(), item);
}
break;
default:
break;
}
}
else if (x.getType() == Material.LEAVES) {
final int SAPLING_DROP_CHANCE = 10;
@ -156,26 +187,10 @@ public class WoodCutting {
}
}
if (Permissions.getInstance().woodcutting(player)) {
PP.addXP(SkillType.WOODCUTTING, xp); //Tree Feller gives nerf'd XP
Skills.XpCheckSkill(SkillType.WOODCUTTING, player);
}
/**
* Checks if the block is affected by Tree Feller.
*
* @param block Block to check
* @return true if the block is affected by Tree Feller, false otherwise
*/
private static boolean treeFellerCompatible(Block block) {
switch (block.getType()) {
case LOG:
case LEAVES:
case AIR:
return true;
default:
return false;
}
}
/**
@ -202,24 +217,24 @@ public class WoodCutting {
Block yPositive = currentBlock.getRelative(0, 1, 0);
if (!currentBlock.hasMetadata("mcmmoPlacedBlock")) {
if (!isTooAggressive(currentBlock, xPositive) && treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive)) {
if (!isTooAggressive(currentBlock, xPositive) && BlockChecks.treeFellerCompatible(xPositive.getType()) && !toBeFelled.contains(xPositive)) {
processTreeFelling(xPositive, toBeFelled);
}
if (!isTooAggressive(currentBlock, xNegative) && treeFellerCompatible(xNegative) && !toBeFelled.contains(xNegative)) {
if (!isTooAggressive(currentBlock, xNegative) && BlockChecks.treeFellerCompatible(xNegative.getType()) && !toBeFelled.contains(xNegative)) {
processTreeFelling(xNegative, toBeFelled);
}
if (!isTooAggressive(currentBlock, zPositive) && treeFellerCompatible(zPositive) && !toBeFelled.contains(zPositive)) {
if (!isTooAggressive(currentBlock, zPositive) && BlockChecks.treeFellerCompatible(zPositive.getType()) && !toBeFelled.contains(zPositive)) {
processTreeFelling(zPositive, toBeFelled);
}
if (!isTooAggressive(currentBlock, zNegative) && treeFellerCompatible(zNegative) && !toBeFelled.contains(zNegative)) {
if (!isTooAggressive(currentBlock, zNegative) && BlockChecks.treeFellerCompatible(zNegative.getType()) && !toBeFelled.contains(zNegative)) {
processTreeFelling(zNegative, toBeFelled);
}
}
if (treeFellerCompatible(yPositive)) {
if (BlockChecks.treeFellerCompatible(yPositive.getType())) {
if(!currentBlock.hasMetadata("mcmmoPlacedBlock") && !toBeFelled.contains(yPositive)) {
processTreeFelling(yPositive, toBeFelled);
}
@ -258,9 +273,43 @@ public class WoodCutting {
byte type = block.getData();
Material mat = Material.getMaterial(block.getTypeId());
Tree tree = (Tree) block.getState().getData();
TreeSpecies species = tree.getSpecies();
if ((skillLevel > MAX_SKILL_LEVEL || random.nextInt(1000) <= skillLevel) && Permissions.getInstance().woodcuttingDoubleDrops(player)) {
Config configInstance = Config.getInstance();
ItemStack item = new ItemStack(mat, 1, (short) 0, type);
Misc.mcDropItem(block.getLocation(), item);
Location location = block.getLocation();
/* Drop the block */
switch (species) {
case GENERIC:
if (configInstance.getOakDoubleDropsEnabled()) {
Misc.mcDropItem(location, item);
}
break;
case REDWOOD:
if (configInstance.getSpruceDoubleDropsEnabled()) {
Misc.mcDropItem(location, item);
}
break;
case BIRCH:
if (configInstance.getBirchDoubleDropsEnabled()) {
Misc.mcDropItem(location, item);
}
break;
case JUNGLE:
if (configInstance.getJungleDoubleDropsEnabled()) {
Misc.mcDropItem(location, item);
}
break;
default:
break;
}
}
}

View File

@ -27,7 +27,6 @@ public class BlockChecks {
case GRASS:
case GRAVEL:
case IRON_ORE:
case JACK_O_LANTERN:
case LAPIS_ORE:
case LOG:
case MELON_BLOCK:
@ -116,4 +115,118 @@ public class BlockChecks {
return false;
}
}
/**
* Check if a block can be made mossy.
*
* @param material The type of Block to check
* @return true if the block can be made mossy, false otherwise
*/
public static boolean makeMossy(Material type) {
switch (type) {
case COBBLESTONE:
case DIRT:
case SMOOTH_BRICK:
return true;
default:
return false;
}
}
/**
* Check if a block is affected by Herbalism abilities.
*
* @param type The type of Block to check
* @return true if the block is affected, false otherwise
*/
public static boolean canBeGreenTerra(Material type){
switch (type) {
case BROWN_MUSHROOM:
case CACTUS:
case CROPS:
case MELON_BLOCK:
case NETHER_WARTS:
case PUMPKIN:
case RED_MUSHROOM:
case RED_ROSE:
case SUGAR_CANE_BLOCK:
case VINE:
case WATER_LILY:
case YELLOW_FLOWER:
return true;
default:
return false;
}
}
/**
* Check to see if a block is broken by Super Breaker.
*
* @param type The type of Block to check
* @return true if the block would be broken by Super Breaker, false otherwise
*/
public static Boolean canBeSuperBroken(Material type) {
switch (type) {
case COAL_ORE:
case DIAMOND_ORE:
case ENDER_STONE:
case GLOWING_REDSTONE_ORE:
case GLOWSTONE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case MOSSY_COBBLESTONE:
case NETHERRACK:
case OBSIDIAN:
case REDSTONE_ORE:
case SANDSTONE:
case STONE:
return true;
default:
return false;
}
}
/**
* Check to see if a block can be broken by Giga Drill Breaker.
*
* @param material The type of block to check
* @return
*/
public static boolean canBeGigaDrillBroken(Material type) {
switch (type) {
case CLAY:
case DIRT:
case GRASS:
case GRAVEL:
case MYCEL:
case SAND:
case SOUL_SAND:
return true;
default:
return false;
}
}
/**
* Checks if the block is affected by Tree Feller.
*
* @param block Block to check
* @return true if the block is affected by Tree Feller, false otherwise
*/
public static boolean treeFellerCompatible(Material type) {
switch (type) {
case LOG:
case LEAVES:
case AIR:
return true;
default:
return false;
}
}
}

View File

@ -173,6 +173,43 @@ Skills:
Level_Cap: 0
Requires_Axe: true
#
# Settings for Double Drops
###
Double_Drops:
Herbalism:
Brown_Mushrooms: true
Cacti: true
Melons: true
Nether_Warts: true
Pumpkins: true
Red_Mushrooms: true
Red_Roses: true
Sugar_Cane: true
Vines: true
Water_Lilies: true
Wheat: true
Yellow_Flowers: true
Mining:
Coal: true
Diamond: true
End_Stone: true
Glowstone: true
Gold: true
Iron: true
Lapis: true
Moss_Stone: true
Netherrack: true
Obsidian: true
Redstone: true
Sandstone: true
Stone: true
Woodcutting:
Oak: true
Birch: true
Spruce: true
Jungle: true
#
# Settings for XP distribution
###