mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-04-04 18:56:23 +02:00
Cleanup on Fishing.java, implemented some Enum values elsewhere.
This commit is contained in:
parent
71e09423fe
commit
2c417d28c5
@ -18,6 +18,7 @@ import com.gmail.nossr50.spout.SpoutStuff;
|
|||||||
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.CropState;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -126,7 +127,7 @@ public class mcBlockListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Green Terra
|
//Green Terra
|
||||||
if (PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && ((mat.equals(Material.CROPS) && block.getData() == (byte) 0x7) || Herbalism.canBeGreenTerra(mat))) {
|
if (PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && ((mat.equals(Material.CROPS) && block.getData() == CropState.RIPE.getData()) || Herbalism.canBeGreenTerra(mat))) {
|
||||||
Skills.abilityCheck(player, SkillType.HERBALISM);
|
Skills.abilityCheck(player, SkillType.HERBALISM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.runnables;
|
package com.gmail.nossr50.runnables;
|
||||||
|
|
||||||
|
import org.bukkit.CropState;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
@ -22,20 +23,20 @@ public class GreenThumbTimer implements Runnable {
|
|||||||
//This replants the wheat at a certain stage in development based on Herbalism Skill
|
//This replants the wheat at a certain stage in development based on Herbalism Skill
|
||||||
if (!PP.getGreenTerraMode()) {
|
if (!PP.getGreenTerraMode()) {
|
||||||
if (PP.getSkillLevel(SkillType.HERBALISM) >= 600) {
|
if (PP.getSkillLevel(SkillType.HERBALISM) >= 600) {
|
||||||
block.setData((byte) 0x4);
|
block.setData(CropState.MEDIUM.getData());
|
||||||
}
|
}
|
||||||
else if (PP.getSkillLevel(SkillType.HERBALISM) >= 400) {
|
else if (PP.getSkillLevel(SkillType.HERBALISM) >= 400) {
|
||||||
block.setData((byte) 0x3);
|
block.setData(CropState.SMALL.getData());
|
||||||
}
|
}
|
||||||
else if (PP.getSkillLevel(SkillType.HERBALISM) >= 200) {
|
else if (PP.getSkillLevel(SkillType.HERBALISM) >= 200) {
|
||||||
block.setData((byte) 0x2);
|
block.setData(CropState.VERY_SMALL.getData());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
block.setData((byte) 0x1);
|
block.setData(CropState.GERMINATED.getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
block.setData((byte) 0x4);
|
block.setData(CropState.MEDIUM.getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
package com.gmail.nossr50.skills;
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Sheep;
|
||||||
import org.bukkit.event.player.PlayerFishEvent;
|
import org.bukkit.event.player.PlayerFishEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.material.Wool;
|
import org.bukkit.material.Wool;
|
||||||
@ -22,346 +28,318 @@ import com.gmail.nossr50.locale.mcLocale;
|
|||||||
|
|
||||||
public class Fishing {
|
public class Fishing {
|
||||||
|
|
||||||
//Return the fishing tier for the player
|
/**
|
||||||
public static int getFishingLootTier(PlayerProfile PP)
|
* Get the player's current fishing loot tier.
|
||||||
{
|
*
|
||||||
int lvl = PP.getSkillLevel(SkillType.FISHING);
|
* @param PP The profile of the player
|
||||||
|
* @return the player's current fishing rank
|
||||||
|
*/
|
||||||
|
public static int getFishingLootTier(PlayerProfile PP) {
|
||||||
|
int level = PP.getSkillLevel(SkillType.FISHING);
|
||||||
|
int fishingTier;
|
||||||
|
|
||||||
if(lvl >= LoadProperties.fishingTier1 && lvl < LoadProperties.fishingTier2)
|
if (level >= LoadProperties.fishingTier5) {
|
||||||
return 1;
|
fishingTier = 5;
|
||||||
else if (lvl >= LoadProperties.fishingTier2 && lvl < LoadProperties.fishingTier3)
|
}
|
||||||
return 2;
|
else if (level >= LoadProperties.fishingTier4) {
|
||||||
else if (lvl >= LoadProperties.fishingTier3 && lvl < LoadProperties.fishingTier4)
|
fishingTier = 4;
|
||||||
return 3;
|
}
|
||||||
else if (lvl >= LoadProperties.fishingTier4 && lvl < LoadProperties.fishingTier5)
|
else if (level >= LoadProperties.fishingTier3) {
|
||||||
return 4;
|
fishingTier = 3;
|
||||||
else
|
}
|
||||||
return 5;
|
else if (level >= LoadProperties.fishingTier2) {
|
||||||
}
|
fishingTier = 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fishingTier = 1;
|
||||||
|
}
|
||||||
|
|
||||||
public static void getFishingResults(Player player, PlayerFishEvent event)
|
return fishingTier;
|
||||||
{
|
}
|
||||||
switch(getFishingLootTier(Users.getProfile(player)))
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
getFishingResultsTier1(player, event);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
getFishingResultsTier2(player, event);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
getFishingResultsTier3(player, event);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
getFishingResultsTier4(player, event);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
getFishingResultsTier5(player, event);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m.mcDropItem(player.getLocation(), new ItemStack(Material.RAW_FISH, 1));
|
|
||||||
Users.getProfile(player).addXP(SkillType.FISHING, LoadProperties.mfishing, player);
|
|
||||||
Skills.XpCheckSkill(SkillType.FISHING, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void getFishingResultsTier1(Player player, PlayerFishEvent event)
|
/**
|
||||||
{
|
* Get item results from Fishing.
|
||||||
Item theCatch = (Item)event.getCaught();
|
*
|
||||||
if(LoadProperties.fishingDrops)
|
* @param player The player that was fishing
|
||||||
{
|
* @param event The event to modify
|
||||||
List<FishingTreasure> rewards = LoadTreasures.fishingRewardsTier1;
|
*/
|
||||||
FishingTreasure treasure = rewards.get((int)(Math.random() * rewards.size()));
|
private static void getFishingResults(Player player, PlayerFishEvent event) {
|
||||||
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
List<FishingTreasure> rewards = new ArrayList<FishingTreasure>();
|
||||||
{
|
Item theCatch = (Item) event.getCaught();
|
||||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
|
||||||
theCatch.setItemStack(treasure.getDrop());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
|
||||||
|
|
||||||
//Change durability to random value
|
|
||||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void getFishingResultsTier2(Player player, PlayerFishEvent event)
|
switch (getFishingLootTier(PP)) {
|
||||||
{
|
case 1:
|
||||||
Item theCatch = (Item)event.getCaught();
|
rewards = LoadTreasures.fishingRewardsTier1;
|
||||||
if(LoadProperties.fishingDrops)
|
break;
|
||||||
{
|
|
||||||
List<FishingTreasure> rewards = LoadTreasures.fishingRewardsTier2;
|
|
||||||
FishingTreasure treasure = rewards.get((int)(Math.random() * rewards.size()));
|
|
||||||
|
|
||||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
|
||||||
{
|
|
||||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
|
||||||
theCatch.setItemStack(treasure.getDrop());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
|
||||||
|
|
||||||
//Change durability to random value
|
|
||||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void getFishingResultsTier3(Player player, PlayerFishEvent event)
|
case 2:
|
||||||
{
|
rewards = LoadTreasures.fishingRewardsTier2;
|
||||||
Item theCatch = (Item)event.getCaught();
|
break;
|
||||||
if(LoadProperties.fishingDrops)
|
|
||||||
{
|
|
||||||
List<FishingTreasure> rewards = LoadTreasures.fishingRewardsTier3;
|
|
||||||
FishingTreasure treasure = rewards.get((int)(Math.random() * rewards.size()));
|
|
||||||
|
|
||||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
|
||||||
{
|
|
||||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
|
||||||
theCatch.setItemStack(treasure.getDrop());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
|
||||||
|
|
||||||
//Change durability to random value
|
|
||||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void getFishingResultsTier4(Player player, PlayerFishEvent event)
|
case 3:
|
||||||
{
|
rewards = LoadTreasures.fishingRewardsTier3;
|
||||||
Item theCatch = (Item)event.getCaught();
|
break;
|
||||||
if(LoadProperties.fishingDrops)
|
|
||||||
{
|
|
||||||
List<FishingTreasure> rewards = LoadTreasures.fishingRewardsTier4;
|
|
||||||
FishingTreasure treasure = rewards.get((int)(Math.random() * rewards.size()));
|
|
||||||
|
|
||||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
|
||||||
{
|
|
||||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
|
||||||
theCatch.setItemStack(treasure.getDrop());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
|
||||||
|
|
||||||
//Change durability to random value
|
|
||||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void getFishingResultsTier5(Player player, PlayerFishEvent event)
|
case 4:
|
||||||
{
|
rewards = LoadTreasures.fishingRewardsTier4;
|
||||||
Item theCatch = (Item)event.getCaught();
|
break;
|
||||||
if(LoadProperties.fishingDrops)
|
|
||||||
{
|
|
||||||
List<FishingTreasure> rewards = LoadTreasures.fishingRewardsTier5;
|
|
||||||
FishingTreasure treasure = rewards.get((int)(Math.random() * rewards.size()));
|
|
||||||
|
|
||||||
if(Math.random() * 100 > (100.00 - treasure.getDropChance()))
|
|
||||||
{
|
|
||||||
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
|
||||||
theCatch.setItemStack(treasure.getDrop());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
|
||||||
|
|
||||||
//Change durability to random value
|
|
||||||
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change the damage value
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void processResults(PlayerFishEvent event)
|
|
||||||
{
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
|
||||||
|
|
||||||
Fishing.getFishingResults(player, event);
|
case 5:
|
||||||
Item theCatch = (Item)event.getCaught();
|
rewards = LoadTreasures.fishingRewardsTier5;
|
||||||
|
break;
|
||||||
|
|
||||||
if(theCatch.getItemStack().getType() != Material.RAW_FISH)
|
default:
|
||||||
{
|
break;
|
||||||
//Inform the player they retrieved a treasure...
|
}
|
||||||
player.sendMessage(mcLocale.getString("Fishing.ItemFound"));
|
|
||||||
|
|
||||||
//Keep track of whether or not the treasure is enchanted
|
if (LoadProperties.fishingDrops) {
|
||||||
boolean enchanted = false;
|
FishingTreasure treasure = rewards.get((int) (Math.random() * rewards.size()));
|
||||||
|
|
||||||
ItemStack fishingResults = theCatch.getItemStack();
|
if (Math.random() * 100 <= treasure.getDropChance()) {
|
||||||
if(Repair.isArmor(fishingResults) || Repair.isTools(fishingResults))
|
Users.getProfile(player).addXP(SkillType.FISHING, treasure.getXp(), player);
|
||||||
{
|
theCatch.setItemStack(treasure.getDrop());
|
||||||
//Fishing up items will have a 10% chance to enter them into random enchantment lottery
|
}
|
||||||
if(Math.random() * 100 < 10)
|
}
|
||||||
{
|
else {
|
||||||
for(Enchantment x : Enchantment.values())
|
theCatch.setItemStack(new ItemStack(Material.RAW_FISH));
|
||||||
{
|
}
|
||||||
if(x.canEnchantItem(fishingResults))
|
|
||||||
{
|
|
||||||
//Prevent impossible enchantment combinations
|
|
||||||
if((fishingResults.containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL) || fishingResults.containsEnchantment(Enchantment.PROTECTION_EXPLOSIONS) ||
|
|
||||||
fishingResults.containsEnchantment(Enchantment.PROTECTION_FIRE) || fishingResults.containsEnchantment(Enchantment.PROTECTION_PROJECTILE)) &&
|
|
||||||
(x.equals(Enchantment.PROTECTION_EXPLOSIONS) || x.equals(Enchantment.PROTECTION_PROJECTILE) || x.equals(Enchantment.PROTECTION_FIRE) || x.equals(Enchantment.PROTECTION_ENVIRONMENTAL))){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//More impossible enchantment combinations
|
|
||||||
else if((fishingResults.containsEnchantment(Enchantment.DAMAGE_ALL) || fishingResults.containsEnchantment(Enchantment.DAMAGE_ARTHROPODS) || fishingResults.containsEnchantment(Enchantment.DAMAGE_UNDEAD)) &&
|
|
||||||
(x.equals(Enchantment.DAMAGE_ALL) || x.equals(Enchantment.DAMAGE_ARTHROPODS) || x.equals(Enchantment.DAMAGE_UNDEAD))){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Even more impossible enchantment combinations
|
|
||||||
else if((fishingResults.containsEnchantment(Enchantment.SILK_TOUCH) || fishingResults.containsEnchantment(Enchantment.LOOT_BONUS_BLOCKS)) &&
|
|
||||||
(x.equals(Enchantment.SILK_TOUCH) || x.equals(Enchantment.LOOT_BONUS_BLOCKS))){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
else{
|
|
||||||
//Actual chance to have an enchantment is related to your fishing skill
|
|
||||||
if(Math.random() * 15 < Fishing.getFishingLootTier(PP))
|
|
||||||
{
|
|
||||||
enchanted = true;
|
|
||||||
int randomEnchantLevel = (int)(Math.random() * x.getMaxLevel()) + 1;
|
|
||||||
|
|
||||||
if(randomEnchantLevel == 0)
|
|
||||||
randomEnchantLevel = 1;
|
|
||||||
|
|
||||||
fishingResults.addEnchantment(x, randomEnchantLevel);
|
theCatch.getItemStack().setDurability((short) (Math.random() * theCatch.getItemStack().getType().getMaxDurability())); //Change durability to random value
|
||||||
}
|
|
||||||
}
|
m.mcDropItem(player.getLocation(), new ItemStack(Material.RAW_FISH)); //Always drop a fish
|
||||||
}
|
PP.addXP(SkillType.FISHING, LoadProperties.mfishing, player);
|
||||||
}
|
Skills.XpCheckSkill(SkillType.FISHING, player);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
//Inform the player of magical properties
|
* Process results from Fishing.
|
||||||
if(enchanted)
|
*
|
||||||
{
|
* @param event The event to modify
|
||||||
player.sendMessage(mcLocale.getString("Fishing.MagicFound"));
|
*/
|
||||||
}
|
public static void processResults(PlayerFishEvent event) {
|
||||||
}
|
Player player = event.getPlayer();
|
||||||
}
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
public static void shakeMob(PlayerFishEvent event)
|
|
||||||
{
|
getFishingResults(player, event);
|
||||||
|
Item theCatch = (Item)event.getCaught();
|
||||||
LivingEntity le = (LivingEntity) event.getCaught();
|
|
||||||
EntityType type = le.getType();
|
if (theCatch.getItemStack().getType() != Material.RAW_FISH) {
|
||||||
Location loc = le.getLocation();
|
final int ENCHANTMENT_CHANCE = 10;
|
||||||
|
boolean enchanted = false;
|
||||||
switch(type)
|
ItemStack fishingResults = theCatch.getItemStack();
|
||||||
{
|
|
||||||
case BLAZE:
|
player.sendMessage(mcLocale.getString("Fishing.ItemFound"));
|
||||||
m.mcDropItem(loc, new ItemStack(Material.BLAZE_ROD, 1));
|
if (Repair.isArmor(fishingResults) || Repair.isTools(fishingResults)) {
|
||||||
break;
|
|
||||||
case CAVE_SPIDER:
|
if (Math.random() * 100 <= ENCHANTMENT_CHANCE) {
|
||||||
if(Math.random() * 10 < 5)
|
for (Enchantment enchantment : Enchantment.values()) {
|
||||||
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE, 1));
|
if (enchantment.canEnchantItem(fishingResults)) {
|
||||||
else
|
|
||||||
m.mcDropItem(loc, new ItemStack(Material.STRING, 1));
|
//TODO: Clean this up. It's ugly & unreadable.
|
||||||
break;
|
//Prevent impossible enchantment combinations
|
||||||
case CHICKEN:
|
if ((fishingResults.containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL) || fishingResults.containsEnchantment(Enchantment.PROTECTION_EXPLOSIONS) ||
|
||||||
if(Math.random() * 10 <= 7)
|
fishingResults.containsEnchantment(Enchantment.PROTECTION_FIRE) || fishingResults.containsEnchantment(Enchantment.PROTECTION_PROJECTILE)) &&
|
||||||
{
|
(enchantment.equals(Enchantment.PROTECTION_EXPLOSIONS) || enchantment.equals(Enchantment.PROTECTION_PROJECTILE) || enchantment.equals(Enchantment.PROTECTION_FIRE) || enchantment.equals(Enchantment.PROTECTION_ENVIRONMENTAL))){
|
||||||
if(Math.random() * 10 < 5)
|
return;
|
||||||
m.mcDropItem(loc, new ItemStack(Material.FEATHER, 1));
|
}
|
||||||
else
|
|
||||||
m.mcDropItem(loc, new ItemStack(Material.RAW_CHICKEN, 1));
|
//More impossible enchantment combinations
|
||||||
}
|
else if ((fishingResults.containsEnchantment(Enchantment.DAMAGE_ALL) || fishingResults.containsEnchantment(Enchantment.DAMAGE_ARTHROPODS) || fishingResults.containsEnchantment(Enchantment.DAMAGE_UNDEAD)) &&
|
||||||
else
|
(enchantment.equals(Enchantment.DAMAGE_ALL) || enchantment.equals(Enchantment.DAMAGE_ARTHROPODS) || enchantment.equals(Enchantment.DAMAGE_UNDEAD))){
|
||||||
m.mcDropItem(loc, new ItemStack(Material.EGG, 1));
|
return;
|
||||||
break;
|
}
|
||||||
case COW:
|
|
||||||
if(Math.random() * 100 >= 99)
|
//Even more impossible enchantment combinations
|
||||||
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET, 1)); //rare chance to drop milk
|
else if ((fishingResults.containsEnchantment(Enchantment.SILK_TOUCH) || fishingResults.containsEnchantment(Enchantment.LOOT_BONUS_BLOCKS)) &&
|
||||||
else if(Math.random() * 10 < 5)
|
(enchantment.equals(Enchantment.SILK_TOUCH) || enchantment.equals(Enchantment.LOOT_BONUS_BLOCKS))){
|
||||||
m.mcDropItem(loc, new ItemStack(Material.LEATHER, 1));
|
return;
|
||||||
else
|
}
|
||||||
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF, 1));
|
|
||||||
break;
|
else {
|
||||||
case CREEPER:
|
//Actual chance to have an enchantment is related to your fishing skill
|
||||||
m.mcDropItem(loc, new ItemStack(Material.SULPHUR, 1));
|
if (Math.random() * 15 < Fishing.getFishingLootTier(PP)) {
|
||||||
break;
|
enchanted = true;
|
||||||
case ENDERMAN:
|
int randomEnchantLevel = (int)(Math.random() * enchantment.getMaxLevel()) + 1;
|
||||||
m.mcDropItem(loc, new ItemStack(Material.ENDER_PEARL, 1));
|
|
||||||
break;
|
if (randomEnchantLevel == 0) {
|
||||||
case GHAST:
|
randomEnchantLevel = 1;
|
||||||
if(Math.random() * 10 < 5)
|
}
|
||||||
m.mcDropItem(loc, new ItemStack(Material.SULPHUR, 1));
|
|
||||||
else
|
fishingResults.addEnchantment(enchantment, randomEnchantLevel);
|
||||||
m.mcDropItem(loc, new ItemStack(Material.GHAST_TEAR, 1));
|
}
|
||||||
break;
|
}
|
||||||
case MAGMA_CUBE:
|
}
|
||||||
m.mcDropItem(loc, new ItemStack(Material.MAGMA_CREAM, 1));
|
}
|
||||||
break;
|
}
|
||||||
case MUSHROOM_COW:
|
}
|
||||||
if(Math.random() * 100 >= 99)
|
|
||||||
{
|
if (enchanted) {
|
||||||
if(Math.random() * 10 < 5)
|
player.sendMessage(mcLocale.getString("Fishing.MagicFound"));
|
||||||
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET, 1)); //rare chance to drop milk
|
}
|
||||||
else
|
}
|
||||||
m.mcDropItem(loc, new ItemStack(Material.MUSHROOM_SOUP, 1)); //rare chance to drop soup
|
}
|
||||||
}
|
|
||||||
else if(Math.random() * 10 <= 7)
|
/**
|
||||||
{
|
* Shake a mob, have them drop an item.
|
||||||
if(Math.random() * 10 < 5)
|
*
|
||||||
m.mcDropItem(loc, new ItemStack(Material.LEATHER, 1));
|
* @param event The event to modify
|
||||||
else
|
*/
|
||||||
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF, 1));
|
public static void shakeMob(PlayerFishEvent event) {
|
||||||
}
|
final int DROP_NUMBER = (int) (Math.random() * 101);
|
||||||
else
|
|
||||||
m.mcDropItem(loc, new ItemStack(Material.RED_MUSHROOM, 3));
|
LivingEntity le = (LivingEntity) event.getCaught();
|
||||||
//need some way to remove MushroomCow & replace with regular cow when sheared
|
EntityType type = le.getType();
|
||||||
break;
|
Location loc = le.getLocation();
|
||||||
case PIG:
|
|
||||||
m.mcDropItem(loc, new ItemStack(Material.PORK, 1));
|
switch (type) {
|
||||||
break;
|
case BLAZE:
|
||||||
case PIG_ZOMBIE:
|
m.mcDropItem(loc, new ItemStack(Material.BLAZE_ROD, 1));
|
||||||
if(Math.random() * 10 < 5)
|
break;
|
||||||
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH, 1));
|
|
||||||
else
|
case CAVE_SPIDER:
|
||||||
m.mcDropItem(loc, new ItemStack(Material.GOLD_NUGGET, 1));
|
if (DROP_NUMBER > 50) {
|
||||||
break;
|
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE, 1));
|
||||||
case SHEEP:
|
}
|
||||||
Sheep sheep = (Sheep)le;
|
else {
|
||||||
if(!sheep.isSheared())
|
m.mcDropItem(loc, new ItemStack(Material.STRING, 1));
|
||||||
{
|
}
|
||||||
Wool wool = new Wool();
|
break;
|
||||||
wool.setColor(sheep.getColor());
|
|
||||||
ItemStack theWool = wool.toItemStack();
|
case CHICKEN:
|
||||||
theWool.setAmount((int)(Math.random() * 6));
|
if (DROP_NUMBER > 66) {
|
||||||
m.mcDropItem(loc, theWool);
|
m.mcDropItem(loc, new ItemStack(Material.FEATHER, 1));
|
||||||
sheep.setSheared(true);
|
}
|
||||||
}
|
else if (DROP_NUMBER > 33) {
|
||||||
break;
|
m.mcDropItem(loc, new ItemStack(Material.RAW_CHICKEN, 1));
|
||||||
case SKELETON:
|
}
|
||||||
if(Math.random() * 10 < 5)
|
else {
|
||||||
m.mcDropItem(loc, new ItemStack(Material.BONE, 1));
|
m.mcDropItem(loc, new ItemStack(Material.EGG, 1));
|
||||||
else
|
}
|
||||||
m.mcDropItem(loc, new ItemStack(Material.ARROW, 3));
|
break;
|
||||||
break;
|
|
||||||
case SLIME:
|
case COW:
|
||||||
m.mcDropItem(loc, new ItemStack(Material.SLIME_BALL, 1));
|
if (DROP_NUMBER > 99) {
|
||||||
break;
|
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET, 1));
|
||||||
case SNOWMAN:
|
}
|
||||||
if(Math.random() * 100 >= 99)
|
else if (DROP_NUMBER > 50) {
|
||||||
m.mcDropItem(loc, new ItemStack(Material.PUMPKIN, 1)); //rare chance to drop pumpkin
|
m.mcDropItem(loc, new ItemStack(Material.LEATHER, 1));
|
||||||
else
|
}
|
||||||
m.mcDropItem(loc, new ItemStack(Material.SNOW_BALL, 5));
|
else {
|
||||||
break;
|
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF, 1));
|
||||||
case SPIDER:
|
}
|
||||||
if(Math.random() * 10 < 5)
|
break;
|
||||||
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE, 1));
|
|
||||||
else
|
case CREEPER:
|
||||||
m.mcDropItem(loc, new ItemStack(Material.STRING, 1));
|
m.mcDropItem(loc, new ItemStack(Material.SULPHUR, 1));
|
||||||
break;
|
break;
|
||||||
case SQUID:
|
|
||||||
m.mcDropItem(loc, new ItemStack(Material.INK_SACK, 1, (byte)0, (byte)0));
|
case ENDERMAN:
|
||||||
break;
|
m.mcDropItem(loc, new ItemStack(Material.ENDER_PEARL, 1));
|
||||||
case ZOMBIE:
|
break;
|
||||||
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH, 1));
|
|
||||||
break;
|
case GHAST:
|
||||||
default:
|
if (DROP_NUMBER > 50) {
|
||||||
return;
|
m.mcDropItem(loc, new ItemStack(Material.SULPHUR, 1));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
Combat.dealDamage(le, 1);
|
m.mcDropItem(loc, new ItemStack(Material.GHAST_TEAR, 1));
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MAGMA_CUBE:
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.MAGMA_CREAM, 1));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MUSHROOM_COW:
|
||||||
|
if (DROP_NUMBER > 99) {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.MILK_BUCKET, 1));
|
||||||
|
}
|
||||||
|
else if (DROP_NUMBER > 98) {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.MUSHROOM_SOUP, 1));
|
||||||
|
}
|
||||||
|
else if (DROP_NUMBER > 66) {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.LEATHER, 1));
|
||||||
|
}
|
||||||
|
else if (DROP_NUMBER > 33) {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.RAW_BEEF, 1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.RED_MUSHROOM, 3));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PIG:
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.PORK, 1));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PIG_ZOMBIE:
|
||||||
|
if (DROP_NUMBER > 50) {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH, 1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.GOLD_NUGGET, 1));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SHEEP:
|
||||||
|
Sheep sheep = (Sheep) le;
|
||||||
|
|
||||||
|
if (!sheep.isSheared()) {
|
||||||
|
Wool wool = new Wool();
|
||||||
|
wool.setColor(sheep.getColor());
|
||||||
|
|
||||||
|
ItemStack theWool = wool.toItemStack();
|
||||||
|
theWool.setAmount((int)(Math.random() * 6));
|
||||||
|
|
||||||
|
m.mcDropItem(loc, theWool);
|
||||||
|
sheep.setSheared(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SKELETON:
|
||||||
|
if (DROP_NUMBER > 50) {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.BONE, 1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.ARROW, 3));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SLIME:
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.SLIME_BALL, 1));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SNOWMAN:
|
||||||
|
if (DROP_NUMBER > 99) {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.PUMPKIN, 1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.SNOW_BALL, 5));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SPIDER:
|
||||||
|
if (DROP_NUMBER > 50) {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.SPIDER_EYE, 1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.STRING, 1));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SQUID:
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.INK_SACK, 1, (byte) 0x0, DyeColor.BLACK.getData()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ZOMBIE:
|
||||||
|
m.mcDropItem(loc, new ItemStack(Material.ROTTEN_FLESH, 1));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Combat.dealDamage(le, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills;
|
package com.gmail.nossr50.skills;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.CropState;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -143,7 +144,7 @@ public class Herbalism {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CROPS:
|
case CROPS:
|
||||||
if (data == (byte) 0x7) {
|
if (data == CropState.RIPE.getData()) {
|
||||||
mat = Material.WHEAT;
|
mat = Material.WHEAT;
|
||||||
xp = LoadProperties.mwheat;
|
xp = LoadProperties.mwheat;
|
||||||
greenThumbWheat(block, player, event, plugin);
|
greenThumbWheat(block, player, event, plugin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user