Changed CraftItem to Item in Fishing, one step closer to being free of

CB dependency.
This commit is contained in:
GJ 2012-02-09 14:04:48 -05:00
parent e8030c59f1
commit 7dee6db362
4 changed files with 17 additions and 14 deletions

View File

@ -29,6 +29,7 @@ import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -39,6 +40,7 @@ import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.inventory.ItemStack;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.player.SpoutPlayer;
import org.getspout.spoutapi.sound.SoundEffect;
@ -47,8 +49,6 @@ import com.gmail.nossr50.locale.mcLocale;
import com.gmail.nossr50.skills.*;
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
import net.minecraft.server.Enchantment;
public class mcBlockListener implements Listener
{
private final mcMMO plugin;
@ -153,6 +153,12 @@ public class mcBlockListener implements Listener
* HERBALISM
*/
//TNT removal checks - needed for Blast Mining
if(block.getTypeId() == 46)
{
plugin.misc.tntTracker.remove(block);
}
//Green Terra
if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && block.getTypeId() == 59 && block.getData() == (byte) 0x07)
{
@ -250,7 +256,7 @@ public class mcBlockListener implements Listener
}
if(LoadProperties.toolsLoseDurabilityFromAbilities)
{
if(!inhand.getEnchantments().containsKey(Enchantment.DURABILITY))
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
}
plugin.misc.treeFeller.clear();

View File

@ -154,7 +154,7 @@ public class mcEntityListener implements Listener
/*
* PARTY CHECKS
*/
if(event.getEntity() instanceof Player && f instanceof Player)
if(e instanceof Player && f instanceof Player)
{
Player defender = (Player)e;
Player attacker = (Player)f;

View File

@ -26,7 +26,6 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@ -84,7 +83,7 @@ public class mcPlayerListener implements Listener
{
if(event.getState() == State.CAUGHT_FISH)
{
if(event.getCaught() instanceof CraftItem)
if(event.getCaught() instanceof Item)
{
Fishing.processResults(event);
}

View File

@ -18,7 +18,6 @@ package com.gmail.nossr50.skills;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.entity.CraftItem;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.*;
import org.bukkit.event.player.PlayerFishEvent;
@ -86,8 +85,7 @@ public class Fishing {
private static void getFishingResultsTier1(Player player, PlayerFishEvent event)
{
int randomNum = (int)(Math.random() * 15);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier1)
{
switch(randomNum)
@ -189,7 +187,7 @@ public class Fishing {
private static void getFishingResultsTier2(Player player, PlayerFishEvent event)
{
int randomNum = (int)(Math.random() * 20);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier2)
{
@ -322,7 +320,7 @@ public class Fishing {
private static void getFishingResultsTier3(Player player, PlayerFishEvent event)
{
int randomNum = (int)(Math.random() * 24);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier3)
{
@ -479,7 +477,7 @@ public class Fishing {
private static void getFishingResultsTier4(Player player, PlayerFishEvent event)
{
int randomNum = (int)(Math.random() * 41);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier4)
{
@ -737,7 +735,7 @@ public class Fishing {
private static void getFishingResultsTier5(Player player, PlayerFishEvent event)
{
int randomNum = (int)(Math.random() * 50);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier5)
{
@ -1049,7 +1047,7 @@ public class Fishing {
PlayerProfile PP = Users.getProfile(player);
Fishing.getFishingResults(player, event);
CraftItem theCatch = (CraftItem)event.getCaught();
Item theCatch = (Item)event.getCaught();
if(theCatch.getItemStack().getType() != Material.RAW_FISH)
{