Fixed minor Green Terra bugs on Stone Brick

This commit is contained in:
bm01 2012-05-10 15:54:29 +02:00
parent 06791beabd
commit cbafa7110a
10 changed files with 65 additions and 63 deletions

View File

@ -20,6 +20,8 @@ Version 1.3.07
+ Added config options for enabling/disabling specific double drops + Added config options for enabling/disabling specific double drops
+ Added automatic zip backup of flatfile database & config files + Added automatic zip backup of flatfile database & config files
+ Added config options to enable/disable specific skills for PVP & PVE + Added config options to enable/disable specific skills for PVP & PVE
= Fixed bug where Green Terra consumed seeds even on Mossy Stone Brick
= Fixed bug where the client didn't reflect the Stone Brick to Mossy Stone Brick change
= Fixed bug where an arrow could bounce off entities on daze proc = Fixed bug where an arrow could bounce off entities on daze proc
= Fixed bug where a player could gain Acrobatics experience while riding a cart = Fixed bug where a player could gain Acrobatics experience while riding a cart
= Fixed /party not working properly with 2 arguments = Fixed /party not working properly with 2 arguments

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.datatypes; package com.gmail.nossr50.datatypes;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
@ -166,28 +167,28 @@ public enum AbilityType {
/** /**
* Check if a block is affected by this ability. * Check if a block is affected by this ability.
* *
* @param material The block type to check * @param Block the block to check
* @return true if the block is affected by this ability, false otherwise * @return true if the block is affected by this ability, false otherwise
*/ */
public boolean blockCheck(Material material) { public boolean blockCheck(Block block) {
switch (this) { switch (this) {
case BERSERK: case BERSERK:
return (BlockChecks.canBeGigaDrillBroken(material) || material.equals(Material.SNOW)); return (BlockChecks.canBeGigaDrillBroken(block) || block.getType() == Material.SNOW);
case GIGA_DRILL_BREAKER: case GIGA_DRILL_BREAKER:
return BlockChecks.canBeGigaDrillBroken(material); return BlockChecks.canBeGigaDrillBroken(block);
case GREEN_TERRA: case GREEN_TERRA:
return BlockChecks.makeMossy(material); return BlockChecks.makeMossy(block);
case LEAF_BLOWER: case LEAF_BLOWER:
return material.equals(Material.LEAVES); return block.getType() == Material.LEAVES;
case SUPER_BREAKER: case SUPER_BREAKER:
return BlockChecks.canBeSuperBroken(material); return BlockChecks.canBeSuperBroken(block);
case TREE_FELLER: case TREE_FELLER:
return material.equals(Material.LOG); return block.getType() == Material.LOG;
default: default:
return false; return false;

View File

@ -146,16 +146,16 @@ public class BlockListener implements Listener {
*/ */
/* Green Terra */ /* Green Terra */
if (PP.getToolPreparationMode(ToolType.HOE) && Permissions.getInstance().greenTerra(player) && ((mat.equals(Material.CROPS) && block.getData() == CropState.RIPE.getData()) || BlockChecks.canBeGreenTerra(mat))) { if (PP.getToolPreparationMode(ToolType.HOE) && Permissions.getInstance().greenTerra(player) && ((mat.equals(Material.CROPS) && block.getData() == CropState.RIPE.getData()) || BlockChecks.canBeGreenTerra(block))) {
Skills.abilityCheck(player, SkillType.HERBALISM); Skills.abilityCheck(player, SkillType.HERBALISM);
} }
/* Triple drops */ /* Triple drops */
if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && BlockChecks.canBeGreenTerra(mat)) { if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && BlockChecks.canBeGreenTerra(block)) {
Herbalism.herbalismProcCheck(block, player, event, plugin); Herbalism.herbalismProcCheck(block, player, event, plugin);
} }
if (Permissions.getInstance().herbalism(player) && BlockChecks.canBeGreenTerra(mat)) { if (Permissions.getInstance().herbalism(player) && BlockChecks.canBeGreenTerra(block)) {
Herbalism.herbalismProcCheck(block, player, event, plugin); Herbalism.herbalismProcCheck(block, player, event, plugin);
} }
@ -163,7 +163,7 @@ public class BlockListener implements Listener {
* MINING * MINING
*/ */
if (Permissions.getInstance().mining(player) && BlockChecks.canBeSuperBroken(mat)) { if (Permissions.getInstance().mining(player) && BlockChecks.canBeSuperBroken(block)) {
if (Config.getInstance().getMiningRequiresTool() && ItemChecks.isPickaxe(inhand)) { if (Config.getInstance().getMiningRequiresTool() && ItemChecks.isPickaxe(inhand)) {
Mining.miningBlockCheck(player, block); Mining.miningBlockCheck(player, block);
} }
@ -193,7 +193,7 @@ public class BlockListener implements Listener {
* EXCAVATION * EXCAVATION
*/ */
if (BlockChecks.canBeGigaDrillBroken(mat) && Permissions.getInstance().excavation(player) && !mcMMO.placeStore.isTrue(block)) { if (BlockChecks.canBeGigaDrillBroken(block) && Permissions.getInstance().excavation(player) && !mcMMO.placeStore.isTrue(block)) {
if (Config.getInstance().getExcavationRequiresTool() && ItemChecks.isShovel(inhand)) { if (Config.getInstance().getExcavationRequiresTool() && ItemChecks.isShovel(inhand)) {
Excavation.excavationProcCheck(block, player); Excavation.excavationProcCheck(block, player);
} }
@ -226,20 +226,20 @@ public class BlockListener implements Listener {
/* /*
* ABILITY PREPARATION CHECKS * ABILITY PREPARATION CHECKS
*/ */
if (BlockChecks.abilityBlockCheck(mat)) { if (BlockChecks.abilityBlockCheck(block)) {
if (PP.getToolPreparationMode(ToolType.HOE) && (BlockChecks.canBeGreenTerra(mat) || BlockChecks.makeMossy(mat))) { if (PP.getToolPreparationMode(ToolType.HOE) && (BlockChecks.canBeGreenTerra(block) || BlockChecks.makeMossy(block))) {
Skills.abilityCheck(player, SkillType.HERBALISM); Skills.abilityCheck(player, SkillType.HERBALISM);
} }
else if (PP.getToolPreparationMode(ToolType.AXE) && mat.equals(Material.LOG) && Permissions.getInstance().treeFeller(player)) { //TODO: 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); Skills.abilityCheck(player, SkillType.WOODCUTTING);
} }
else if (PP.getToolPreparationMode(ToolType.PICKAXE) && BlockChecks.canBeSuperBroken(mat)) { else if (PP.getToolPreparationMode(ToolType.PICKAXE) && BlockChecks.canBeSuperBroken(block)) {
Skills.abilityCheck(player, SkillType.MINING); Skills.abilityCheck(player, SkillType.MINING);
} }
else if (PP.getToolPreparationMode(ToolType.SHOVEL) && BlockChecks.canBeGigaDrillBroken(mat)) { else if (PP.getToolPreparationMode(ToolType.SHOVEL) && BlockChecks.canBeGigaDrillBroken(block)) {
Skills.abilityCheck(player, SkillType.EXCAVATION); Skills.abilityCheck(player, SkillType.EXCAVATION);
} }
else if (PP.getToolPreparationMode(ToolType.FISTS) && (BlockChecks.canBeGigaDrillBroken(mat) || mat.equals(Material.SNOW))) { else if (PP.getToolPreparationMode(ToolType.FISTS) && (BlockChecks.canBeGigaDrillBroken(block) || mat.equals(Material.SNOW))) {
Skills.abilityCheck(player, SkillType.UNARMED); Skills.abilityCheck(player, SkillType.UNARMED);
} }
} }
@ -252,7 +252,7 @@ public class BlockListener implements Listener {
/* /*
* ABILITY TRIGGER CHECKS * ABILITY TRIGGER CHECKS
*/ */
if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && Permissions.getInstance().greenTerra(player) && BlockChecks.makeMossy(mat)) { if (PP.getAbilityMode(AbilityType.GREEN_TERRA) && Permissions.getInstance().greenTerra(player) && BlockChecks.makeMossy(block)) {
Herbalism.greenTerra(player, block); Herbalism.greenTerra(player, block);
} }
else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) { else if (PP.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) && Skills.triggerCheck(player, block, AbilityType.GIGA_DRILL_BREAKER)) {

View File

@ -208,7 +208,7 @@ public class PlayerListener implements Listener {
} }
/* ACTIVATION CHECKS */ /* ACTIVATION CHECKS */
if (Config.getInstance().getAbilitiesEnabled() && BlockChecks.abilityBlockCheck(mat)) { if (Config.getInstance().getAbilitiesEnabled() && BlockChecks.abilityBlockCheck(block)) {
if (!mat.equals(Material.DIRT) && !mat.equals(Material.GRASS) && !mat.equals(Material.SOIL)) { if (!mat.equals(Material.DIRT) && !mat.equals(Material.GRASS) && !mat.equals(Material.SOIL)) {
Skills.activationCheck(player, SkillType.HERBALISM); Skills.activationCheck(player, SkillType.HERBALISM);
} }
@ -222,12 +222,12 @@ public class PlayerListener implements Listener {
} }
/* GREEN THUMB CHECK */ /* GREEN THUMB CHECK */
if (Permissions.getInstance().greenThumbBlocks(player) && BlockChecks.makeMossy(mat) && is.getType().equals(Material.SEEDS)) { if (Permissions.getInstance().greenThumbBlocks(player) && BlockChecks.makeMossy(block) && is.getType().equals(Material.SEEDS)) {
Herbalism.greenThumbBlocks(is, player, block); Herbalism.greenThumbBlocks(is, player, block);
} }
/* ITEM CHECKS */ /* ITEM CHECKS */
if (BlockChecks.abilityBlockCheck(mat)) { if (BlockChecks.abilityBlockCheck(block)) {
Item.itemChecks(player); Item.itemChecks(player);
} }

View File

@ -103,7 +103,7 @@ public class BlastMining {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Block temp = iterator.next(); Block temp = iterator.next();
if (BlockChecks.isOre(temp.getType())) { if (BlockChecks.isOre(temp)) {
ores.add(temp); ores.add(temp);
} }
else { else {

View File

@ -42,7 +42,6 @@ public class Herbalism {
} }
else if (hasSeeds && !block.getType().equals(Material.WHEAT)) { else if (hasSeeds && !block.getType().equals(Material.WHEAT)) {
inventory.removeItem(new ItemStack(Material.SEEDS)); inventory.removeItem(new ItemStack(Material.SEEDS));
player.updateInventory();
greenTerraConvert(player, block); greenTerraConvert(player, block);
} }
} }
@ -51,13 +50,13 @@ public class Herbalism {
Material type = block.getType(); Material type = block.getType();
if (Misc.blockBreakSimulate(block, player, false)) { if (Misc.blockBreakSimulate(block, player, false)) {
if (Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy() && type.equals(Material.SMOOTH_BRICK)) { if (Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy() && type == Material.SMOOTH_BRICK && block.getData() == 0) {
block.setData((byte) 0x1); //Set type of the brick to mossy block.setTypeIdAndData(block.getTypeId(), (byte) 1, false); //Set type of the brick to mossy, force the client update
} }
else if (Config.getInstance().getHerbalismGreenThumbDirtToGrass() && type.equals(Material.DIRT)) { else if (Config.getInstance().getHerbalismGreenThumbDirtToGrass() && type == Material.DIRT) {
block.setType(Material.GRASS); block.setType(Material.GRASS);
} }
else if (Config.getInstance().getHerbalismGreenThumbCobbleToMossy() && type.equals(Material.COBBLESTONE)) { else if (Config.getInstance().getHerbalismGreenThumbCobbleToMossy() && type == Material.COBBLESTONE) {
block.setType(Material.MOSSY_COBBLESTONE); block.setType(Material.MOSSY_COBBLESTONE);
} }
} }
@ -299,7 +298,6 @@ public class Herbalism {
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new GreenThumbTimer(block, PP), 1); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new GreenThumbTimer(block, PP), 1);
inventory.removeItem(new ItemStack(Material.SEEDS)); inventory.removeItem(new ItemStack(Material.SEEDS));
player.updateInventory();
} }
} }

View File

@ -218,7 +218,7 @@ public class Mining {
miningXP(player, block); miningXP(player, block);
if (BlockChecks.canBeSuperBroken(block.getType())) { if (BlockChecks.canBeSuperBroken(block)) {
final int MAX_BONUS_LEVEL = 1000; final int MAX_BONUS_LEVEL = 1000;
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);

View File

@ -189,24 +189,24 @@ public class WoodCutting {
Block yPositive = currentBlock.getRelative(0, 1, 0); Block yPositive = currentBlock.getRelative(0, 1, 0);
if (!mcMMO.placeStore.isTrue(currentBlock)) { if (!mcMMO.placeStore.isTrue(currentBlock)) {
if (!isTooAggressive(currentBlock, xPositive) && BlockChecks.treeFellerCompatible(xPositive.getType()) && !toBeFelled.contains(xPositive)) { if (!isTooAggressive(currentBlock, xPositive) && BlockChecks.treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive)) {
processTreeFelling(xPositive, toBeFelled); processTreeFelling(xPositive, toBeFelled);
} }
if (!isTooAggressive(currentBlock, xNegative) && BlockChecks.treeFellerCompatible(xNegative.getType()) && !toBeFelled.contains(xNegative)) { if (!isTooAggressive(currentBlock, xNegative) && BlockChecks.treeFellerCompatible(xNegative) && !toBeFelled.contains(xNegative)) {
processTreeFelling(xNegative, toBeFelled); processTreeFelling(xNegative, toBeFelled);
} }
if (!isTooAggressive(currentBlock, zPositive) && BlockChecks.treeFellerCompatible(zPositive.getType()) && !toBeFelled.contains(zPositive)) { if (!isTooAggressive(currentBlock, zPositive) && BlockChecks.treeFellerCompatible(zPositive) && !toBeFelled.contains(zPositive)) {
processTreeFelling(zPositive, toBeFelled); processTreeFelling(zPositive, toBeFelled);
} }
if (!isTooAggressive(currentBlock, zNegative) && BlockChecks.treeFellerCompatible(zNegative.getType()) && !toBeFelled.contains(zNegative)) { if (!isTooAggressive(currentBlock, zNegative) && BlockChecks.treeFellerCompatible(zNegative) && !toBeFelled.contains(zNegative)) {
processTreeFelling(zNegative, toBeFelled); processTreeFelling(zNegative, toBeFelled);
} }
} }
if (BlockChecks.treeFellerCompatible(yPositive.getType())) { if (BlockChecks.treeFellerCompatible(yPositive)) {
if(!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) { if(!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) {
processTreeFelling(yPositive, toBeFelled); processTreeFelling(yPositive, toBeFelled);
} }

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
@ -9,7 +10,7 @@ public class BlockChecks {
/** /**
* Checks to see if a block type awards XP. * Checks to see if a block type awards XP.
* *
* @param material The type of Block to check * @param block Block to check
* @return true if the block type awards XP, false otherwise * @return true if the block type awards XP, false otherwise
*/ */
public static boolean shouldBeWatched(Material material) { public static boolean shouldBeWatched(Material material) {
@ -56,11 +57,11 @@ public class BlockChecks {
/** /**
* Check if a block should allow for the activation of abilities. * Check if a block should allow for the activation of abilities.
* *
* @param material The type of Block to check * @param block Block to check
* @return true if the block should allow ability activation, false otherwise * @return true if the block should allow ability activation, false otherwise
*/ */
public static boolean abilityBlockCheck(Material material) { public static boolean abilityBlockCheck(Block block) {
switch (material) { switch (block.getType()) {
case BED_BLOCK: case BED_BLOCK:
case BREWING_STAND: case BREWING_STAND:
case BOOKSHELF: case BOOKSHELF:
@ -81,12 +82,9 @@ public class BlockChecks {
case WOODEN_DOOR: case WOODEN_DOOR:
case WORKBENCH: case WORKBENCH:
return false; return false;
default:
break;
} }
if (Material.getMaterial(Config.getInstance().getRepairAnvilId()).equals(material)) { if (block.getTypeId() == Config.getInstance().getRepairAnvilId()) {
return false; return false;
} }
else { else {
@ -97,11 +95,11 @@ public class BlockChecks {
/** /**
* Check if a block type is an ore. * Check if a block type is an ore.
* *
* @param material The type of Block to check * @param block Block to check
* @return true if the Block is an ore, false otherwise * @return true if the Block is an ore, false otherwise
*/ */
public static boolean isOre(Material material) { public static boolean isOre(Block block) {
switch (material) { switch (block.getType()) {
case COAL_ORE: case COAL_ORE:
case DIAMOND_ORE: case DIAMOND_ORE:
case GLOWING_REDSTONE_ORE: case GLOWING_REDSTONE_ORE:
@ -119,15 +117,18 @@ public class BlockChecks {
/** /**
* Check if a block can be made mossy. * Check if a block can be made mossy.
* *
* @param material The type of Block to check * @param block The block to check
* @return true if the block can be made mossy, false otherwise * @return true if the block can be made mossy, false otherwise
*/ */
public static boolean makeMossy(Material type) { public static boolean makeMossy(Block block) {
switch (type) { switch (block.getType()) {
case COBBLESTONE: case COBBLESTONE:
case DIRT: case DIRT:
case SMOOTH_BRICK:
return true; return true;
case SMOOTH_BRICK:
if (block.getData() == 0) {
return true;
}
default: default:
return false; return false;
@ -137,11 +138,11 @@ public class BlockChecks {
/** /**
* Check if a block is affected by Herbalism abilities. * Check if a block is affected by Herbalism abilities.
* *
* @param type The type of Block to check * @param block Block to check
* @return true if the block is affected, false otherwise * @return true if the block is affected, false otherwise
*/ */
public static boolean canBeGreenTerra(Material type){ public static boolean canBeGreenTerra(Block block){
switch (type) { switch (block.getType()) {
case BROWN_MUSHROOM: case BROWN_MUSHROOM:
case CACTUS: case CACTUS:
case CROPS: case CROPS:
@ -164,11 +165,11 @@ public class BlockChecks {
/** /**
* Check to see if a block is broken by Super Breaker. * Check to see if a block is broken by Super Breaker.
* *
* @param type The type of Block to check * @param block Block to check
* @return true if the block would be broken by Super Breaker, false otherwise * @return true if the block would be broken by Super Breaker, false otherwise
*/ */
public static Boolean canBeSuperBroken(Material type) { public static Boolean canBeSuperBroken(Block block) {
switch (type) { switch (block.getType()) {
case COAL_ORE: case COAL_ORE:
case DIAMOND_ORE: case DIAMOND_ORE:
case ENDER_STONE: case ENDER_STONE:
@ -193,11 +194,11 @@ public class BlockChecks {
/** /**
* Check to see if a block can be broken by Giga Drill Breaker. * Check to see if a block can be broken by Giga Drill Breaker.
* *
* @param material The type of block to check * @param block Block to check
* @return * @return true if the block can be broken by Giga Drill Breaker, false otherwise
*/ */
public static boolean canBeGigaDrillBroken(Material type) { public static boolean canBeGigaDrillBroken(Block block) {
switch (type) { switch (block.getType()) {
case CLAY: case CLAY:
case DIRT: case DIRT:
case GRASS: case GRASS:
@ -218,8 +219,8 @@ public class BlockChecks {
* @param block Block to check * @param block Block to check
* @return true if the block is affected by Tree Feller, false otherwise * @return true if the block is affected by Tree Feller, false otherwise
*/ */
public static boolean treeFellerCompatible(Material type) { public static boolean treeFellerCompatible(Block block) {
switch (type) { switch (block.getType()) {
case LOG: case LOG:
case LEAVES: case LEAVES:
case AIR: case AIR:

View File

@ -423,7 +423,7 @@ public class Skills {
/* FALLS THROUGH */ /* FALLS THROUGH */
case GREEN_TERRA: case GREEN_TERRA:
if (!ability.blockCheck(block.getType())) { if (!ability.blockCheck(block)) {
activate = false; activate = false;
break; break;
} }