Restore saturation and tweak some soup pvp actions

This commit is contained in:
cmastudios 2013-09-10 19:14:39 -05:00
parent d94b7b3e78
commit 2bddae16a2
2 changed files with 18 additions and 28 deletions

View File

@ -748,9 +748,7 @@ public class Warzone {
}
return null;
}
public boolean soupHealing() {
return (this.getWarzoneConfig().getBoolean(WarzoneConfig.SOUPHEALING));
}
public boolean isNearWall(Location latestPlayerLocation) {
if (this.volume.hasTwoCorners()) {
if (Math.abs(this.volume.getSoutheastZ() - latestPlayerLocation.getBlockZ()) < this.minSafeDistanceFromWall && latestPlayerLocation.getBlockX() <= this.volume.getSoutheastX() && latestPlayerLocation.getBlockX() >= this.volume.getNorthwestX() && latestPlayerLocation.getBlockY() >= this.volume.getMinY() && latestPlayerLocation.getBlockY() <= this.volume.getMaxY()) {

View File

@ -251,32 +251,24 @@ public class WarPlayerListener implements Listener {
}
}
//Soup-PvP Stuff - nicholasntp
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
Player player = event.getPlayer();
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
if (zone != null && zone.soupHealing()) {
ItemStack item = event.getItem();
if ((item != null) && (item.getType() == Material.MUSHROOM_SOUP)) {
if (player.getHealth() < 20) {
int h = player.getHealth();
if (h < 14) {
player.setHealth((int) (h + 7));
}
else {
player.setHealth(20);
}
item.setType(Material.BOWL);
}
else if (player.getFoodLevel() < 20) {
player.setFoodLevel(20);
item.setType(Material.BOWL);
}
}
}
if (event.getAction() == Action.RIGHT_CLICK_BLOCK
|| event.getAction() == Action.RIGHT_CLICK_AIR) {
Player player = event.getPlayer();
Warzone zone = Warzone.getZoneByPlayerName(player.getName());
if (zone != null && zone.getWarzoneConfig().getBoolean(WarzoneConfig.SOUPHEALING)) {
ItemStack item = event.getItem();
if ((item != null) && (item.getType() == Material.MUSHROOM_SOUP)) {
if (player.getHealth() < 20) {
player.setHealth(Math.min(20, player.getHealth() + 7));
item.setType(Material.BOWL);
} else if (player.getFoodLevel() < 20) {
player.setFoodLevel(Math.min(20, player.getFoodLevel() + 6));
player.setSaturation(player.getSaturation() + 7.2f);
item.setType(Material.BOWL);
}
}
}
}
}