mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Fixed ItemStack deprecation issues.
This commit is contained in:
parent
5e965aec2c
commit
9af66a8e69
@ -12,6 +12,7 @@ Version 1.3.13-dev
|
|||||||
= Fixed issue with missing default cases from several switch/case statements
|
= Fixed issue with missing default cases from several switch/case statements
|
||||||
= Fixed issue with Mining using actual skill level rather than max skill level
|
= Fixed issue with Mining using actual skill level rather than max skill level
|
||||||
= Fixed some issues with static access
|
= Fixed some issues with static access
|
||||||
|
= Fixed ItemStack deprecation issues
|
||||||
! GJ stopped being a lazy slacker and got stuff done
|
! GJ stopped being a lazy slacker and got stuff done
|
||||||
- Removed dead code relating to null profiles
|
- Removed dead code relating to null profiles
|
||||||
- Removed unused imports
|
- Removed unused imports
|
||||||
|
@ -11,6 +11,7 @@ import java.util.Set;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||||
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
||||||
@ -125,7 +126,8 @@ public class TreasuresConfig extends ConfigLoader{
|
|||||||
* Drops From & Max Level
|
* Drops From & Max Level
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ItemStack item = new ItemStack(id, amount, (short) 0, (byte) data);
|
ItemStack item = new ItemStack(id, amount, (short) 0);
|
||||||
|
item.setData(new MaterialData(id, (byte) data));
|
||||||
|
|
||||||
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
||||||
if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
|
if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
|
||||||
|
@ -7,6 +7,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||||
@ -78,7 +79,9 @@ public class CustomBlocksConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (skillType.equals("Ability_Blocks")) {
|
if (skillType.equals("Ability_Blocks")) {
|
||||||
blockItem = new ItemStack(id, 1, (short) 0, data);
|
blockItem = new ItemStack(id, 1, (short) 0);
|
||||||
|
blockItem.setData(new MaterialData(id, data));
|
||||||
|
|
||||||
blockList.add(blockItem);
|
blockList.add(blockItem);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -89,14 +92,17 @@ public class CustomBlocksConfig extends ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dropItem) {
|
if (dropItem) {
|
||||||
itemDrop = new ItemStack(dropID, 1, (short) 0, dropData);
|
itemDrop = new ItemStack(dropID, 1, (short) 0);
|
||||||
|
itemDrop.setData(new MaterialData(dropID, dropData));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
itemDrop = new ItemStack(id, 1, (short) 0, data);
|
itemDrop = new ItemStack(id, 1, (short) 0);
|
||||||
|
itemDrop.setData(new MaterialData(id, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
block = new CustomBlock(minimumDropAmount, maxiumDropAmount, itemDrop, tier, xp, data, id);
|
block = new CustomBlock(minimumDropAmount, maxiumDropAmount, itemDrop, tier, xp, data, id);
|
||||||
blockItem = new ItemStack(id, 1, (short) 0, data);
|
blockItem = new ItemStack(id, 1, (short) 0);
|
||||||
|
blockItem.setData(new MaterialData(id, data));
|
||||||
|
|
||||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
||||||
customOres.add(blockItem);
|
customOres.add(blockItem);
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
import org.getspout.spoutapi.sound.SoundEffect;
|
import org.getspout.spoutapi.sound.SoundEffect;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -51,7 +52,10 @@ public class Excavation {
|
|||||||
|
|
||||||
int xp;
|
int xp;
|
||||||
|
|
||||||
if (Config.getInstance().getBlockModsEnabled() && 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 (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
|
||||||
xp = ModChecks.getCustomBlock(block).getXpGain();
|
xp = ModChecks.getCustomBlock(block).getXpGain();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -17,6 +17,7 @@ import org.bukkit.entity.Skeleton;
|
|||||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
import org.bukkit.material.Wool;
|
import org.bukkit.material.Wool;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
@ -284,8 +285,7 @@ public class Fishing {
|
|||||||
|
|
||||||
case CREEPER:
|
case CREEPER:
|
||||||
if (DROP_NUMBER > 97) {
|
if (DROP_NUMBER > 97) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM,
|
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 4));
|
||||||
1, (short) 4));
|
|
||||||
} else {
|
} else {
|
||||||
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
|
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
|
||||||
}
|
}
|
||||||
@ -321,17 +321,14 @@ public class Fishing {
|
|||||||
if (DROP_NUMBER > 95) {
|
if (DROP_NUMBER > 95) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
|
Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
|
||||||
} else if (DROP_NUMBER > 90) {
|
} else if (DROP_NUMBER > 90) {
|
||||||
Misc.dropItem(location, new ItemStack(
|
Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP));
|
||||||
Material.MUSHROOM_SOUP));
|
|
||||||
} else if (DROP_NUMBER > 60) {
|
} else if (DROP_NUMBER > 60) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.LEATHER));
|
Misc.dropItem(location, new ItemStack(Material.LEATHER));
|
||||||
} else if (DROP_NUMBER > 30) {
|
} else if (DROP_NUMBER > 30) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
|
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
|
||||||
} else {
|
} else {
|
||||||
Misc.dropItem(location,
|
Misc.dropItem(location, new ItemStack(Material.RED_MUSHROOM));
|
||||||
new ItemStack(Material.RED_MUSHROOM));
|
Misc.randomDropItems(location, new ItemStack(Material.RED_MUSHROOM), 50, 2);
|
||||||
Misc.randomDropItems(location, new ItemStack(
|
|
||||||
Material.RED_MUSHROOM), 50, 2);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -341,8 +338,7 @@ public class Fishing {
|
|||||||
|
|
||||||
case PIG_ZOMBIE:
|
case PIG_ZOMBIE:
|
||||||
if (DROP_NUMBER > 50) {
|
if (DROP_NUMBER > 50) {
|
||||||
Misc.dropItem(location,
|
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
|
||||||
new ItemStack(Material.ROTTEN_FLESH));
|
|
||||||
} else {
|
} else {
|
||||||
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
|
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
|
||||||
}
|
}
|
||||||
@ -366,25 +362,21 @@ public class Fishing {
|
|||||||
case SKELETON:
|
case SKELETON:
|
||||||
if (((Skeleton) le).getSkeletonType() == SkeletonType.WITHER) {
|
if (((Skeleton) le).getSkeletonType() == SkeletonType.WITHER) {
|
||||||
if (DROP_NUMBER > 97) {
|
if (DROP_NUMBER > 97) {
|
||||||
Misc.dropItem(location, new ItemStack(
|
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 1));
|
||||||
Material.SKULL_ITEM, 1, (short) 1));
|
|
||||||
} else if (DROP_NUMBER > 50) {
|
} else if (DROP_NUMBER > 50) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.BONE));
|
Misc.dropItem(location, new ItemStack(Material.BONE));
|
||||||
} else {
|
} else {
|
||||||
Misc.dropItem(location, new ItemStack(Material.COAL));
|
Misc.dropItem(location, new ItemStack(Material.COAL));
|
||||||
Misc.randomDropItems(location, new ItemStack(
|
Misc.randomDropItems(location, new ItemStack(Material.COAL), 50, 2);
|
||||||
Material.COAL), 50, 2);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (DROP_NUMBER > 97) {
|
if (DROP_NUMBER > 97) {
|
||||||
Misc.dropItem(location, new ItemStack(
|
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM));
|
||||||
Material.SKULL_ITEM));
|
|
||||||
} else if (DROP_NUMBER > 50) {
|
} else if (DROP_NUMBER > 50) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.BONE));
|
Misc.dropItem(location, new ItemStack(Material.BONE));
|
||||||
} else {
|
} else {
|
||||||
Misc.dropItem(location, new ItemStack(Material.ARROW));
|
Misc.dropItem(location, new ItemStack(Material.ARROW));
|
||||||
Misc.randomDropItems(location, new ItemStack(
|
Misc.randomDropItems(location, new ItemStack(Material.ARROW), 50, 2);
|
||||||
Material.ARROW), 50, 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -398,8 +390,7 @@ public class Fishing {
|
|||||||
Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
|
Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
|
||||||
} else {
|
} else {
|
||||||
Misc.dropItem(location, new ItemStack(Material.SNOW_BALL));
|
Misc.dropItem(location, new ItemStack(Material.SNOW_BALL));
|
||||||
Misc.randomDropItems(location, new ItemStack(
|
Misc.randomDropItems(location, new ItemStack(Material.SNOW_BALL), 50, 4);
|
||||||
Material.SNOW_BALL), 50, 4);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -412,38 +403,33 @@ public class Fishing {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SQUID:
|
case SQUID:
|
||||||
Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1,
|
ItemStack item = new ItemStack(Material.INK_SACK, 1, (short) 0);
|
||||||
(short) 0));
|
item.setData(new MaterialData(Material.INK_SACK, (byte) 0x0));
|
||||||
|
|
||||||
|
Misc.dropItem(location, item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WITCH:
|
case WITCH:
|
||||||
final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1;
|
final int DROP_NUMBER_2 = random.nextInt(randomChance) + 1;
|
||||||
if (DROP_NUMBER > 95) {
|
if (DROP_NUMBER > 95) {
|
||||||
if (DROP_NUMBER_2 > 66) {
|
if (DROP_NUMBER_2 > 66) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.POTION,
|
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8197));
|
||||||
1, (short) 8197));
|
|
||||||
} else if (DROP_NUMBER_2 > 33) {
|
} else if (DROP_NUMBER_2 > 33) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.POTION,
|
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8195));
|
||||||
1, (short) 8195));
|
|
||||||
} else {
|
} else {
|
||||||
Misc.dropItem(location, new ItemStack(Material.POTION,
|
Misc.dropItem(location, new ItemStack(Material.POTION, 1, (short) 8194));
|
||||||
1, (short) 8194));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (DROP_NUMBER_2 > 88) {
|
if (DROP_NUMBER_2 > 88) {
|
||||||
Misc.dropItem(location, new ItemStack(
|
Misc.dropItem(location, new ItemStack(Material.GLASS_BOTTLE));
|
||||||
Material.GLASS_BOTTLE));
|
|
||||||
} else if (DROP_NUMBER_2 > 75) {
|
} else if (DROP_NUMBER_2 > 75) {
|
||||||
Misc.dropItem(location, new ItemStack(
|
Misc.dropItem(location, new ItemStack(Material.GLOWSTONE_DUST));
|
||||||
Material.GLOWSTONE_DUST));
|
|
||||||
} else if (DROP_NUMBER_2 > 63) {
|
} else if (DROP_NUMBER_2 > 63) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
|
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
|
||||||
} else if (DROP_NUMBER_2 > 50) {
|
} else if (DROP_NUMBER_2 > 50) {
|
||||||
Misc.dropItem(location,
|
Misc.dropItem(location, new ItemStack(Material.REDSTONE));
|
||||||
new ItemStack(Material.REDSTONE));
|
|
||||||
} else if (DROP_NUMBER_2 > 38) {
|
} else if (DROP_NUMBER_2 > 38) {
|
||||||
Misc.dropItem(location, new ItemStack(
|
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
|
||||||
Material.SPIDER_EYE));
|
|
||||||
} else if (DROP_NUMBER_2 > 25) {
|
} else if (DROP_NUMBER_2 > 25) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.STICK));
|
Misc.dropItem(location, new ItemStack(Material.STICK));
|
||||||
} else if (DROP_NUMBER_2 > 13) {
|
} else if (DROP_NUMBER_2 > 13) {
|
||||||
@ -456,11 +442,9 @@ public class Fishing {
|
|||||||
|
|
||||||
case ZOMBIE:
|
case ZOMBIE:
|
||||||
if (DROP_NUMBER > 97) {
|
if (DROP_NUMBER > 97) {
|
||||||
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM,
|
Misc.dropItem(location, new ItemStack(Material.SKULL_ITEM, 1, (short) 2));
|
||||||
1, (short) 2));
|
|
||||||
} else {
|
} else {
|
||||||
Misc.dropItem(location,
|
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
|
||||||
new ItemStack(Material.ROTTEN_FLESH));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
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.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
@ -240,7 +241,10 @@ public class Herbalism {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (Config.getInstance().getBlockModsEnabled() && 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 (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
|
||||||
customPlant = true;
|
customPlant = true;
|
||||||
xp = ModChecks.getCustomBlock(block).getXpGain();
|
xp = ModChecks.getCustomBlock(block).getXpGain();
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
import org.getspout.spoutapi.sound.SoundEffect;
|
import org.getspout.spoutapi.sound.SoundEffect;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -96,7 +97,10 @@ public class Mining {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (ModChecks.isCustomMiningBlock(block)) {
|
if (ModChecks.isCustomMiningBlock(block)) {
|
||||||
Misc.dropItem(location, new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()));
|
ItemStack dropItem = new ItemStack(block.getTypeId(), 1, (short) 0);
|
||||||
|
dropItem.setData(new MaterialData(block.getTypeId(), block.getData()));
|
||||||
|
|
||||||
|
Misc.dropItem(location, dropItem);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -117,7 +121,9 @@ public class Mining {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case COAL_ORE:
|
case COAL_ORE:
|
||||||
if (configInstance.getCoalDoubleDropsEnabled()) {
|
if (configInstance.getCoalDoubleDropsEnabled()) {
|
||||||
item = new ItemStack(Material.COAL, 1, (short) 0, CoalType.COAL.getData());
|
item = new ItemStack(Material.COAL, 1, (short) 0);
|
||||||
|
item.setData(new MaterialData(Material.COAL, CoalType.COAL.getData()));
|
||||||
|
|
||||||
Misc.dropItem(location, item);
|
Misc.dropItem(location, item);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -166,7 +172,9 @@ public class Mining {
|
|||||||
|
|
||||||
case LAPIS_ORE:
|
case LAPIS_ORE:
|
||||||
if (configInstance.getLapisDoubleDropsEnabled()) {
|
if (configInstance.getLapisDoubleDropsEnabled()) {
|
||||||
item = new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x4);
|
item = new ItemStack(Material.INK_SACK, 1, (short) 0);
|
||||||
|
item.setData(new MaterialData(Material.INK_SACK, (byte) 0x4));
|
||||||
|
|
||||||
Misc.dropItems(location, item, 4);
|
Misc.dropItems(location, item, 4);
|
||||||
Misc.randomDropItems(location, item, 50, 4);
|
Misc.randomDropItems(location, item, 50, 4);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
import org.bukkit.material.Tree;
|
import org.bukkit.material.Tree;
|
||||||
import org.getspout.spoutapi.sound.SoundEffect;
|
import org.getspout.spoutapi.sound.SoundEffect;
|
||||||
|
|
||||||
@ -97,11 +98,15 @@ public class WoodCutting {
|
|||||||
|
|
||||||
//Prepare ItemStacks
|
//Prepare ItemStacks
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
ItemStack oak = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.GENERIC.getData());
|
ItemStack oak = new ItemStack(Material.LOG, 1, (short) 0);
|
||||||
ItemStack spruce = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.REDWOOD.getData());
|
ItemStack spruce = new ItemStack(Material.LOG, 1, (short) 0);
|
||||||
ItemStack birch = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.BIRCH.getData());
|
ItemStack birch = new ItemStack(Material.LOG, 1, (short) 0);
|
||||||
ItemStack jungle = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.JUNGLE.getData());
|
ItemStack jungle = new ItemStack(Material.LOG, 1, (short) 0);
|
||||||
|
|
||||||
|
oak.setData(new MaterialData(Material.LOG, TreeSpecies.GENERIC.getData()));
|
||||||
|
spruce.setData(new MaterialData(Material.LOG, TreeSpecies.REDWOOD.getData()));
|
||||||
|
birch.setData(new MaterialData(Material.LOG, TreeSpecies.BIRCH.getData()));
|
||||||
|
jungle.setData(new MaterialData(Material.LOG, TreeSpecies.JUNGLE.getData()));
|
||||||
for (Block x : toBeFelled) {
|
for (Block x : toBeFelled) {
|
||||||
if (Misc.blockBreakSimulate(x, player, true)) {
|
if (Misc.blockBreakSimulate(x, player, true)) {
|
||||||
if (Config.getInstance().getBlockModsEnabled()) {
|
if (Config.getInstance().getBlockModsEnabled()) {
|
||||||
@ -204,7 +209,9 @@ public class WoodCutting {
|
|||||||
else if (x.getType() == Material.LEAVES) {
|
else if (x.getType() == Material.LEAVES) {
|
||||||
final int SAPLING_DROP_CHANCE = 10;
|
final int SAPLING_DROP_CHANCE = 10;
|
||||||
|
|
||||||
item = new ItemStack(Material.SAPLING, 1, (short) 0, (byte) (x.getData() & 3)); //Drop the right type of sapling
|
item = new ItemStack(Material.SAPLING, 1, (short) 0);
|
||||||
|
item.setData(new MaterialData(Material.SAPLING, (byte) (x.getData() & 3))); //Drop the right type of sapling
|
||||||
|
|
||||||
Misc.randomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
Misc.randomDropItem(x.getLocation(), item, SAPLING_DROP_CHANCE);
|
||||||
|
|
||||||
//Remove the block
|
//Remove the block
|
||||||
@ -373,7 +380,9 @@ public class WoodCutting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
item = new ItemStack(mat, 1, (short) 0, type);
|
item = new ItemStack(mat, 1, (short) 0);
|
||||||
|
item.setData(new MaterialData(mat, type));
|
||||||
|
|
||||||
location = block.getLocation();
|
location = block.getLocation();
|
||||||
|
|
||||||
TreeSpecies species = TreeSpecies.getByData(type);
|
TreeSpecies species = TreeSpecies.getByData(type);
|
||||||
|
@ -4,6 +4,7 @@ import org.bukkit.CropState;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.mods.CustomBlocksConfig;
|
import com.gmail.nossr50.config.mods.CustomBlocksConfig;
|
||||||
@ -59,7 +60,10 @@ public class BlockChecks {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -75,7 +79,10 @@ public class BlockChecks {
|
|||||||
* @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(Block block) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +204,10 @@ public class BlockChecks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -232,7 +242,10 @@ public class BlockChecks {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -259,7 +272,10 @@ public class BlockChecks {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -282,7 +298,10 @@ public class BlockChecks {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.util;
|
|||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
||||||
@ -48,7 +49,10 @@ public class ModChecks {
|
|||||||
* @return the block if it exists, null otherwise
|
* @return the block if it exists, null otherwise
|
||||||
*/
|
*/
|
||||||
public static CustomBlock getCustomBlock(Block block) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +72,10 @@ public class ModChecks {
|
|||||||
* @return true if the block is custom, false otherwise
|
* @return true if the block is custom, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isCustomMiningBlock(Block block) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -83,7 +90,10 @@ public class ModChecks {
|
|||||||
* @return true if the block represents leaves, false otherwise
|
* @return true if the block represents leaves, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isCustomLeafBlock(Block block) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -98,7 +108,10 @@ public class ModChecks {
|
|||||||
* @return true if the block represents a log, false otherwise
|
* @return true if the block represents a log, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isCustomLogBlock(Block block) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -113,7 +126,10 @@ public class ModChecks {
|
|||||||
* @return true if the block represents an ore, false otherwise
|
* @return true if the block represents an ore, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isCustomOreBlock(Block block) {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user