More deprecation fixes.

This commit is contained in:
GJ 2013-09-05 16:36:02 -04:00
parent fd8d9b02a9
commit d2bbbb0fe7
6 changed files with 54 additions and 24 deletions

View File

@ -443,7 +443,7 @@ public class PlayerListener implements Listener {
} }
/* BLAST MINING CHECK */ /* BLAST MINING CHECK */
else if (miningManager.canDetonate()) { else if (miningManager.canDetonate()) {
if (blockID == Material.TNT.getId()) { if (block.getType() == Material.TNT) {
event.setCancelled(true); // Don't detonate the TNT if they're too close event.setCancelled(true); // Don't detonate the TNT if they're too close
} }
else { else {

View File

@ -4,6 +4,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.material.SmoothBrick;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
@ -37,10 +38,13 @@ public class Herbalism {
protected static boolean convertGreenTerraBlocks(BlockState blockState) { protected static boolean convertGreenTerraBlocks(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
case COBBLE_WALL: case COBBLE_WALL:
case SMOOTH_BRICK:
blockState.setRawData((byte) 0x1); blockState.setRawData((byte) 0x1);
return true; return true;
case SMOOTH_BRICK:
((SmoothBrick) blockState.getData()).setMaterial(Material.MOSSY_COBBLESTONE);
return true;
case DIRT: case DIRT:
blockState.setType(Material.GRASS); blockState.setType(Material.GRASS);
return true; return true;

View File

@ -12,6 +12,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.bukkit.material.CocoaPlant; import org.bukkit.material.CocoaPlant;
import org.bukkit.material.CocoaPlant.CocoaPlantSize; import org.bukkit.material.CocoaPlant.CocoaPlantSize;
import org.bukkit.material.Crops;
import org.bukkit.material.NetherWarts; import org.bukkit.material.NetherWarts;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@ -294,15 +295,41 @@ public class HerbalismManager extends SkillManager {
} }
private boolean handleBlockState(BlockState blockState, boolean greenTerra) { private boolean handleBlockState(BlockState blockState, boolean greenTerra) {
byte greenThumbStage = getGreenThumbStage();
switch (blockState.getType()) { switch (blockState.getType()) {
case CROPS: case CROPS:
Crops crops = (Crops) blockState.getData();
if (greenTerra) {
crops.setState(CropState.MEDIUM);
}
else {
switch (greenThumbStage) {
case 4:
crops.setState(CropState.SMALL);
break;
case 3:
crops.setState(CropState.VERY_SMALL);
break;
case 2:
crops.setState(CropState.GERMINATED);
break;
default:
crops.setState(CropState.SEEDED);
break;
}
}
return true;
case CARROT: case CARROT:
case POTATO: case POTATO:
if (greenTerra) { if (greenTerra) {
blockState.setRawData(CropState.MEDIUM.getData()); // 2 blockState.setRawData(CropState.MEDIUM.getData());
} }
else { else {
blockState.setRawData(getGreenThumbStage()); blockState.setRawData(greenThumbStage);
} }
return true; return true;
@ -310,21 +337,14 @@ public class HerbalismManager extends SkillManager {
case NETHER_WARTS: case NETHER_WARTS:
NetherWarts warts = (NetherWarts) blockState.getData(); NetherWarts warts = (NetherWarts) blockState.getData();
if (greenTerra) { if (greenTerra || greenThumbStage > 2) {
warts.setState(NetherWartsState.STAGE_TWO); warts.setState(NetherWartsState.STAGE_TWO);
} }
else if (greenThumbStage == 2) {
warts.setState(NetherWartsState.STAGE_ONE);
}
else { else {
int greenThumbStage = getGreenThumbStage(); warts.setState(NetherWartsState.SEEDED);
if (greenThumbStage > 2) {
warts.setState(NetherWartsState.STAGE_TWO);
}
else if (greenThumbStage == 2) {
warts.setState(NetherWartsState.STAGE_ONE);
}
else {
warts.setState(NetherWartsState.SEEDED);
}
} }
return true; return true;

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.repair;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.bukkit.material.MaterialData;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
@ -102,7 +103,7 @@ public class Repair {
continue; continue;
} }
if (item.getTypeId() == itemId && item.getData().getData() == metadata) { if (item.getData().equals(new MaterialData(itemId, metadata))) {
return i; return i;
} }
} }

View File

@ -7,6 +7,8 @@ import org.bukkit.Material;
import org.bukkit.NetherWartsState; import org.bukkit.NetherWartsState;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.material.CocoaPlant; import org.bukkit.material.CocoaPlant;
import org.bukkit.material.Crops;
import org.bukkit.material.SmoothBrick;
import org.bukkit.material.CocoaPlant.CocoaPlantSize; import org.bukkit.material.CocoaPlant.CocoaPlantSize;
import org.bukkit.material.NetherWarts; import org.bukkit.material.NetherWarts;
@ -103,6 +105,8 @@ public final class BlockUtils {
return true; return true;
case SMOOTH_BRICK: case SMOOTH_BRICK:
return ((SmoothBrick) blockState.getData()).getMaterial() == Material.STONE;
case COBBLE_WALL: case COBBLE_WALL:
return blockState.getRawData() == (byte) 0x0; return blockState.getRawData() == (byte) 0x0;
@ -132,10 +136,12 @@ public final class BlockUtils {
return true; return true;
case CARROT: case CARROT:
case CROPS:
case POTATO: case POTATO:
return blockState.getRawData() == CropState.RIPE.getData(); return blockState.getRawData() == CropState.RIPE.getData();
case CROPS:
return ((Crops) blockState.getData()).getState() == CropState.RIPE;
case NETHER_WARTS: case NETHER_WARTS:
return ((NetherWarts) blockState.getData()).getState() == NetherWartsState.RIPE; return ((NetherWarts) blockState.getData()).getState() == NetherWartsState.RIPE;
@ -281,7 +287,7 @@ public final class BlockUtils {
public static boolean affectedByBlockCracker(BlockState blockState) { public static boolean affectedByBlockCracker(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
case SMOOTH_BRICK: case SMOOTH_BRICK:
return blockState.getRawData() == (byte) 0x0; return ((SmoothBrick) blockState.getData()).getMaterial() == Material.STONE;
default: default:
return false; return false;

View File

@ -142,8 +142,7 @@ public final class ChimaeraWing {
} }
public static ItemStack getChimaeraWing(int amount) { public static ItemStack getChimaeraWing(int amount) {
Material ingredient = Material.getMaterial(Config.getInstance().getChimaeraItemId()); ItemStack itemStack = new ItemStack(Config.getInstance().getChimaeraItemId(), amount);
ItemStack itemStack = new ItemStack(ingredient, amount);
ItemMeta itemMeta = itemStack.getItemMeta(); ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name")); itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
@ -164,8 +163,8 @@ public final class ChimaeraWing {
amount = 9; amount = 9;
} }
ShapelessRecipe ChimaeraWing = new ShapelessRecipe(getChimaeraWing(1)); ShapelessRecipe chimeraWing = new ShapelessRecipe(getChimaeraWing(1));
ChimaeraWing.addIngredient(amount, ingredient); chimeraWing.addIngredient(amount, ingredient);
return ChimaeraWing; return chimeraWing;
} }
} }