Because loc is lazy.

This commit is contained in:
GJ 2012-07-04 15:35:14 -04:00
parent f009f5803f
commit c9e3ea005b
4 changed files with 83 additions and 83 deletions

View File

@ -38,7 +38,7 @@ public class Excavation {
*/ */
public static void excavationProcCheck(Block block, Player player) { public static void excavationProcCheck(Block block, Player player) {
Material type = block.getType(); Material type = block.getType();
Location loc = block.getLocation(); Location location = block.getLocation();
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);
int skillLevel = profile.getSkillLevel(SkillType.EXCAVATION); int skillLevel = profile.getSkillLevel(SkillType.EXCAVATION);
@ -107,7 +107,7 @@ public class Excavation {
//Drop items //Drop items
for (ItemStack x : is) { for (ItemStack x : is) {
if (x != null) { if (x != null) {
Misc.dropItem(loc, x); Misc.dropItem(location, x);
} }
} }
} }

View File

@ -201,95 +201,95 @@ public class Fishing {
LivingEntity le = (LivingEntity) event.getCaught(); LivingEntity le = (LivingEntity) event.getCaught();
EntityType type = le.getType(); EntityType type = le.getType();
Location loc = le.getLocation(); Location location = le.getLocation();
switch (type) { switch (type) {
case BLAZE: case BLAZE:
Misc.dropItem(loc, new ItemStack(Material.BLAZE_ROD)); Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD));
break; break;
case CAVE_SPIDER: case CAVE_SPIDER:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.SPIDER_EYE)); Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
} }
else { else {
Misc.dropItem(loc, new ItemStack(Material.STRING)); Misc.dropItem(location, new ItemStack(Material.STRING));
} }
break; break;
case CHICKEN: case CHICKEN:
if (DROP_NUMBER > 66) { if (DROP_NUMBER > 66) {
Misc.dropItem(loc, new ItemStack(Material.FEATHER)); Misc.dropItem(location, new ItemStack(Material.FEATHER));
} }
else if (DROP_NUMBER > 33) { else if (DROP_NUMBER > 33) {
Misc.dropItem(loc, new ItemStack(Material.RAW_CHICKEN)); Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN));
} }
else { else {
Misc.dropItem(loc, new ItemStack(Material.EGG)); Misc.dropItem(location, new ItemStack(Material.EGG));
} }
break; break;
case COW: case COW:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
Misc.dropItem(loc, new ItemStack(Material.MILK_BUCKET)); Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
} }
else if (DROP_NUMBER > 50) { else if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.LEATHER)); Misc.dropItem(location, new ItemStack(Material.LEATHER));
} }
else { else {
Misc.dropItem(loc, new ItemStack(Material.RAW_BEEF)); Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
} }
break; break;
case CREEPER: case CREEPER:
Misc.dropItem(loc, new ItemStack(Material.SULPHUR)); Misc.dropItem(location, new ItemStack(Material.SULPHUR));
break; break;
case ENDERMAN: case ENDERMAN:
Misc.dropItem(loc, new ItemStack(Material.ENDER_PEARL)); Misc.dropItem(location, new ItemStack(Material.ENDER_PEARL));
break; break;
case GHAST: case GHAST:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.SULPHUR)); Misc.dropItem(location, new ItemStack(Material.SULPHUR));
} }
else { else {
Misc.dropItem(loc, new ItemStack(Material.GHAST_TEAR)); Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR));
} }
break; break;
case MAGMA_CUBE: case MAGMA_CUBE:
Misc.dropItem(loc, new ItemStack(Material.MAGMA_CREAM)); Misc.dropItem(location, new ItemStack(Material.MAGMA_CREAM));
break; break;
case MUSHROOM_COW: case MUSHROOM_COW:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
Misc.dropItem(loc, new ItemStack(Material.MILK_BUCKET)); Misc.dropItem(location, new ItemStack(Material.MILK_BUCKET));
} }
else if (DROP_NUMBER > 98) { else if (DROP_NUMBER > 98) {
Misc.dropItem(loc, new ItemStack(Material.MUSHROOM_SOUP)); Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP));
} }
else if (DROP_NUMBER > 66) { else if (DROP_NUMBER > 66) {
Misc.dropItem(loc, new ItemStack(Material.LEATHER)); Misc.dropItem(location, new ItemStack(Material.LEATHER));
} }
else if (DROP_NUMBER > 33) { else if (DROP_NUMBER > 33) {
Misc.dropItem(loc, new ItemStack(Material.RAW_BEEF)); Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
} }
else { else {
Misc.dropItems(loc, new ItemStack(Material.RED_MUSHROOM), 3); Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3);
} }
break; break;
case PIG: case PIG:
Misc.dropItem(loc, new ItemStack(Material.PORK)); Misc.dropItem(location, new ItemStack(Material.PORK));
break; break;
case PIG_ZOMBIE: case PIG_ZOMBIE:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.ROTTEN_FLESH)); Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
} }
else { else {
Misc.dropItem(loc, new ItemStack(Material.GOLD_NUGGET)); Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
} }
break; break;
@ -303,48 +303,48 @@ public class Fishing {
ItemStack theWool = wool.toItemStack(); ItemStack theWool = wool.toItemStack();
theWool.setAmount(1 + random.nextInt(6)); theWool.setAmount(1 + random.nextInt(6));
Misc.dropItem(loc, theWool); Misc.dropItem(location, theWool);
sheep.setSheared(true); sheep.setSheared(true);
} }
break; break;
case SKELETON: case SKELETON:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.BONE)); Misc.dropItem(location, new ItemStack(Material.BONE));
} }
else { else {
Misc.dropItems(loc, new ItemStack(Material.ARROW), 3); Misc.dropItems(location, new ItemStack(Material.ARROW), 3);
} }
break; break;
case SLIME: case SLIME:
Misc.dropItem(loc, new ItemStack(Material.SLIME_BALL)); Misc.dropItem(location, new ItemStack(Material.SLIME_BALL));
break; break;
case SNOWMAN: case SNOWMAN:
if (DROP_NUMBER > 99) { if (DROP_NUMBER > 99) {
Misc.dropItem(loc, new ItemStack(Material.PUMPKIN)); Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
} }
else { else {
Misc.dropItems(loc, new ItemStack(Material.SNOW_BALL), 5); Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5);
} }
break; break;
case SPIDER: case SPIDER:
if (DROP_NUMBER > 50) { if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.SPIDER_EYE)); Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
} }
else { else {
Misc.dropItem(loc, new ItemStack(Material.STRING)); Misc.dropItem(location, new ItemStack(Material.STRING));
} }
break; break;
case SQUID: case SQUID:
Misc.dropItem(loc, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0)); Misc.dropItem(location, new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x0));
break; break;
case ZOMBIE: case ZOMBIE:
Misc.dropItem(loc, new ItemStack(Material.ROTTEN_FLESH)); Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
break; break;
default: default:

View File

@ -83,7 +83,7 @@ public class Herbalism {
Material type = block.getType(); Material type = block.getType();
Byte data = block.getData(); Byte data = block.getData();
Location loc = block.getLocation(); Location location = block.getLocation();
Material mat = null; Material mat = null;
int xp = 0; int xp = 0;
@ -220,69 +220,69 @@ public class Herbalism {
switch (type) { switch (type) {
case BROWN_MUSHROOM: case BROWN_MUSHROOM:
if (configInstance.getBrownMushroomsDoubleDropsEnabled()) { if (configInstance.getBrownMushroomsDoubleDropsEnabled()) {
Misc.dropItem(loc, is); Misc.dropItem(location, is);
} }
break; break;
case CACTUS: case CACTUS:
if (configInstance.getCactiDoubleDropsEnabled()) { if (configInstance.getCactiDoubleDropsEnabled()) {
Misc.dropItems(loc, is, catciDrops); Misc.dropItems(location, is, catciDrops);
} }
break; break;
case CROPS: case CROPS:
if (configInstance.getWheatDoubleDropsEnabled()) { if (configInstance.getWheatDoubleDropsEnabled()) {
Misc.dropItem(loc, is); Misc.dropItem(location, is);
} }
break; break;
case MELON_BLOCK: case MELON_BLOCK:
if (configInstance.getMelonsDoubleDropsEnabled()) { if (configInstance.getMelonsDoubleDropsEnabled()) {
Misc.dropItems(loc, is, 3); Misc.dropItems(location, is, 3);
Misc.randomDropItems(loc, is, 50, 4); Misc.randomDropItems(location, is, 50, 4);
} }
break; break;
case NETHER_WARTS: case NETHER_WARTS:
if (configInstance.getNetherWartsDoubleDropsEnabled()) { if (configInstance.getNetherWartsDoubleDropsEnabled()) {
Misc.dropItems(loc, is, 2); Misc.dropItems(location, is, 2);
Misc.randomDropItems(loc, is, 50, 3); Misc.randomDropItems(location, is, 50, 3);
} }
break; break;
case PUMPKIN: case PUMPKIN:
if (configInstance.getPumpkinsDoubleDropsEnabled()) { if (configInstance.getPumpkinsDoubleDropsEnabled()) {
Misc.dropItem(loc, is); Misc.dropItem(location, is);
} }
break; break;
case RED_MUSHROOM: case RED_MUSHROOM:
if (configInstance.getRedMushroomsDoubleDropsEnabled()) { if (configInstance.getRedMushroomsDoubleDropsEnabled()) {
Misc.dropItem(loc, is); Misc.dropItem(location, is);
} }
break; break;
case SUGAR_CANE_BLOCK: case SUGAR_CANE_BLOCK:
if (configInstance.getSugarCaneDoubleDropsEnabled()) { if (configInstance.getSugarCaneDoubleDropsEnabled()) {
Misc.dropItems(loc, is, caneDrops); Misc.dropItems(location, is, caneDrops);
} }
break; break;
case VINE: case VINE:
if (configInstance.getVinesDoubleDropsEnabled()) { if (configInstance.getVinesDoubleDropsEnabled()) {
Misc.dropItem(loc, is); Misc.dropItem(location, is);
} }
break; break;
case WATER_LILY: case WATER_LILY:
if (configInstance.getWaterLiliesDoubleDropsEnabled()) { if (configInstance.getWaterLiliesDoubleDropsEnabled()) {
Misc.dropItem(loc, is); Misc.dropItem(location, is);
} }
break; break;
case YELLOW_FLOWER: case YELLOW_FLOWER:
if (configInstance.getYellowFlowersDoubleDropsEnabled()) { if (configInstance.getYellowFlowersDoubleDropsEnabled()) {
Misc.dropItem(loc, is); Misc.dropItem(location, is);
} }
break; break;
@ -295,11 +295,11 @@ public class Herbalism {
is = customBlock.getItemDrop(); is = customBlock.getItemDrop();
if (minimumDropAmount != maximumDropAmount) { if (minimumDropAmount != maximumDropAmount) {
Misc.dropItems(loc, is, minimumDropAmount); Misc.dropItems(location, is, minimumDropAmount);
Misc.randomDropItems(loc, is, 50, maximumDropAmount - minimumDropAmount); Misc.randomDropItems(location, is, 50, maximumDropAmount - minimumDropAmount);
} }
else { else {
Misc.dropItems(loc, is, minimumDropAmount); Misc.dropItems(location, is, minimumDropAmount);
} }
} }
break; break;
@ -325,7 +325,7 @@ public class Herbalism {
int herbLevel = profile.getSkillLevel(SkillType.HERBALISM); int herbLevel = profile.getSkillLevel(SkillType.HERBALISM);
PlayerInventory inventory = player.getInventory(); PlayerInventory inventory = player.getInventory();
boolean hasSeeds = inventory.contains(Material.SEEDS); boolean hasSeeds = inventory.contains(Material.SEEDS);
Location loc = block.getLocation(); Location location = block.getLocation();
int randomChance = 1500; int randomChance = 1500;
@ -336,8 +336,8 @@ public class Herbalism {
if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel)) { if (hasSeeds && profile.getAbilityMode(AbilityType.GREEN_TERRA) || hasSeeds && (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel)) {
event.setCancelled(true); event.setCancelled(true);
Misc.dropItem(loc, new ItemStack(Material.WHEAT)); Misc.dropItem(location, new ItemStack(Material.WHEAT));
Misc.randomDropItems(loc, new ItemStack(Material.SEEDS), 50, 3); Misc.randomDropItems(location, new ItemStack(Material.SEEDS), 50, 3);
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new GreenThumbTimer(block, profile), 1); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new GreenThumbTimer(block, profile), 1);

View File

@ -33,7 +33,7 @@ public class Mining {
* @param block The block to process drops for * @param block The block to process drops for
*/ */
private static void silkTouchDrops(Block block) { private static void silkTouchDrops(Block block) {
Location loc = block.getLocation(); Location location = block.getLocation();
Material type = block.getType(); Material type = block.getType();
ItemStack item = new ItemStack(type); ItemStack item = new ItemStack(type);
Config configInstance = Config.getInstance(); Config configInstance = Config.getInstance();
@ -51,44 +51,44 @@ public class Mining {
case COAL_ORE: case COAL_ORE:
if (configInstance.getCoalDoubleDropsEnabled()) { if (configInstance.getCoalDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case DIAMOND_ORE: case DIAMOND_ORE:
if (configInstance.getDiamondDoubleDropsEnabled()) { if (configInstance.getDiamondDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case GLOWING_REDSTONE_ORE: case GLOWING_REDSTONE_ORE:
case REDSTONE_ORE: case REDSTONE_ORE:
if (configInstance.getRedstoneDoubleDropsEnabled()) { if (configInstance.getRedstoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case GLOWSTONE: case GLOWSTONE:
if (configInstance.getGlowstoneDoubleDropsEnabled()) { if (configInstance.getGlowstoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case LAPIS_ORE: case LAPIS_ORE:
if (configInstance.getLapisDoubleDropsEnabled()) { if (configInstance.getLapisDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case STONE: case STONE:
if (configInstance.getStoneDoubleDropsEnabled()) { if (configInstance.getStoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
default: default:
if (ModChecks.isCustomMiningBlock(block)) { if (ModChecks.isCustomMiningBlock(block)) {
Misc.dropItem(loc, new ItemStack(block.getTypeId(), 1, (short) 0, block.getData())); Misc.dropItem(location, new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()));
} }
break; break;
} }
@ -101,7 +101,7 @@ public class Mining {
* @param block The block to process drops for * @param block The block to process drops for
*/ */
public static void miningDrops(Block block) { public static void miningDrops(Block block) {
Location loc = block.getLocation(); Location location = block.getLocation();
Material type = block.getType(); Material type = block.getType();
ItemStack item = new ItemStack(type); ItemStack item = new ItemStack(type);
Config configInstance = Config.getInstance(); Config configInstance = Config.getInstance();
@ -110,20 +110,20 @@ public class Mining {
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, CoalType.COAL.getData());
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case DIAMOND_ORE: case DIAMOND_ORE:
if (configInstance.getDiamondDoubleDropsEnabled()) { if (configInstance.getDiamondDoubleDropsEnabled()) {
item = new ItemStack(Material.DIAMOND); item = new ItemStack(Material.DIAMOND);
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case ENDER_STONE: case ENDER_STONE:
if (configInstance.getEndStoneDoubleDropsEnabled()) { if (configInstance.getEndStoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
@ -131,67 +131,67 @@ public class Mining {
case REDSTONE_ORE: case REDSTONE_ORE:
if (configInstance.getRedstoneDoubleDropsEnabled()) { if (configInstance.getRedstoneDoubleDropsEnabled()) {
item = new ItemStack(Material.REDSTONE); item = new ItemStack(Material.REDSTONE);
Misc.dropItems(loc, item, 4); Misc.dropItems(location, item, 4);
Misc.randomDropItem(loc, item, 50); Misc.randomDropItem(location, item, 50);
} }
break; break;
case GLOWSTONE: case GLOWSTONE:
if (configInstance.getGlowstoneDoubleDropsEnabled()) { if (configInstance.getGlowstoneDoubleDropsEnabled()) {
item = new ItemStack(Material.GLOWSTONE_DUST); item = new ItemStack(Material.GLOWSTONE_DUST);
Misc.dropItems(loc, item, 2); Misc.dropItems(location, item, 2);
Misc.randomDropItems(loc, item, 50, 2); Misc.randomDropItems(location, item, 50, 2);
} }
break; break;
case GOLD_ORE: case GOLD_ORE:
if (configInstance.getGoldDoubleDropsEnabled()) { if (configInstance.getGoldDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case IRON_ORE: case IRON_ORE:
if (configInstance.getIronDoubleDropsEnabled()) { if (configInstance.getIronDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
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, (byte) 0x4);
Misc.dropItems(loc, item, 4); Misc.dropItems(location, item, 4);
Misc.randomDropItems(loc, item, 50, 4); Misc.randomDropItems(location, item, 50, 4);
} }
break; break;
case MOSSY_COBBLESTONE: case MOSSY_COBBLESTONE:
if (configInstance.getMossyCobblestoneDoubleDropsEnabled()) { if (configInstance.getMossyCobblestoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case NETHERRACK: case NETHERRACK:
if (configInstance.getNetherrackDoubleDropsEnabled()) { if (configInstance.getNetherrackDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case OBSIDIAN: case OBSIDIAN:
if (configInstance.getObsidianDoubleDropsEnabled()) { if (configInstance.getObsidianDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case SANDSTONE: case SANDSTONE:
if (configInstance.getSandstoneDoubleDropsEnabled()) { if (configInstance.getSandstoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
case STONE: case STONE:
if (configInstance.getStoneDoubleDropsEnabled()) { if (configInstance.getStoneDoubleDropsEnabled()) {
item = new ItemStack(Material.COBBLESTONE); item = new ItemStack(Material.COBBLESTONE);
Misc.dropItem(loc, item); Misc.dropItem(location, item);
} }
break; break;
@ -204,11 +204,11 @@ public class Mining {
item = ModChecks.getCustomBlock(block).getItemDrop(); item = ModChecks.getCustomBlock(block).getItemDrop();
if (minimumDropAmount != maximumDropAmount) { if (minimumDropAmount != maximumDropAmount) {
Misc.dropItems(loc, item, minimumDropAmount); Misc.dropItems(location, item, minimumDropAmount);
Misc.randomDropItems(loc, item, 50, maximumDropAmount - minimumDropAmount); Misc.randomDropItems(location, item, 50, maximumDropAmount - minimumDropAmount);
} }
else { else {
Misc.dropItems(loc, item, minimumDropAmount); Misc.dropItems(location, item, minimumDropAmount);
} }
} }
break; break;