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) {
Material type = block.getType();
Location loc = block.getLocation();
Location location = block.getLocation();
PlayerProfile profile = Users.getProfile(player);
int skillLevel = profile.getSkillLevel(SkillType.EXCAVATION);
@ -107,7 +107,7 @@ public class Excavation {
//Drop items
for (ItemStack x : is) {
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();
EntityType type = le.getType();
Location loc = le.getLocation();
Location location = le.getLocation();
switch (type) {
case BLAZE:
Misc.dropItem(loc, new ItemStack(Material.BLAZE_ROD));
Misc.dropItem(location, new ItemStack(Material.BLAZE_ROD));
break;
case CAVE_SPIDER:
if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.SPIDER_EYE));
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
}
else {
Misc.dropItem(loc, new ItemStack(Material.STRING));
Misc.dropItem(location, new ItemStack(Material.STRING));
}
break;
case CHICKEN:
if (DROP_NUMBER > 66) {
Misc.dropItem(loc, new ItemStack(Material.FEATHER));
Misc.dropItem(location, new ItemStack(Material.FEATHER));
}
else if (DROP_NUMBER > 33) {
Misc.dropItem(loc, new ItemStack(Material.RAW_CHICKEN));
Misc.dropItem(location, new ItemStack(Material.RAW_CHICKEN));
}
else {
Misc.dropItem(loc, new ItemStack(Material.EGG));
Misc.dropItem(location, new ItemStack(Material.EGG));
}
break;
case COW:
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) {
Misc.dropItem(loc, new ItemStack(Material.LEATHER));
Misc.dropItem(location, new ItemStack(Material.LEATHER));
}
else {
Misc.dropItem(loc, new ItemStack(Material.RAW_BEEF));
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
}
break;
case CREEPER:
Misc.dropItem(loc, new ItemStack(Material.SULPHUR));
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
break;
case ENDERMAN:
Misc.dropItem(loc, new ItemStack(Material.ENDER_PEARL));
Misc.dropItem(location, new ItemStack(Material.ENDER_PEARL));
break;
case GHAST:
if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.SULPHUR));
Misc.dropItem(location, new ItemStack(Material.SULPHUR));
}
else {
Misc.dropItem(loc, new ItemStack(Material.GHAST_TEAR));
Misc.dropItem(location, new ItemStack(Material.GHAST_TEAR));
}
break;
case MAGMA_CUBE:
Misc.dropItem(loc, new ItemStack(Material.MAGMA_CREAM));
Misc.dropItem(location, new ItemStack(Material.MAGMA_CREAM));
break;
case MUSHROOM_COW:
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) {
Misc.dropItem(loc, new ItemStack(Material.MUSHROOM_SOUP));
Misc.dropItem(location, new ItemStack(Material.MUSHROOM_SOUP));
}
else if (DROP_NUMBER > 66) {
Misc.dropItem(loc, new ItemStack(Material.LEATHER));
Misc.dropItem(location, new ItemStack(Material.LEATHER));
}
else if (DROP_NUMBER > 33) {
Misc.dropItem(loc, new ItemStack(Material.RAW_BEEF));
Misc.dropItem(location, new ItemStack(Material.RAW_BEEF));
}
else {
Misc.dropItems(loc, new ItemStack(Material.RED_MUSHROOM), 3);
Misc.dropItems(location, new ItemStack(Material.RED_MUSHROOM), 3);
}
break;
case PIG:
Misc.dropItem(loc, new ItemStack(Material.PORK));
Misc.dropItem(location, new ItemStack(Material.PORK));
break;
case PIG_ZOMBIE:
if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
}
else {
Misc.dropItem(loc, new ItemStack(Material.GOLD_NUGGET));
Misc.dropItem(location, new ItemStack(Material.GOLD_NUGGET));
}
break;
@ -303,48 +303,48 @@ public class Fishing {
ItemStack theWool = wool.toItemStack();
theWool.setAmount(1 + random.nextInt(6));
Misc.dropItem(loc, theWool);
Misc.dropItem(location, theWool);
sheep.setSheared(true);
}
break;
case SKELETON:
if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.BONE));
Misc.dropItem(location, new ItemStack(Material.BONE));
}
else {
Misc.dropItems(loc, new ItemStack(Material.ARROW), 3);
Misc.dropItems(location, new ItemStack(Material.ARROW), 3);
}
break;
case SLIME:
Misc.dropItem(loc, new ItemStack(Material.SLIME_BALL));
Misc.dropItem(location, new ItemStack(Material.SLIME_BALL));
break;
case SNOWMAN:
if (DROP_NUMBER > 99) {
Misc.dropItem(loc, new ItemStack(Material.PUMPKIN));
Misc.dropItem(location, new ItemStack(Material.PUMPKIN));
}
else {
Misc.dropItems(loc, new ItemStack(Material.SNOW_BALL), 5);
Misc.dropItems(location, new ItemStack(Material.SNOW_BALL), 5);
}
break;
case SPIDER:
if (DROP_NUMBER > 50) {
Misc.dropItem(loc, new ItemStack(Material.SPIDER_EYE));
Misc.dropItem(location, new ItemStack(Material.SPIDER_EYE));
}
else {
Misc.dropItem(loc, new ItemStack(Material.STRING));
Misc.dropItem(location, new ItemStack(Material.STRING));
}
break;
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;
case ZOMBIE:
Misc.dropItem(loc, new ItemStack(Material.ROTTEN_FLESH));
Misc.dropItem(location, new ItemStack(Material.ROTTEN_FLESH));
break;
default:

View File

@ -83,7 +83,7 @@ public class Herbalism {
Material type = block.getType();
Byte data = block.getData();
Location loc = block.getLocation();
Location location = block.getLocation();
Material mat = null;
int xp = 0;
@ -220,69 +220,69 @@ public class Herbalism {
switch (type) {
case BROWN_MUSHROOM:
if (configInstance.getBrownMushroomsDoubleDropsEnabled()) {
Misc.dropItem(loc, is);
Misc.dropItem(location, is);
}
break;
case CACTUS:
if (configInstance.getCactiDoubleDropsEnabled()) {
Misc.dropItems(loc, is, catciDrops);
Misc.dropItems(location, is, catciDrops);
}
break;
case CROPS:
if (configInstance.getWheatDoubleDropsEnabled()) {
Misc.dropItem(loc, is);
Misc.dropItem(location, is);
}
break;
case MELON_BLOCK:
if (configInstance.getMelonsDoubleDropsEnabled()) {
Misc.dropItems(loc, is, 3);
Misc.randomDropItems(loc, is, 50, 4);
Misc.dropItems(location, is, 3);
Misc.randomDropItems(location, is, 50, 4);
}
break;
case NETHER_WARTS:
if (configInstance.getNetherWartsDoubleDropsEnabled()) {
Misc.dropItems(loc, is, 2);
Misc.randomDropItems(loc, is, 50, 3);
Misc.dropItems(location, is, 2);
Misc.randomDropItems(location, is, 50, 3);
}
break;
case PUMPKIN:
if (configInstance.getPumpkinsDoubleDropsEnabled()) {
Misc.dropItem(loc, is);
Misc.dropItem(location, is);
}
break;
case RED_MUSHROOM:
if (configInstance.getRedMushroomsDoubleDropsEnabled()) {
Misc.dropItem(loc, is);
Misc.dropItem(location, is);
}
break;
case SUGAR_CANE_BLOCK:
if (configInstance.getSugarCaneDoubleDropsEnabled()) {
Misc.dropItems(loc, is, caneDrops);
Misc.dropItems(location, is, caneDrops);
}
break;
case VINE:
if (configInstance.getVinesDoubleDropsEnabled()) {
Misc.dropItem(loc, is);
Misc.dropItem(location, is);
}
break;
case WATER_LILY:
if (configInstance.getWaterLiliesDoubleDropsEnabled()) {
Misc.dropItem(loc, is);
Misc.dropItem(location, is);
}
break;
case YELLOW_FLOWER:
if (configInstance.getYellowFlowersDoubleDropsEnabled()) {
Misc.dropItem(loc, is);
Misc.dropItem(location, is);
}
break;
@ -295,11 +295,11 @@ public class Herbalism {
is = customBlock.getItemDrop();
if (minimumDropAmount != maximumDropAmount) {
Misc.dropItems(loc, is, minimumDropAmount);
Misc.randomDropItems(loc, is, 50, maximumDropAmount - minimumDropAmount);
Misc.dropItems(location, is, minimumDropAmount);
Misc.randomDropItems(location, is, 50, maximumDropAmount - minimumDropAmount);
}
else {
Misc.dropItems(loc, is, minimumDropAmount);
Misc.dropItems(location, is, minimumDropAmount);
}
}
break;
@ -325,7 +325,7 @@ public class Herbalism {
int herbLevel = profile.getSkillLevel(SkillType.HERBALISM);
PlayerInventory inventory = player.getInventory();
boolean hasSeeds = inventory.contains(Material.SEEDS);
Location loc = block.getLocation();
Location location = block.getLocation();
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)) {
event.setCancelled(true);
Misc.dropItem(loc, new ItemStack(Material.WHEAT));
Misc.randomDropItems(loc, new ItemStack(Material.SEEDS), 50, 3);
Misc.dropItem(location, new ItemStack(Material.WHEAT));
Misc.randomDropItems(location, new ItemStack(Material.SEEDS), 50, 3);
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
*/
private static void silkTouchDrops(Block block) {
Location loc = block.getLocation();
Location location = block.getLocation();
Material type = block.getType();
ItemStack item = new ItemStack(type);
Config configInstance = Config.getInstance();
@ -51,44 +51,44 @@ public class Mining {
case COAL_ORE:
if (configInstance.getCoalDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case DIAMOND_ORE:
if (configInstance.getDiamondDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case GLOWING_REDSTONE_ORE:
case REDSTONE_ORE:
if (configInstance.getRedstoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case GLOWSTONE:
if (configInstance.getGlowstoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case LAPIS_ORE:
if (configInstance.getLapisDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case STONE:
if (configInstance.getStoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
default:
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;
}
@ -101,7 +101,7 @@ public class Mining {
* @param block The block to process drops for
*/
public static void miningDrops(Block block) {
Location loc = block.getLocation();
Location location = block.getLocation();
Material type = block.getType();
ItemStack item = new ItemStack(type);
Config configInstance = Config.getInstance();
@ -110,20 +110,20 @@ public class Mining {
case COAL_ORE:
if (configInstance.getCoalDoubleDropsEnabled()) {
item = new ItemStack(Material.COAL, 1, (short) 0, CoalType.COAL.getData());
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case DIAMOND_ORE:
if (configInstance.getDiamondDoubleDropsEnabled()) {
item = new ItemStack(Material.DIAMOND);
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case ENDER_STONE:
if (configInstance.getEndStoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
@ -131,67 +131,67 @@ public class Mining {
case REDSTONE_ORE:
if (configInstance.getRedstoneDoubleDropsEnabled()) {
item = new ItemStack(Material.REDSTONE);
Misc.dropItems(loc, item, 4);
Misc.randomDropItem(loc, item, 50);
Misc.dropItems(location, item, 4);
Misc.randomDropItem(location, item, 50);
}
break;
case GLOWSTONE:
if (configInstance.getGlowstoneDoubleDropsEnabled()) {
item = new ItemStack(Material.GLOWSTONE_DUST);
Misc.dropItems(loc, item, 2);
Misc.randomDropItems(loc, item, 50, 2);
Misc.dropItems(location, item, 2);
Misc.randomDropItems(location, item, 50, 2);
}
break;
case GOLD_ORE:
if (configInstance.getGoldDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case IRON_ORE:
if (configInstance.getIronDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case LAPIS_ORE:
if (configInstance.getLapisDoubleDropsEnabled()) {
item = new ItemStack(Material.INK_SACK, 1, (short) 0, (byte) 0x4);
Misc.dropItems(loc, item, 4);
Misc.randomDropItems(loc, item, 50, 4);
Misc.dropItems(location, item, 4);
Misc.randomDropItems(location, item, 50, 4);
}
break;
case MOSSY_COBBLESTONE:
if (configInstance.getMossyCobblestoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case NETHERRACK:
if (configInstance.getNetherrackDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case OBSIDIAN:
if (configInstance.getObsidianDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case SANDSTONE:
if (configInstance.getSandstoneDoubleDropsEnabled()) {
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
case STONE:
if (configInstance.getStoneDoubleDropsEnabled()) {
item = new ItemStack(Material.COBBLESTONE);
Misc.dropItem(loc, item);
Misc.dropItem(location, item);
}
break;
@ -204,11 +204,11 @@ public class Mining {
item = ModChecks.getCustomBlock(block).getItemDrop();
if (minimumDropAmount != maximumDropAmount) {
Misc.dropItems(loc, item, minimumDropAmount);
Misc.randomDropItems(loc, item, 50, maximumDropAmount - minimumDropAmount);
Misc.dropItems(location, item, minimumDropAmount);
Misc.randomDropItems(location, item, 50, maximumDropAmount - minimumDropAmount);
}
else {
Misc.dropItems(loc, item, minimumDropAmount);
Misc.dropItems(location, item, minimumDropAmount);
}
}
break;