Soup PvP Added

Soup PvP is now a part of warzone config.
Refer to Issue 651.
This commit is contained in:
Nicholasntp 2013-07-01 13:03:12 -05:00 committed by cmastudios
parent f1ce78907e
commit d94b7b3e78
5 changed files with 35 additions and 4 deletions

View File

@ -195,6 +195,7 @@ public class War extends JavaPlugin {
warzoneDefaultConfig.put(WarzoneConfig.AUTOJOIN, false);
warzoneDefaultConfig.put(WarzoneConfig.SCOREBOARD, ScoreboardType.NONE);
warzoneDefaultConfig.put(WarzoneConfig.XPKILLMETER, false);
warzoneDefaultConfig.put(WarzoneConfig.SOUPHEALING, false);
teamDefaultConfig.put(TeamConfig.FLAGMUSTBEHOME, true);
teamDefaultConfig.put(TeamConfig.FLAGPOINTSONLY, false);

View File

@ -748,7 +748,9 @@ 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

@ -23,8 +23,8 @@ public enum WarzoneConfig {
JOINMIDBATTLE (Boolean.class),
AUTOJOIN (Boolean.class),
SCOREBOARD (ScoreboardType.class),
XPKILLMETER (Boolean.class)
;
XPKILLMETER (Boolean.class),
SOUPHEALING (Boolean.class);
private final Class<?> configType;

View File

@ -250,6 +250,34 @@ 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);
}
}
}
}
}
@EventHandler

View File

@ -271,7 +271,7 @@ commands:
\\\\ Warzone defaults \\
/warcfg autoassign:off blockheads:on deathmessages:on disabled:off friendlyfire:off glasswalls:on
instabreak:off minteams:1 minplayers:1 monumentheal:5 nocreatures:off nodrops:off pvpinzone:on
realdeaths:off resetonempty:off resetonconfigchange:off resetonload:off resetonunload:off unbreakable:off \\
realdeaths:off resetonempty:off resetonconfigchange:off resetonload:off resetonunload:off unbreakable:off souphealing:on\\
/warcfg lobbymaterial:<floor/outline/gate/light> -> while holding block, change the look of the lobby (use air block to keep original floor). \\
/warcfg material:<main/stand/light> -> while holding block, change the look of the monument, flag, cake and bomb.
\\\\ Team defaults \\