Fixed Green Thumb consuming 2 seeds instead of 1

This commit is contained in:
nossr50 2012-04-28 20:22:17 -07:00
parent 4840b435f5
commit 859d4f5372
2 changed files with 19 additions and 13 deletions

View File

@ -14,6 +14,7 @@ Version 1.3.06
+ Added API functions for admin & party chat + Added API functions for admin & party chat
+ Added Iron Grip skill to Unarmed which gives players an chance to keep from being disarmed. + Added Iron Grip skill to Unarmed which gives players an chance to keep from being disarmed.
+ Added some new languages to the locale files. + Added some new languages to the locale files.
= Fixed Green Thumb consuming 2 seeds instead of 1
= Fixed exploit where you could teleport to yourself with PTP to prevent things like fall damage = Fixed exploit where you could teleport to yourself with PTP to prevent things like fall damage
= Fixed NPE error with Metrics on startup = Fixed NPE error with Metrics on startup
= Fixed bug where Herbalism required double drops permission to give XP = Fixed bug where Herbalism required double drops permission to give XP

View File

@ -35,7 +35,6 @@ public class Herbalism {
public static void greenTerra(Player player, Block block) { public static void greenTerra(Player player, Block block) {
PlayerInventory inventory = player.getInventory(); PlayerInventory inventory = player.getInventory();
boolean hasSeeds = inventory.contains(Material.SEEDS); boolean hasSeeds = inventory.contains(Material.SEEDS);
Material type = block.getType();
if (!hasSeeds) { if (!hasSeeds) {
player.sendMessage("You need more seeds to spread Green Terra"); //TODO: Needs more locale. player.sendMessage("You need more seeds to spread Green Terra"); //TODO: Needs more locale.
@ -43,17 +42,23 @@ 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(); player.updateInventory();
greenTerraConvert(player, block);
if (Misc.blockBreakSimulate(block, player, false)) {
if (Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy() && type.equals(Material.SMOOTH_BRICK)) { }
block.setData((byte) 0x1); //Set type of the brick to mossy }
}
else if (Config.getInstance().getHerbalismGreenThumbDirtToGrass() && type.equals(Material.DIRT)) { public static void greenTerraConvert(Player player, Block block) {
block.setType(Material.GRASS); Material type = block.getType();
}
else if (Config.getInstance().getHerbalismGreenThumbCobbleToMossy() && type.equals(Material.COBBLESTONE)) { if (Misc.blockBreakSimulate(block, player, false)) {
block.setType(Material.MOSSY_COBBLESTONE); if (Config.getInstance().getHerbalismGreenThumbSmoothbrickToMossy() && type.equals(Material.SMOOTH_BRICK)) {
} block.setData((byte) 0x1); //Set type of the brick to mossy
}
else if (Config.getInstance().getHerbalismGreenThumbDirtToGrass() && type.equals(Material.DIRT)) {
block.setType(Material.GRASS);
}
else if (Config.getInstance().getHerbalismGreenThumbCobbleToMossy() && type.equals(Material.COBBLESTONE)) {
block.setType(Material.MOSSY_COBBLESTONE);
} }
} }
} }
@ -302,7 +307,7 @@ public class Herbalism {
player.setItemInHand(new ItemStack(Material.SEEDS, seeds - 1)); player.setItemInHand(new ItemStack(Material.SEEDS, seeds - 1));
if (skillLevel > MAX_BONUS_LEVEL || random.nextInt(1500) <= skillLevel) { if (skillLevel > MAX_BONUS_LEVEL || random.nextInt(1500) <= skillLevel) {
greenTerra(player, block); greenTerraConvert(player, block);
} }
else { else {
player.sendMessage(LocaleLoader.getString("mcPlayerListener.GreenThumbFail")); player.sendMessage(LocaleLoader.getString("mcPlayerListener.GreenThumbFail"));