mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 00:30:07 +01:00
Changed CraftItem to Item in Fishing, one step closer to being free of
CB dependency.
This commit is contained in:
parent
e8030c59f1
commit
7dee6db362
@ -29,6 +29,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Statistic;
|
import org.bukkit.Statistic;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
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.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import org.getspout.spoutapi.SpoutManager;
|
import org.getspout.spoutapi.SpoutManager;
|
||||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||||
import org.getspout.spoutapi.sound.SoundEffect;
|
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.skills.*;
|
||||||
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
|
import com.gmail.nossr50.datatypes.FakeBlockBreakEvent;
|
||||||
|
|
||||||
import net.minecraft.server.Enchantment;
|
|
||||||
|
|
||||||
public class mcBlockListener implements Listener
|
public class mcBlockListener implements Listener
|
||||||
{
|
{
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
@ -153,6 +153,12 @@ public class mcBlockListener implements Listener
|
|||||||
* HERBALISM
|
* HERBALISM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//TNT removal checks - needed for Blast Mining
|
||||||
|
if(block.getTypeId() == 46)
|
||||||
|
{
|
||||||
|
plugin.misc.tntTracker.remove(block);
|
||||||
|
}
|
||||||
|
|
||||||
//Green Terra
|
//Green Terra
|
||||||
if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && block.getTypeId() == 59 && block.getData() == (byte) 0x07)
|
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(LoadProperties.toolsLoseDurabilityFromAbilities)
|
||||||
{
|
{
|
||||||
if(!inhand.getEnchantments().containsKey(Enchantment.DURABILITY))
|
if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY))
|
||||||
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss);
|
||||||
}
|
}
|
||||||
plugin.misc.treeFeller.clear();
|
plugin.misc.treeFeller.clear();
|
||||||
|
@ -154,7 +154,7 @@ public class mcEntityListener implements Listener
|
|||||||
/*
|
/*
|
||||||
* PARTY CHECKS
|
* PARTY CHECKS
|
||||||
*/
|
*/
|
||||||
if(event.getEntity() instanceof Player && f instanceof Player)
|
if(e instanceof Player && f instanceof Player)
|
||||||
{
|
{
|
||||||
Player defender = (Player)e;
|
Player defender = (Player)e;
|
||||||
Player attacker = (Player)f;
|
Player attacker = (Player)f;
|
||||||
|
@ -26,7 +26,6 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
|
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
|
||||||
import org.bukkit.craftbukkit.entity.CraftItem;
|
|
||||||
import org.bukkit.entity.CreatureType;
|
import org.bukkit.entity.CreatureType;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -84,7 +83,7 @@ public class mcPlayerListener implements Listener
|
|||||||
{
|
{
|
||||||
if(event.getState() == State.CAUGHT_FISH)
|
if(event.getState() == State.CAUGHT_FISH)
|
||||||
{
|
{
|
||||||
if(event.getCaught() instanceof CraftItem)
|
if(event.getCaught() instanceof Item)
|
||||||
{
|
{
|
||||||
Fishing.processResults(event);
|
Fishing.processResults(event);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ package com.gmail.nossr50.skills;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.entity.CraftItem;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
@ -86,8 +85,7 @@ public class Fishing {
|
|||||||
private static void getFishingResultsTier1(Player player, PlayerFishEvent event)
|
private static void getFishingResultsTier1(Player player, PlayerFishEvent event)
|
||||||
{
|
{
|
||||||
int randomNum = (int)(Math.random() * 15);
|
int randomNum = (int)(Math.random() * 15);
|
||||||
CraftItem theCatch = (CraftItem)event.getCaught();
|
Item theCatch = (Item)event.getCaught();
|
||||||
|
|
||||||
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier1)
|
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier1)
|
||||||
{
|
{
|
||||||
switch(randomNum)
|
switch(randomNum)
|
||||||
@ -189,7 +187,7 @@ public class Fishing {
|
|||||||
private static void getFishingResultsTier2(Player player, PlayerFishEvent event)
|
private static void getFishingResultsTier2(Player player, PlayerFishEvent event)
|
||||||
{
|
{
|
||||||
int randomNum = (int)(Math.random() * 20);
|
int randomNum = (int)(Math.random() * 20);
|
||||||
CraftItem theCatch = (CraftItem)event.getCaught();
|
Item theCatch = (Item)event.getCaught();
|
||||||
|
|
||||||
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier2)
|
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier2)
|
||||||
{
|
{
|
||||||
@ -322,7 +320,7 @@ public class Fishing {
|
|||||||
private static void getFishingResultsTier3(Player player, PlayerFishEvent event)
|
private static void getFishingResultsTier3(Player player, PlayerFishEvent event)
|
||||||
{
|
{
|
||||||
int randomNum = (int)(Math.random() * 24);
|
int randomNum = (int)(Math.random() * 24);
|
||||||
CraftItem theCatch = (CraftItem)event.getCaught();
|
Item theCatch = (Item)event.getCaught();
|
||||||
|
|
||||||
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier3)
|
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier3)
|
||||||
{
|
{
|
||||||
@ -479,7 +477,7 @@ public class Fishing {
|
|||||||
private static void getFishingResultsTier4(Player player, PlayerFishEvent event)
|
private static void getFishingResultsTier4(Player player, PlayerFishEvent event)
|
||||||
{
|
{
|
||||||
int randomNum = (int)(Math.random() * 41);
|
int randomNum = (int)(Math.random() * 41);
|
||||||
CraftItem theCatch = (CraftItem)event.getCaught();
|
Item theCatch = (Item)event.getCaught();
|
||||||
|
|
||||||
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier4)
|
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier4)
|
||||||
{
|
{
|
||||||
@ -737,7 +735,7 @@ public class Fishing {
|
|||||||
private static void getFishingResultsTier5(Player player, PlayerFishEvent event)
|
private static void getFishingResultsTier5(Player player, PlayerFishEvent event)
|
||||||
{
|
{
|
||||||
int randomNum = (int)(Math.random() * 50);
|
int randomNum = (int)(Math.random() * 50);
|
||||||
CraftItem theCatch = (CraftItem)event.getCaught();
|
Item theCatch = (Item)event.getCaught();
|
||||||
|
|
||||||
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier5)
|
if(Math.random() * 100 < LoadProperties.fishingDropChanceTier5)
|
||||||
{
|
{
|
||||||
@ -1049,7 +1047,7 @@ public class Fishing {
|
|||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
|
|
||||||
Fishing.getFishingResults(player, event);
|
Fishing.getFishingResults(player, event);
|
||||||
CraftItem theCatch = (CraftItem)event.getCaught();
|
Item theCatch = (Item)event.getCaught();
|
||||||
|
|
||||||
if(theCatch.getItemStack().getType() != Material.RAW_FISH)
|
if(theCatch.getItemStack().getType() != Material.RAW_FISH)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user