mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Added hunger bonuses to Herbalism. (Still need to add cake).
This commit is contained in:
parent
992e6bce86
commit
06d3d8a18f
@ -33,6 +33,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.Combat;
|
||||
@ -239,6 +240,48 @@ public class mcEntityListener implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.MONITOR)
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event)
|
||||
{
|
||||
if(event.getEntity() instanceof Player)
|
||||
{
|
||||
Player player = (Player) event.getEntity();
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
int currentFoodLevel = player.getFoodLevel();
|
||||
int newFoodLevel = event.getFoodLevel();
|
||||
|
||||
if(newFoodLevel > currentFoodLevel)
|
||||
{
|
||||
int food = player.getItemInHand().getTypeId();
|
||||
|
||||
if(food == 297 || food == 357 || food == 360 || food == 282)
|
||||
{
|
||||
int foodChange = newFoodLevel - currentFoodLevel;
|
||||
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
|
||||
|
||||
if(herbLevel < 200)
|
||||
foodChange = foodChange + 1;
|
||||
if(herbLevel >= 200 || herbLevel < 400)
|
||||
foodChange = foodChange + 2;
|
||||
if(herbLevel >= 400 || herbLevel < 600)
|
||||
foodChange = foodChange + 3;
|
||||
if(herbLevel >= 600 || herbLevel < 800)
|
||||
foodChange = foodChange + 4;
|
||||
if(herbLevel >= 800 || herbLevel < 1000)
|
||||
foodChange = foodChange + 5;
|
||||
if(herbLevel >= 1000)
|
||||
foodChange = foodChange + 6;
|
||||
|
||||
newFoodLevel = currentFoodLevel + foodChange;
|
||||
if(newFoodLevel > 20)
|
||||
event.setFoodLevel(20);
|
||||
if(newFoodLevel <= 20)
|
||||
event.setFoodLevel(newFoodLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBow(ItemStack is){
|
||||
if (is.getTypeId() == 261){
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user