* no settings for killstreaks and have neglected to add any. Heck,
* they shouldn't have enabled killstreaks in the warzone anyway.
*/
return;
}
final Warzone zone = Warzone.getZoneByPlayerName(player.getName());
final Team playerTeam = Team.getTeamByPlayerName(player.getName());
Validate.notNull(zone, "Cannot reward player if they are not in a warzone");
Validate.notNull(playerTeam, "Cannot reward player if they are not in a team");
if (section.contains(Integer.toString(kills))) {
ConfigurationSection killSection = section.getConfigurationSection(Integer.toString(kills));
if (killSection.contains("message")) {
final String playerName = playerTeam.getKind().getColor() + player.getName() + ChatColor.WHITE;
final String message = ChatColor.translateAlternateColorCodes('&', MessageFormat.format(killSection.getString("message"), playerName));
for (Team team : zone.getTeams()) {
team.teamcast(message);
}
}
if (killSection.contains("privmsg")) {
War.war.msg(player, ChatColor.translateAlternateColorCodes('&', killSection.getString("privmsg")));
}
if (killSection.contains("reward.health")) {
double health = player.getHealth() + killSection.getInt("reward.health");
player.setHealth(health > 20 ? 20 : health); // Grant up to full health only
}
if (killSection.contains("reward.items")) {
for (Object obj : killSection.getList("reward.items")) {
if (obj instanceof ItemStack) {
player.getInventory().addItem((ItemStack) obj);
}
}
}
if (killSection.contains("reward.xp") && !playerTeam.getTeamConfig().resolveBoolean(TeamConfig.XPKILLMETER)) {
// Will not work if XPKILLMETER is enabled
player.setLevel(player.getLevel() + killSection.getInt("reward.xp"));
}
if (killSection.contains("reward.points")) {
for (int i = 0; i < killSection.getInt("reward.points"); i++) {
playerTeam.addPoint();
}
// Detect win conditions
if (playerTeam.getPoints() >= playerTeam.getTeamConfig().resolveInt(TeamConfig.MAXSCORE)) {
player.getServer().getScheduler().runTaskLater(War.war, new Runnable() {
public void run() {
zone.handleScoreCapReached(playerTeam.getName());
}
}, 1L);
} else {
// just added a point
playerTeam.resetSign();
zone.getLobby().resetTeamGateSign(playerTeam);
}
}
if (killSection.getBoolean("reward.airstrike")) {
this.airstrikePlayers.add(player.getName());
}