mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
More deprecation fixes.
This commit is contained in:
parent
fd8d9b02a9
commit
d2bbbb0fe7
@ -443,7 +443,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
/* BLAST MINING CHECK */
|
||||
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
|
||||
}
|
||||
else {
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.material.SmoothBrick;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
@ -37,10 +38,13 @@ public class Herbalism {
|
||||
protected static boolean convertGreenTerraBlocks(BlockState blockState) {
|
||||
switch (blockState.getType()) {
|
||||
case COBBLE_WALL:
|
||||
case SMOOTH_BRICK:
|
||||
blockState.setRawData((byte) 0x1);
|
||||
return true;
|
||||
|
||||
case SMOOTH_BRICK:
|
||||
((SmoothBrick) blockState.getData()).setMaterial(Material.MOSSY_COBBLESTONE);
|
||||
return true;
|
||||
|
||||
case DIRT:
|
||||
blockState.setType(Material.GRASS);
|
||||
return true;
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.material.CocoaPlant;
|
||||
import org.bukkit.material.CocoaPlant.CocoaPlantSize;
|
||||
import org.bukkit.material.Crops;
|
||||
import org.bukkit.material.NetherWarts;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -294,15 +295,41 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
private boolean handleBlockState(BlockState blockState, boolean greenTerra) {
|
||||
byte greenThumbStage = getGreenThumbStage();
|
||||
|
||||
switch (blockState.getType()) {
|
||||
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 POTATO:
|
||||
if (greenTerra) {
|
||||
blockState.setRawData(CropState.MEDIUM.getData()); // 2
|
||||
blockState.setRawData(CropState.MEDIUM.getData());
|
||||
}
|
||||
else {
|
||||
blockState.setRawData(getGreenThumbStage());
|
||||
blockState.setRawData(greenThumbStage);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -310,13 +337,7 @@ public class HerbalismManager extends SkillManager {
|
||||
case NETHER_WARTS:
|
||||
NetherWarts warts = (NetherWarts) blockState.getData();
|
||||
|
||||
if (greenTerra) {
|
||||
warts.setState(NetherWartsState.STAGE_TWO);
|
||||
}
|
||||
else {
|
||||
int greenThumbStage = getGreenThumbStage();
|
||||
|
||||
if (greenThumbStage > 2) {
|
||||
if (greenTerra || greenThumbStage > 2) {
|
||||
warts.setState(NetherWartsState.STAGE_TWO);
|
||||
}
|
||||
else if (greenThumbStage == 2) {
|
||||
@ -325,7 +346,6 @@ public class HerbalismManager extends SkillManager {
|
||||
else {
|
||||
warts.setState(NetherWartsState.SEEDED);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.skills.repair;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
@ -102,7 +103,7 @@ public class Repair {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.getTypeId() == itemId && item.getData().getData() == metadata) {
|
||||
if (item.getData().equals(new MaterialData(itemId, metadata))) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import org.bukkit.Material;
|
||||
import org.bukkit.NetherWartsState;
|
||||
import org.bukkit.block.BlockState;
|
||||
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.NetherWarts;
|
||||
|
||||
@ -103,6 +105,8 @@ public final class BlockUtils {
|
||||
return true;
|
||||
|
||||
case SMOOTH_BRICK:
|
||||
return ((SmoothBrick) blockState.getData()).getMaterial() == Material.STONE;
|
||||
|
||||
case COBBLE_WALL:
|
||||
return blockState.getRawData() == (byte) 0x0;
|
||||
|
||||
@ -132,10 +136,12 @@ public final class BlockUtils {
|
||||
return true;
|
||||
|
||||
case CARROT:
|
||||
case CROPS:
|
||||
case POTATO:
|
||||
return blockState.getRawData() == CropState.RIPE.getData();
|
||||
|
||||
case CROPS:
|
||||
return ((Crops) blockState.getData()).getState() == CropState.RIPE;
|
||||
|
||||
case NETHER_WARTS:
|
||||
return ((NetherWarts) blockState.getData()).getState() == NetherWartsState.RIPE;
|
||||
|
||||
@ -281,7 +287,7 @@ public final class BlockUtils {
|
||||
public static boolean affectedByBlockCracker(BlockState blockState) {
|
||||
switch (blockState.getType()) {
|
||||
case SMOOTH_BRICK:
|
||||
return blockState.getRawData() == (byte) 0x0;
|
||||
return ((SmoothBrick) blockState.getData()).getMaterial() == Material.STONE;
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
@ -142,8 +142,7 @@ public final class ChimaeraWing {
|
||||
}
|
||||
|
||||
public static ItemStack getChimaeraWing(int amount) {
|
||||
Material ingredient = Material.getMaterial(Config.getInstance().getChimaeraItemId());
|
||||
ItemStack itemStack = new ItemStack(ingredient, amount);
|
||||
ItemStack itemStack = new ItemStack(Config.getInstance().getChimaeraItemId(), amount);
|
||||
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
|
||||
@ -164,8 +163,8 @@ public final class ChimaeraWing {
|
||||
amount = 9;
|
||||
}
|
||||
|
||||
ShapelessRecipe ChimaeraWing = new ShapelessRecipe(getChimaeraWing(1));
|
||||
ChimaeraWing.addIngredient(amount, ingredient);
|
||||
return ChimaeraWing;
|
||||
ShapelessRecipe chimeraWing = new ShapelessRecipe(getChimaeraWing(1));
|
||||
chimeraWing.addIngredient(amount, ingredient);
|
||||
return chimeraWing;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user