No longer need to specify amount if creating ItemStack of 1 item.

This commit is contained in:
GJ 2012-03-16 13:45:30 -04:00
parent be4abefd55
commit ed65842e3d
6 changed files with 58 additions and 58 deletions

View File

@ -117,7 +117,7 @@ public class LoadTreasures {
if(dropChance < 0) reason.add("Invalid Drop_Chance: " + dropChance); if(dropChance < 0) reason.add("Invalid Drop_Chance: " + dropChance);
if(dropLevel < 0) reason.add("Invalid Drop_Level: " + dropLevel); if(dropLevel < 0) reason.add("Invalid Drop_Level: " + dropLevel);
ItemStack item = new ItemStack(id, amount, (byte) 0, (byte) data); ItemStack item = new ItemStack(id, amount, (short) 0, (byte) data);
if(readBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) { if(readBoolean("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)

View File

@ -180,91 +180,91 @@ public class Fishing {
switch (type) { switch (type) {
case BLAZE: case BLAZE:
m.mcDropItem(loc, new ItemStack(Material.BLAZE_ROD, 1)); m.mcDropItem(loc, new ItemStack(Material.BLAZE_ROD));
break; break;
case CAVE_SPIDER: case CAVE_SPIDER:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE, 1)); m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.STRING, 1)); m.mcDropItem(loc, new ItemStack(Material.STRING));
} }
break; break;
case CHICKEN: case CHICKEN:
if (DROP_NUMBER > 66) { if (DROP_NUMBER > 66) {
m.mcDropItem(loc, new ItemStack(Material.FEATHER, 1)); m.mcDropItem(loc, new ItemStack(Material.FEATHER));
} }
else if (DROP_NUMBER > 33) { else if (DROP_NUMBER > 33) {
m.mcDropItem(loc, new ItemStack(Material.RAW_CHICKEN, 1)); m.mcDropItem(loc, new ItemStack(Material.RAW_CHICKEN));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.EGG, 1)); m.mcDropItem(loc, new ItemStack(Material.EGG));
} }
break; break;
case COW: case COW:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET, 1)); m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET));
} }
else if (DROP_NUMBER > 50) { else if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.LEATHER, 1)); m.mcDropItem(loc, new ItemStack(Material.LEATHER));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF, 1)); m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF));
} }
break; break;
case CREEPER: case CREEPER:
m.mcDropItem(loc, new ItemStack(Material.SULPHUR, 1)); m.mcDropItem(loc, new ItemStack(Material.SULPHUR));
break; break;
case ENDERMAN: case ENDERMAN:
m.mcDropItem(loc, new ItemStack(Material.ENDER_PEARL, 1)); m.mcDropItem(loc, new ItemStack(Material.ENDER_PEARL));
break; break;
case GHAST: case GHAST:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.SULPHUR, 1)); m.mcDropItem(loc, new ItemStack(Material.SULPHUR));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.GHAST_TEAR, 1)); m.mcDropItem(loc, new ItemStack(Material.GHAST_TEAR));
} }
break; break;
case MAGMA_CUBE: case MAGMA_CUBE:
m.mcDropItem(loc, new ItemStack(Material.MAGMA_CREAM, 1)); m.mcDropItem(loc, new ItemStack(Material.MAGMA_CREAM));
break; break;
case MUSHROOM_COW: case MUSHROOM_COW:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET, 1)); m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET));
} }
else if (DROP_NUMBER > 98) { else if (DROP_NUMBER > 98) {
m.mcDropItem(loc, new ItemStack(Material.MUSHROOM_SOUP, 1)); m.mcDropItem(loc, new ItemStack(Material.MUSHROOM_SOUP));
} }
else if (DROP_NUMBER > 66) { else if (DROP_NUMBER > 66) {
m.mcDropItem(loc, new ItemStack(Material.LEATHER, 1)); m.mcDropItem(loc, new ItemStack(Material.LEATHER));
} }
else if (DROP_NUMBER > 33) { else if (DROP_NUMBER > 33) {
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF, 1)); m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.RED_MUSHROOM, 3)); m.mcDropItems(loc, new ItemStack(Material.RED_MUSHROOM), 3);
} }
break; break;
case PIG: case PIG:
m.mcDropItem(loc, new ItemStack(Material.PORK, 1)); m.mcDropItem(loc, new ItemStack(Material.PORK));
break; break;
case PIG_ZOMBIE: case PIG_ZOMBIE:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH, 1)); m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.GOLD_NUGGET, 1)); m.mcDropItem(loc, new ItemStack(Material.GOLD_NUGGET));
} }
break; break;
@ -285,41 +285,41 @@ public class Fishing {
case SKELETON: case SKELETON:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.BONE, 1)); m.mcDropItem(loc, new ItemStack(Material.BONE));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.ARROW, 3)); m.mcDropItems(loc, new ItemStack(Material.ARROW), 3);
} }
break; break;
case SLIME: case SLIME:
m.mcDropItem(loc, new ItemStack(Material.SLIME_BALL, 1)); m.mcDropItem(loc, new ItemStack(Material.SLIME_BALL));
break; break;
case SNOWMAN: case SNOWMAN:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
m.mcDropItem(loc, new ItemStack(Material.PUMPKIN, 1)); m.mcDropItem(loc, new ItemStack(Material.PUMPKIN));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.SNOW_BALL, 5)); m.mcDropItems(loc, new ItemStack(Material.SNOW_BALL), 5);
} }
break; break;
case SPIDER: case SPIDER:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE, 1)); m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE));
} }
else { else {
m.mcDropItem(loc, new ItemStack(Material.STRING, 1)); m.mcDropItem(loc, new ItemStack(Material.STRING));
} }
break; break;
case SQUID: case SQUID:
m.mcDropItem(loc, new ItemStack(Material.INK_SACK, 1, (byte) 0x0, DyeColor.BLACK.getData())); m.mcDropItem(loc, new ItemStack(Material.INK_SACK, 1, (short) 0, DyeColor.BLACK.getData()));
break; break;
case ZOMBIE: case ZOMBIE:
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH, 1)); m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
break; break;
default: default:

View File

@ -36,7 +36,7 @@ public class Herbalism {
player.sendMessage("You need more seeds to spread Green Terra"); player.sendMessage("You need more seeds to spread Green Terra");
} }
else if (hasSeeds && !block.getType().equals(Material.WHEAT)) { else if (hasSeeds && !block.getType().equals(Material.WHEAT)) {
inventory.removeItem(new ItemStack(Material.SEEDS, 1)); inventory.removeItem(new ItemStack(Material.SEEDS));
player.updateInventory(); player.updateInventory();
if (m.blockBreakSimulate(block, player, false)) { if (m.blockBreakSimulate(block, player, false)) {
@ -124,7 +124,7 @@ public class Herbalism {
switch (type) { switch (type) {
case BROWN_MUSHROOM: case BROWN_MUSHROOM:
case RED_MUSHROOM: case RED_MUSHROOM:
if (data != (byte) 0x5) { if (!block.hasMetadata("mcmmoPlacedBlock")) {
mat = Material.getMaterial(id); mat = Material.getMaterial(id);
xp = LoadProperties.mmushroom; xp = LoadProperties.mmushroom;
} }
@ -223,7 +223,7 @@ public class Herbalism {
return; return;
} }
else { else {
ItemStack is = new ItemStack(mat, 1); ItemStack is = new ItemStack(mat);
if (herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= herbLevel)) { if (herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= herbLevel)) {
if (type.equals(Material.CACTUS)) { if (type.equals(Material.CACTUS)) {
@ -270,12 +270,12 @@ public class Herbalism {
if (hasSeeds && PP.getGreenTerraMode() || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1500 <= herbLevel))) { if (hasSeeds && PP.getGreenTerraMode() || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || (Math.random() * 1500 <= herbLevel))) {
event.setCancelled(true); event.setCancelled(true);
m.mcDropItem(loc, new ItemStack(Material.WHEAT, 1)); m.mcDropItem(loc, new ItemStack(Material.WHEAT));
m.mcRandomDropItems(loc, new ItemStack(Material.SEEDS, 1), 50, 3); m.mcRandomDropItems(loc, new ItemStack(Material.SEEDS), 50, 3);
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new GreenThumbTimer(block, PP), 1); Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new GreenThumbTimer(block, PP), 1);
inventory.removeItem(new ItemStack(Material.SEEDS, 1)); inventory.removeItem(new ItemStack(Material.SEEDS));
player.updateInventory(); player.updateInventory();
} }
} }

View File

@ -31,7 +31,7 @@ public class Mining
public static void miningDrops(Block block) { public static void miningDrops(Block block) {
Location loc = block.getLocation(); Location loc = block.getLocation();
Material type = block.getType(); Material type = block.getType();
ItemStack item = new ItemStack(type, 1); ItemStack item = new ItemStack(type);
switch (type) { switch (type) {
case COAL_ORE: case COAL_ORE:
@ -40,19 +40,19 @@ public class Mining
break; break;
case DIAMOND_ORE: case DIAMOND_ORE:
item = new ItemStack(Material.DIAMOND, 1); item = new ItemStack(Material.DIAMOND);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
break; break;
case GLOWING_REDSTONE_ORE: case GLOWING_REDSTONE_ORE:
case REDSTONE_ORE: case REDSTONE_ORE:
item = new ItemStack(Material.REDSTONE, 1); item = new ItemStack(Material.REDSTONE);
m.mcDropItems(loc, item, 4); m.mcDropItems(loc, item, 4);
m.mcRandomDropItem(loc, item, 50); m.mcRandomDropItem(loc, item, 50);
break; break;
case GLOWSTONE: case GLOWSTONE:
item = new ItemStack(Material.GLOWSTONE_DUST, 1); item = new ItemStack(Material.GLOWSTONE_DUST);
m.mcDropItems(loc, item, 2); m.mcDropItems(loc, item, 2);
m.mcRandomDropItems(loc, item, 50, 2); m.mcRandomDropItems(loc, item, 50, 2);
break; break;
@ -64,7 +64,7 @@ public class Mining
break; break;
case STONE: case STONE:
item = new ItemStack(Material.COBBLESTONE, 1); item = new ItemStack(Material.COBBLESTONE);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
break; break;
@ -167,7 +167,7 @@ public class Mining
if (MAX_BONUS_LEVEL > 1000 || (Math.random() * 1000 <= skillLevel)) { if (MAX_BONUS_LEVEL > 1000 || (Math.random() * 1000 <= skillLevel)) {
if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) { if (player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
m.mcDropItem(block.getLocation(), new ItemStack(block.getType(), 1)); m.mcDropItem(block.getLocation(), new ItemStack(block.getType()));
} }
else { else {
miningDrops(block); miningDrops(block);

View File

@ -40,22 +40,22 @@ public class Repair {
*/ */
if (ItemChecks.isArmor(is) && LoadProperties.repairArmor) { if (ItemChecks.isArmor(is) && LoadProperties.repairArmor) {
if (ItemChecks.isDiamondArmor(is) && inventory.contains(LoadProperties.rDiamond) && skillLevel >= LoadProperties.repairdiamondlevel) { if (ItemChecks.isDiamondArmor(is) && inventory.contains(LoadProperties.rDiamond) && skillLevel >= LoadProperties.repairdiamondlevel) {
inventory.removeItem(new ItemStack(LoadProperties.rDiamond, 1)); inventory.removeItem(new ItemStack(LoadProperties.rDiamond));
repairItem(player, is); repairItem(player, is);
xpHandler(player, PP, is, durabilityBefore, 6, true); xpHandler(player, PP, is, durabilityBefore, 6, true);
} }
else if (ItemChecks.isIronArmor(is) && inventory.contains(LoadProperties.rIron) && skillLevel >= LoadProperties.repairIronLevel) { else if (ItemChecks.isIronArmor(is) && inventory.contains(LoadProperties.rIron) && skillLevel >= LoadProperties.repairIronLevel) {
inventory.removeItem(new ItemStack(LoadProperties.rIron, 1)); inventory.removeItem(new ItemStack(LoadProperties.rIron));
repairItem(player, is); repairItem(player, is);
xpHandler(player, PP, is, durabilityBefore, 2, true); xpHandler(player, PP, is, durabilityBefore, 2, true);
} }
else if (ItemChecks.isGoldArmor(is) && inventory.contains(LoadProperties.rGold) && skillLevel >= LoadProperties.repairGoldLevel) { else if (ItemChecks.isGoldArmor(is) && inventory.contains(LoadProperties.rGold) && skillLevel >= LoadProperties.repairGoldLevel) {
inventory.removeItem(new ItemStack(LoadProperties.rGold, 1)); inventory.removeItem(new ItemStack(LoadProperties.rGold));
repairItem(player, is); repairItem(player, is);
xpHandler(player, PP, is, durabilityBefore, 4, true); xpHandler(player, PP, is, durabilityBefore, 4, true);
} }
else if (ItemChecks.isLeatherArmor(is) && inventory.contains(LoadProperties.rLeather)) { else if (ItemChecks.isLeatherArmor(is) && inventory.contains(LoadProperties.rLeather)) {
inventory.removeItem(new ItemStack(LoadProperties.rLeather, 1)); inventory.removeItem(new ItemStack(LoadProperties.rLeather));
repairItem(player, is); repairItem(player, is);
xpHandler(player, PP, is, durabilityBefore, 1, true); xpHandler(player, PP, is, durabilityBefore, 1, true);
} }
@ -69,32 +69,32 @@ public class Repair {
*/ */
else if (ItemChecks.isTool(is) && LoadProperties.repairTools) { else if (ItemChecks.isTool(is) && LoadProperties.repairTools) {
if (ItemChecks.isStoneTool(is) && inventory.contains(LoadProperties.rStone) && skillLevel >= LoadProperties.repairStoneLevel) { if (ItemChecks.isStoneTool(is) && inventory.contains(LoadProperties.rStone) && skillLevel >= LoadProperties.repairStoneLevel) {
inventory.removeItem(new ItemStack(LoadProperties.rStone, 1)); inventory.removeItem(new ItemStack(LoadProperties.rStone));
repairItem(player, is); repairItem(player, is);
xpHandler(player, PP, is, durabilityBefore, 2, false); xpHandler(player, PP, is, durabilityBefore, 2, false);
} }
else if (ItemChecks.isWoodTool(is) && inventory.contains(LoadProperties.rWood)) { else if (ItemChecks.isWoodTool(is) && inventory.contains(LoadProperties.rWood)) {
inventory.removeItem(new ItemStack(LoadProperties.rWood, 1)); inventory.removeItem(new ItemStack(LoadProperties.rWood));
repairItem(player, is); repairItem(player, is);
xpHandler(player, PP, is, durabilityBefore, 2, false); xpHandler(player, PP, is, durabilityBefore, 2, false);
} }
else if (ItemChecks.isIronTool(is) && inventory.contains(LoadProperties.rIron) && skillLevel >= LoadProperties.repairIronLevel) { else if (ItemChecks.isIronTool(is) && inventory.contains(LoadProperties.rIron) && skillLevel >= LoadProperties.repairIronLevel) {
inventory.removeItem(new ItemStack(LoadProperties.rIron, 1)); inventory.removeItem(new ItemStack(LoadProperties.rIron));
repairItem(player, is); repairItem(player, is);
xpHandler(player, PP, is, durabilityBefore, 1, true); xpHandler(player, PP, is, durabilityBefore, 1, true);
} }
else if (ItemChecks.isDiamondTool(is) && inventory.contains(LoadProperties.rDiamond) && skillLevel >= LoadProperties.repairdiamondlevel) { else if (ItemChecks.isDiamondTool(is) && inventory.contains(LoadProperties.rDiamond) && skillLevel >= LoadProperties.repairdiamondlevel) {
inventory.removeItem(new ItemStack(LoadProperties.rDiamond, 1)); inventory.removeItem(new ItemStack(LoadProperties.rDiamond));
repairItem(player, is); repairItem(player, is);
xpHandler(player, PP, is, durabilityBefore, 1, true); xpHandler(player, PP, is, durabilityBefore, 1, true);
} }
else if (ItemChecks.isGoldTool(is) && inventory.contains(LoadProperties.rGold) && skillLevel >= LoadProperties.repairGoldLevel) { else if (ItemChecks.isGoldTool(is) && inventory.contains(LoadProperties.rGold) && skillLevel >= LoadProperties.repairGoldLevel) {
inventory.removeItem(new ItemStack(LoadProperties.rGold, 1)); inventory.removeItem(new ItemStack(LoadProperties.rGold));
repairItem(player, is); repairItem(player, is);
xpHandler(player, PP, is, durabilityBefore, 8, true); xpHandler(player, PP, is, durabilityBefore, 8, true);
} }
else if (is.getType().equals(Material.BOW) && inventory.contains(LoadProperties.rString)){ else if (is.getType().equals(Material.BOW) && inventory.contains(LoadProperties.rString)){
inventory.removeItem(new ItemStack(LoadProperties.rString, 1)); inventory.removeItem(new ItemStack(LoadProperties.rString));
repairItem(player, is); repairItem(player, is);
xpHandler(player, PP, is, durabilityBefore, 2, false); xpHandler(player, PP, is, durabilityBefore, 2, false);
} }

View File

@ -75,10 +75,10 @@ public class WoodCutting {
//Prepare ItemStacks //Prepare ItemStacks
ItemStack item = null; ItemStack item = null;
ItemStack oak = new ItemStack(Material.LOG, 1, (byte) 0x0, TreeSpecies.GENERIC.getData()); ItemStack oak = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.GENERIC.getData());
ItemStack spruce = new ItemStack(Material.LOG, 1, (byte) 0x0, TreeSpecies.REDWOOD.getData()); ItemStack spruce = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.REDWOOD.getData());
ItemStack birch = new ItemStack(Material.LOG, 1, (byte) 0x0, TreeSpecies.BIRCH.getData()); ItemStack birch = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.BIRCH.getData());
ItemStack jungle = new ItemStack(Material.LOG, 1, (byte)0, TreeSpecies.JUNGLE.getData()); ItemStack jungle = new ItemStack(Material.LOG, 1, (short) 0, TreeSpecies.JUNGLE.getData());
for (Block x : toBeFelled) { for (Block x : toBeFelled) {
if (m.blockBreakSimulate(x, player, true)) { if (m.blockBreakSimulate(x, player, true)) {