Added option to disable Herbalism hunger bonuses

This commit is contained in:
GJ 2012-02-17 17:21:54 -05:00
parent b75e7470ae
commit 4e9333e823
3 changed files with 37 additions and 32 deletions

View File

@ -43,7 +43,7 @@ public class LoadProperties {
diamondArmor, woodenTools, stoneTools, ironTools, goldTools, diamondArmor, woodenTools, stoneTools, ironTools, goldTools,
diamondTools, enderPearl, blazeRod, records, glowstoneDust, diamondTools, enderPearl, blazeRod, records, glowstoneDust,
fishingDiamonds, aDisplayNames, pDisplayNames, enableSmoothToMossy, fishingDiamonds, aDisplayNames, pDisplayNames, enableSmoothToMossy,
enableDirtToGrass, statsTracking, eventCallback; enableDirtToGrass, statsTracking, eventCallback, herbalismHungerBonus;
public static String MySQLtablePrefix, MySQLuserName, public static String MySQLtablePrefix, MySQLuserName,
MySQLserverName, MySQLdbName, MySQLdbPass, nWood, nStone, MySQLserverName, MySQLdbName, MySQLdbPass, nWood, nStone,
@ -248,6 +248,7 @@ public class LoadProperties {
mnetherwart = readInteger("Experience.Herbalism.Nether_Wart", 50); mnetherwart = readInteger("Experience.Herbalism.Nether_Wart", 50);
mlilypad = readInteger("Experience.Herbalism.Lily_Pads", 100); mlilypad = readInteger("Experience.Herbalism.Lily_Pads", 100);
mvines = readInteger("Experience.Herbalism.Vines", 10); mvines = readInteger("Experience.Herbalism.Vines", 10);
herbalismHungerBonus = readBoolean("Skills.Herbalism.Hunger_Bonus", true);
mpine = readInteger("Experience.Woodcutting.Pine", 70); mpine = readInteger("Experience.Woodcutting.Pine", 70);
mbirch = readInteger("Experience.Woodcutting.Birch", 80); mbirch = readInteger("Experience.Woodcutting.Birch", 80);

View File

@ -243,40 +243,43 @@ public class mcEntityListener implements Listener
@EventHandler (priority = EventPriority.LOW) @EventHandler (priority = EventPriority.LOW)
public void onFoodLevelChange(FoodLevelChangeEvent event) public void onFoodLevelChange(FoodLevelChangeEvent event)
{ {
if(event.getEntity() instanceof Player) if(LoadProperties.herbalismHungerBonus)
{ {
Player player = (Player) event.getEntity(); if(event.getEntity() instanceof Player)
PlayerProfile PP = Users.getProfile(player);
int currentFoodLevel = player.getFoodLevel();
int newFoodLevel = event.getFoodLevel();
if(newFoodLevel > currentFoodLevel)
{ {
int food = player.getItemInHand().getTypeId(); Player player = (Player) event.getEntity();
PlayerProfile PP = Users.getProfile(player);
int currentFoodLevel = player.getFoodLevel();
int newFoodLevel = event.getFoodLevel();
if(food == 297 || food == 357 || food == 360 || food == 282) if(newFoodLevel > currentFoodLevel)
{ {
int foodChange = newFoodLevel - currentFoodLevel; int food = player.getItemInHand().getTypeId();
int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
if(herbLevel < 200) if(food == 297 || food == 357 || food == 360 || food == 282)
foodChange = foodChange + 1; {
if(herbLevel >= 200 && herbLevel < 400) int foodChange = newFoodLevel - currentFoodLevel;
foodChange = foodChange + 2; int herbLevel = PP.getSkillLevel(SkillType.HERBALISM);
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(herbLevel < 200)
if(newFoodLevel > 20) foodChange = foodChange + 1;
event.setFoodLevel(20); if(herbLevel >= 200 && herbLevel < 400)
if(newFoodLevel <= 20) foodChange = foodChange + 2;
event.setFoodLevel(newFoodLevel); 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);
}
} }
} }
} }

View File

@ -121,6 +121,7 @@ Skills:
Cobble_To_Mossy: true Cobble_To_Mossy: true
SmoothBrick_To_MossyBrick: true SmoothBrick_To_MossyBrick: true
Dirt_To_Grass: true Dirt_To_Grass: true
Hunger_Bonus: true
Mining: Mining:
Level_Cap: 0 Level_Cap: 0
Requires_Pickaxe: true Requires_Pickaxe: true