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(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(config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1)

View File

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

View File

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

View File

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

View File

@ -40,22 +40,22 @@ public class Repair {
*/
if (ItemChecks.isArmor(is) && LoadProperties.repairArmor) {
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);
xpHandler(player, PP, is, durabilityBefore, 6, true);
}
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);
xpHandler(player, PP, is, durabilityBefore, 2, true);
}
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);
xpHandler(player, PP, is, durabilityBefore, 4, true);
}
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);
xpHandler(player, PP, is, durabilityBefore, 1, true);
}
@ -69,32 +69,32 @@ public class Repair {
*/
else if (ItemChecks.isTool(is) && LoadProperties.repairTools) {
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);
xpHandler(player, PP, is, durabilityBefore, 2, false);
}
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);
xpHandler(player, PP, is, durabilityBefore, 2, false);
}
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);
xpHandler(player, PP, is, durabilityBefore, 1, true);
}
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);
xpHandler(player, PP, is, durabilityBefore, 1, true);
}
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);
xpHandler(player, PP, is, durabilityBefore, 8, true);
}
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);
xpHandler(player, PP, is, durabilityBefore, 2, false);
}

View File

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