mirror of
https://github.com/taoneill/war.git
synced 2025-02-17 03:41:20 +01:00
Restore saturation and tweak some soup pvp actions
This commit is contained in:
parent
d94b7b3e78
commit
2bddae16a2
@ -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()) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user