mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-27 19:24:44 +02:00
Fixed ItemStack deprecation issues.
This commit is contained in:
@ -4,6 +4,7 @@ import org.bukkit.CropState;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.mods.CustomBlocksConfig;
|
||||
@ -59,7 +60,10 @@ public class BlockChecks {
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -75,7 +79,10 @@ public class BlockChecks {
|
||||
* @return true if the block should allow ability activation, false otherwise
|
||||
*/
|
||||
public static boolean abilityBlockCheck(Block block) {
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customAbilityBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customAbilityBlocks.contains(item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -197,7 +204,10 @@ public class BlockChecks {
|
||||
}
|
||||
|
||||
default:
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -232,7 +242,10 @@ public class BlockChecks {
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -259,7 +272,10 @@ public class BlockChecks {
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -282,7 +298,10 @@ public class BlockChecks {
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.util;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
||||
@ -48,7 +49,10 @@ public class ModChecks {
|
||||
* @return the block if it exists, null otherwise
|
||||
*/
|
||||
public static CustomBlock getCustomBlock(Block block) {
|
||||
if (!blocksInstance.customItems.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (!blocksInstance.customItems.contains(item)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -68,7 +72,10 @@ public class ModChecks {
|
||||
* @return true if the block is custom, false otherwise
|
||||
*/
|
||||
public static boolean isCustomMiningBlock(Block block) {
|
||||
if (customBlocksEnabled && blocksInstance.customMiningBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (customBlocksEnabled && blocksInstance.customMiningBlocks.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -83,7 +90,10 @@ public class ModChecks {
|
||||
* @return true if the block represents leaves, false otherwise
|
||||
*/
|
||||
public static boolean isCustomLeafBlock(Block block) {
|
||||
if (blocksInstance.customLeaves.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (blocksInstance.customLeaves.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -98,7 +108,10 @@ public class ModChecks {
|
||||
* @return true if the block represents a log, false otherwise
|
||||
*/
|
||||
public static boolean isCustomLogBlock(Block block) {
|
||||
if (blocksInstance.customLogs.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (blocksInstance.customLogs.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@ -113,7 +126,10 @@ public class ModChecks {
|
||||
* @return true if the block represents an ore, false otherwise
|
||||
*/
|
||||
public static boolean isCustomOreBlock(Block block) {
|
||||
if (blocksInstance.customOres.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) {
|
||||
ItemStack item = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||
item.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||
|
||||
if (blocksInstance.customOres.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user