Closes gh-73. Closes gh-292. Easy spleef with two new settings: pvpinzone (default true) and instabreak (default false). Former off, latter on makes for spleef. Killing by arrows now can't be done through spawn protection. I got carried away and prettied up the kill messages. Also added check in mappers so that default values don't get overridden by 0 or false from the config file reader.

This commit is contained in:
taoneill 2011-09-26 22:08:34 -04:00
parent 599e6b11d5
commit 0811431b0a
9 changed files with 306 additions and 120 deletions

View File

@ -63,6 +63,8 @@ public class War extends JavaPlugin {
private boolean pvpInZonesOnly = false;
private boolean disablePvpMessage = false;
private boolean buildInZonesOnly = false;
private final List<String> deadlyAdjectives = new ArrayList<String>();
private final List<String> killerVerbs = new ArrayList<String>();
// Default warzone settings
private final HashMap<Integer, ItemStack> defaultLoadout = new HashMap<Integer, ItemStack>();
@ -78,6 +80,8 @@ public class War extends JavaPlugin {
private boolean defaultUnbreakableZoneBlocks = false;
private boolean defaultNoCreatures = false;
private boolean defaultGlassWalls = true;
private boolean defaultPvpInZone = true;
private boolean defaultInstaBreak = false;
private int defaultMinPlayers = 1; // By default, 1 player on 1 team is enough for unlocking the cant-exit-spawn guard
private int defaultMinTeams = 1;
private FlagReturn defaultFlagReturn = FlagReturn.BOTH;
@ -138,17 +142,39 @@ public class War extends JavaPlugin {
pm.registerEvent(Event.Type.ENTITY_REGAIN_HEALTH, this.entityListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_PLACE, this.blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_DAMAGE, this.blockListener, Priority.Normal, this);
pm.registerEvent(Event.Type.BLOCK_BREAK, this.blockListener, Priority.Normal, this);
}
// Load files from disk or create them (using these defaults)
this.getDefaultLoadout().clear();
this.getDefaultLoadout().put(0, new ItemStack(Material.STONE_SWORD, 1, (byte) 8));
this.getDefaultLoadout().put(1, new ItemStack(Material.BOW, 1, (byte) 8));
this.getDefaultLoadout().put(2, new ItemStack(Material.ARROW, 7));
this.getDefaultLoadout().put(3, new ItemStack(Material.IRON_PICKAXE, 1, (byte) 8));
this.getDefaultLoadout().put(4, new ItemStack(Material.STONE_SPADE, 1, (byte) 8));
this.getDefaultReward().clear();
this.getDefaultReward().put(0, new ItemStack(Material.CAKE, 1));
this.getDeadlyAdjectives().clear();
this.getDeadlyAdjectives().add("");
this.getDeadlyAdjectives().add("");
this.getDeadlyAdjectives().add("mighty ");
this.getDeadlyAdjectives().add("deadly ");
this.getDeadlyAdjectives().add("fine ");
this.getDeadlyAdjectives().add("precise ");
this.getDeadlyAdjectives().add("brutal ");
this.getKillerVerbs().clear();
this.getKillerVerbs().add("killed");
this.getKillerVerbs().add("killed");
this.getKillerVerbs().add("killed");
this.getKillerVerbs().add("finished");
this.getKillerVerbs().add("annihilated");
this.getKillerVerbs().add("murdered");
this.getKillerVerbs().add("obliterated");
this.getKillerVerbs().add("exterminated");
WarMapper.load();
HelmetProtectionTask helmetProtectionTask = new HelmetProtectionTask();
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, helmetProtectionTask, 250, 100);
@ -320,6 +346,16 @@ public class War extends JavaPlugin {
warzone.setGlassWalls(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" glasswalls set to " + String.valueOf(warzone.isGlassWalls()) + ".");
}
if (namedParams.containsKey("pvpinzone")) {
String onOff = namedParams.get("pvpinzone");
warzone.setPvpInZone(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" pvpinzone set to " + String.valueOf(warzone.isPvpInZone()) + ".");
}
if (namedParams.containsKey("instabreak")) {
String onOff = namedParams.get("instabreak");
warzone.setInstaBreak(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" instabreak set to " + String.valueOf(warzone.isInstaBreak()) + ".");
}
if (namedParams.containsKey("minplayers")) {
int val = Integer.parseInt(namedParams.get("minplayers"));
if (val > warzone.getTeamCap()) {
@ -491,6 +527,16 @@ public class War extends JavaPlugin {
this.setDefaultGlassWalls(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" glasswalls set to " + String.valueOf(war.isDefaultGlassWalls()) + ".");
}
if (namedParams.containsKey("pvpinzone")) {
String onOff = namedParams.get("pvpinzone");
this.setDefaultPvpInZone(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" pvpinzone set to " + String.valueOf(war.isDefaultPvpInZone()) + ".");
}
if (namedParams.containsKey("instabreak")) {
String onOff = namedParams.get("instabreak");
this.setDefaultInstaBreak(onOff.equals("on") || onOff.equals("true"));
returnMessage.append(" instabreak set to " + String.valueOf(war.isDefaultInstaBreak()) + ".");
}
if (namedParams.containsKey("minplayers")) {
int val = Integer.parseInt(namedParams.get("minplayers"));
if (val > this.getDefaultTeamCap()) {
@ -583,6 +629,8 @@ public class War extends JavaPlugin {
+ " disabled:" + String.valueOf(zone.isDisabled())
+ " nocreatures:" + String.valueOf(zone.isNoCreatures())
+ " glasswalls:" + String.valueOf(zone.isGlassWalls())
+ " pvpinzone:" + String.valueOf(zone.isPvpInZone())
+ " instabreak:" + String.valueOf(zone.isInstaBreak())
+ " minplayers:" + zone.getMinPlayers()
+ " minteams:" + zone.getMinTeams()
+ " resetonempty:" + String.valueOf(zone.isResetOnEmpty())
@ -609,6 +657,8 @@ public class War extends JavaPlugin {
+ " unbreakable:" + String.valueOf(this.isDefaultUnbreakableZoneBlocks())
+ " nocreatures:" + String.valueOf(this.isDefaultNoCreatures())
+ " glasswalls:" + String.valueOf(this.isDefaultGlassWalls())
+ " pvpinzone:" + String.valueOf(this.isDefaultPvpInZone())
+ " instabreak:" + String.valueOf(this.isDefaultInstaBreak())
+ " minplayers:" + this.getDefaultMinPlayers()
+ " minteams:" + this.getDefaultMinTeams()
+ " resetonempty:" + String.valueOf(this.isDefaultResetOnEmpty())
@ -1100,4 +1150,28 @@ public class War extends JavaPlugin {
public HashMap<String, HashMap<Integer, ItemStack>> getDefaultExtraLoadouts() {
return defaultExtraLoadouts;
}
public void setDefaultPvpInZone(boolean defaultPvpInZone) {
this.defaultPvpInZone = defaultPvpInZone;
}
public boolean isDefaultPvpInZone() {
return defaultPvpInZone;
}
public void setDefaultInstaBreak(boolean defaultInstaBreak) {
this.defaultInstaBreak = defaultInstaBreak;
}
public boolean isDefaultInstaBreak() {
return defaultInstaBreak;
}
public List<String> getDeadlyAdjectives() {
return deadlyAdjectives;
}
public List<String> getKillerVerbs() {
return killerVerbs;
}
}

View File

@ -9,6 +9,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
@ -128,6 +129,21 @@ public class WarBlockListener extends BlockListener {
this.handleBreakOrDamage(player, block, event);
}
}
public void onBlockDamage(BlockDamageEvent event) {
if (!War.war.isLoaded()) {
return;
}
Player player = event.getPlayer();
Block block = event.getBlock();
Warzone playerZone = Warzone.getZoneByLocation(player);
if (player != null && block != null && playerZone != null && playerZone.isInstaBreak()) {
Warzone blockZone = Warzone.getZoneByLocation(new Location(block.getWorld(), block.getX(), block.getY(), block.getZ()));
if (blockZone != null && blockZone == playerZone) {
event.setInstaBreak(true);
}
}
}
private void handleBreakOrDamage(Player player, Block block, Cancellable event) {
Warzone warzone = Warzone.getZoneByLocation(player);

View File

@ -1,21 +1,22 @@
package bukkit.tommytony.war;
import java.awt.Color;
import java.util.List;
import java.util.Random;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.entity.CraftTNTPrimed;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityListener;
@ -33,6 +34,8 @@ import com.tommytony.war.Warzone;
*/
public class WarEntityListener extends EntityListener {
private Random killSeed = new Random();
/**
* Handles PVP-Damage
*
@ -42,6 +45,11 @@ public class WarEntityListener extends EntityListener {
private void handlerAttackDefend(EntityDamageByEntityEvent event) {
Entity attacker = event.getDamager();
Entity defender = event.getEntity();
// Maybe an arrow was thrown
if (attacker != null && event.getDamager() instanceof Projectile && ((Projectile)event.getDamager()).getShooter() instanceof Player){
attacker = ((Player)((Projectile)event.getDamager()).getShooter());
}
if (attacker != null && defender != null && attacker instanceof Player && defender instanceof Player) {
// only let adversaries (same warzone, different team) attack each other
@ -58,21 +66,53 @@ public class WarEntityListener extends EntityListener {
if (!defenderWarzone.isFlagThief(d.getName())) { // thieves can always be attacked
War.war.badMsg(a, "Can't attack a player that's inside his team's spawn.");
event.setCancelled(true);
return;
}
} else if (attackerTeam.getSpawnVolume().contains(a.getLocation()) && !attackerTeam.getSpawnVolume().contains(d.getLocation())) {
// only let a player inside spawn attack an enemy player if that player enters the spawn
if (!attackerWarzone.isFlagThief(a.getName())) { // thieves can always attack
War.war.badMsg(a, "Can't attack a player from inside your spawn.");
event.setCancelled(true);
return;
}
}
if (!attackerWarzone.isPvpInZone()) {
// spleef-like, non-pvp, zone
event.setCancelled(true);
return;
}
// Detect death, prevent it and respawn the player
if (event.getDamage() >= d.getHealth()) {
String killMessage = "";
String attackerString = attackerTeam.getKind().getColor() + a.getDisplayName();
String defenderString = defenderTeam.getKind().getColor() + d.getDisplayName();
killMessage = attackerString + ChatColor.WHITE + " killed " + defenderString;
Material killerWeapon = a.getItemInHand().getType();
String weaponString = killerWeapon.toString();
if (killerWeapon == Material.AIR) {
weaponString = "fist";
} else if (killerWeapon == Material.BOW || event.getDamager() instanceof Arrow) {
int rand = killSeed.nextInt(3);
if (rand == 0) {
weaponString = "arrow";
} else if (rand == 1) {
weaponString = "bow";
} else {
weaponString = "aim";
}
} else if (event.getDamager() instanceof Projectile) {
weaponString = "aim";
}
String adjectiveString = War.war.getDeadlyAdjectives().get(this.killSeed.nextInt(War.war.getDeadlyAdjectives().size()));
String verbString = War.war.getKillerVerbs().get(this.killSeed.nextInt(War.war.getKillerVerbs().size()));
killMessage = attackerString + ChatColor.WHITE + "'s " + adjectiveString + weaponString.toLowerCase().replace('_', ' ')
+ " " + verbString + " " + defenderString;
for (Team team : defenderWarzone.getTeams()) {
team.teamcast(killMessage);
}
@ -117,11 +157,11 @@ public class WarEntityListener extends EntityListener {
if (d != null && defenderWarzone != null && event.getDamage() >= d.getHealth()) {
String deathMessage = "";
String defenderString = Team.getTeamByPlayerName(d.getName()).getKind().getColor() + d.getDisplayName();
if (event.getDamager() instanceof Projectile && ((Projectile)event.getDamager()).getShooter() instanceof Player){
/* if (event.getDamager() instanceof Projectile && ((Projectile)event.getDamager()).getShooter() instanceof Player){
Player shooter = ((Player)((Projectile)event.getDamager()).getShooter());
Team shooterTeam = Team.getTeamByPlayerName(shooter.getName());
deathMessage = shooterTeam.getKind().getColor() + shooter.getDisplayName() + ChatColor.WHITE + "'s deadly aim killed " + defenderString;
} else if (event.getDamager() instanceof CraftTNTPrimed) {
} else */ if (event.getDamager() instanceof CraftTNTPrimed) {
deathMessage = defenderString + ChatColor.WHITE + " exploded";
} else {
deathMessage = defenderString + ChatColor.WHITE + " died";

View File

@ -39,8 +39,8 @@ public class Warzone {
private final List<Monument> monuments = new ArrayList<Monument>();
private Location teleport;
private boolean friendlyFire;
private int lifePool;
private boolean friendlyFire = false;
private int lifePool = 7;
private HashMap<Integer, ItemStack> loadout = new HashMap<Integer, ItemStack>();
private HashMap<String, HashMap<Integer, ItemStack>> extraLoadouts = new HashMap<String, HashMap<Integer, ItemStack>>();
private int teamCap = 5;
@ -57,13 +57,15 @@ public class Warzone {
private final int minSafeDistanceFromWall = 6;
private List<ZoneWallGuard> zoneWallGuards = new ArrayList<ZoneWallGuard>();
private ZoneLobby lobby;
private boolean autoAssignOnly;
private boolean flagPointsOnly;
private boolean blockHeads;
private boolean unbreakableZoneBlocks;
private boolean autoAssignOnly = false;
private boolean flagPointsOnly = false;
private boolean blockHeads = true;
private boolean unbreakableZoneBlocks = false;
private boolean disabled = false;
private boolean noCreatures = false;
private boolean glassWalls = true;
private boolean pvpInZone = true;
private boolean instaBreak = false;
private int minPlayers = 1;
private int minTeams = 1;
@ -74,6 +76,7 @@ public class Warzone {
private HashMap<String, PlayerState> deadMenInventories = new HashMap<String, PlayerState>();
private Location rallyPoint;
@SuppressWarnings("unchecked")
public Warzone(World world, String name) {
this.world = world;
@ -94,6 +97,8 @@ public class Warzone {
this.setUnbreakableZoneBlocks(War.war.isDefaultUnbreakableZoneBlocks());
this.setNoCreatures(War.war.isDefaultNoCreatures());
this.setGlassWalls(War.war.isDefaultGlassWalls());
this.setPvpInZone(War.war.isDefaultPvpInZone());
this.setInstaBreak(War.war.isDefaultInstaBreak());
this.setMinPlayers(War.war.getDefaultMinPlayers());
this.setMinTeams(War.war.getDefaultMinTeams());
this.setResetOnEmpty(War.war.isDefaultResetOnEmpty());
@ -1171,4 +1176,20 @@ public class Warzone {
public HashMap<String, Integer> getNewlyRespawned() {
return newlyRespawned;
}
public boolean isPvpInZone() {
return pvpInZone;
}
public void setPvpInZone(boolean stopPvp) {
this.pvpInZone = stopPvp;
}
public boolean isInstaBreak() {
return instaBreak;
}
public void setInstaBreak(boolean instaBreak) {
this.instaBreak = instaBreak;
}
}

View File

@ -111,40 +111,59 @@ public class WarMapper {
}
// defaultLifePool
War.war.setDefaultLifepool(warConfig.getInt("defaultLifePool"));
if (warConfig.keyExists("defaultLifePool")) {
War.war.setDefaultLifepool(warConfig.getInt("defaultLifePool"));
}
// defaultMonumentHeal
War.war.setDefaultMonumentHeal(warConfig.getInt("defaultMonumentHeal"));
// defaultMonumentHeal
War.war.setDefaultMonumentHeal(warConfig.getInt("defaultMonumentHeal"));
if (warConfig.keyExists("defaultMonumentHeal")) {
War.war.setDefaultMonumentHeal(warConfig.getInt("defaultMonumentHeal"));
}
// defaultFriendlyFire
War.war.setDefaultFriendlyFire(warConfig.getBoolean("defaultFriendlyFire"));
if (warConfig.keyExists("defaultFriendlyFire")) {
War.war.setDefaultFriendlyFire(warConfig.getBoolean("defaultFriendlyFire"));
}
// defaultAutoAssignOnly
War.war.setDefaultAutoAssignOnly(warConfig.getBoolean("defaultAutoAssignOnly"));
if (warConfig.keyExists("defaultAutoAssignOnly")) {
War.war.setDefaultAutoAssignOnly(warConfig.getBoolean("defaultAutoAssignOnly"));
}
// defaultFlagPointsOnly
War.war.setDefaultFlagPointsOnly(warConfig.getBoolean("defaultFlagPointsOnly"));
if (warConfig.keyExists("defaultFlagPointsOnly")) {
War.war.setDefaultFlagPointsOnly(warConfig.getBoolean("defaultFlagPointsOnly"));
}
// defaultTeamCap
War.war.setDefaultTeamCap(warConfig.getInt("defaultTeamCap"));
if (warConfig.keyExists("defaultTeamCap")) {
War.war.setDefaultTeamCap(warConfig.getInt("defaultTeamCap"));
}
// defaultScoreCap
War.war.setDefaultScoreCap(warConfig.getInt("defaultScoreCap"));
if (warConfig.keyExists("defaultScoreCap")) {
War.war.setDefaultScoreCap(warConfig.getInt("defaultScoreCap"));
}
// pvpInZonesOnly
War.war.setPvpInZonesOnly(warConfig.getBoolean("pvpInZonesOnly"));
if (warConfig.keyExists("pvpInZonesOnly")) {
War.war.setPvpInZonesOnly(warConfig.getBoolean("pvpInZonesOnly"));
}
// defaultBlockHeads
War.war.setDefaultBlockHeads(warConfig.getBoolean("defaultBlockHeads"));
if (warConfig.keyExists("defaultBlockHeads")) {
War.war.setDefaultBlockHeads(warConfig.getBoolean("defaultBlockHeads"));
}
// buildInZonesOnly
War.war.setBuildInZonesOnly(warConfig.getBoolean("buildInZonesOnly"));
if (warConfig.keyExists("buildInZonesOnly")) {
War.war.setBuildInZonesOnly(warConfig.getBoolean("buildInZonesOnly"));
}
// disablePVPMessage
War.war.setDisablePvpMessage(warConfig.getBoolean("disablePvpMessage"));
if (warConfig.keyExists("disablePvpMessage")) {
War.war.setDisablePvpMessage(warConfig.getBoolean("disablePvpMessage"));
}
// defaultSpawnStyle
String spawnStyle = warConfig.getString("defaultspawnStyle");
@ -173,28 +192,54 @@ public class WarMapper {
}
// defaultUnbreakableZoneBlocks
War.war.setDefaultUnbreakableZoneBlocks(warConfig.getBoolean("defaultUnbreakableZoneBlocks"));
if (warConfig.keyExists("defaultUnbreakableZoneBlocks")) {
War.war.setDefaultUnbreakableZoneBlocks(warConfig.getBoolean("defaultUnbreakableZoneBlocks"));
}
// defaultNoCreatures
War.war.setDefaultNoCreatures(warConfig.getBoolean("defaultNoCreatures"));
if (warConfig.keyExists("defaultNoCreatures")) {
War.war.setDefaultNoCreatures(warConfig.getBoolean("defaultNoCreatures"));
}
// defaultGlassWalls
War.war.setDefaultGlassWalls(warConfig.getBoolean("defaultGlassWalls"));
if (warConfig.keyExists("defaultGlassWalls")) {
War.war.setDefaultGlassWalls(warConfig.getBoolean("defaultGlassWalls"));
}
// defaultPvpInZone
if (warConfig.keyExists("defaultPvpInZone")) {
War.war.setDefaultPvpInZone(warConfig.getBoolean("defaultPvpInZone"));
}
// defaultInstaBreak
if (warConfig.keyExists("defaultInstaBreak")) {
War.war.setDefaultInstaBreak(warConfig.getBoolean("defaultInstaBreak"));
}
// defaultMinPlayers
War.war.setDefaultMinPlayers(warConfig.getInt("defaultMinPlayers"));
if (warConfig.keyExists("defaultMinPlayers")) {
War.war.setDefaultMinPlayers(warConfig.getInt("defaultMinPlayers"));
}
// defaultMinTeams
War.war.setDefaultMinTeams(warConfig.getInt("defaultMinTeams"));
if (warConfig.keyExists("defaultMinTeams")) {
War.war.setDefaultMinTeams(warConfig.getInt("defaultMinTeams"));
}
// defaultResetOnEmpty
War.war.setDefaultResetOnEmpty(warConfig.getBoolean("defaultResetOnEmpty"));
if (warConfig.keyExists("defaultResetOnEmpty")) {
War.war.setDefaultResetOnEmpty(warConfig.getBoolean("defaultResetOnEmpty"));
}
// defaultResetOnLoad
War.war.setDefaultResetOnLoad(warConfig.getBoolean("defaultResetOnLoad"));
if (warConfig.keyExists("defaultResetOnLoad")) {
War.war.setDefaultResetOnLoad(warConfig.getBoolean("defaultResetOnLoad"));
}
// defaultResetOnUnload
War.war.setDefaultResetOnUnload(warConfig.getBoolean("defaultResetOnUnload"));
if (warConfig.keyExists("defaultResetOnUnload")) {
War.war.setDefaultResetOnUnload(warConfig.getBoolean("defaultResetOnUnload"));
}
// warhub
String hubStr = warConfig.getString("warhub");
@ -319,6 +364,12 @@ public class WarMapper {
// defaultGlassWalls
warConfig.setBoolean("defaultGlassWalls", War.war.isDefaultGlassWalls());
// defaultPvpInZone
warConfig.setBoolean("defaultPvpInZone", War.war.isDefaultPvpInZone());
// defaultInstaBreak
warConfig.setBoolean("defaultInstaBreak", War.war.isDefaultInstaBreak());
// defaultMinPlayers
warConfig.setInt("defaultMinPlayers", War.war.getDefaultMinPlayers());

View File

@ -125,7 +125,9 @@ public class WarzoneMapper {
}
// ff
warzone.setFriendlyFire(warzoneConfig.getBoolean("friendlyFire"));
if (warzoneConfig.containsKey("friendlyFire")) {
warzone.setFriendlyFire(warzoneConfig.getBoolean("friendlyFire"));
}
// loadout
String loadoutStr = warzoneConfig.getString("loadout");
@ -167,25 +169,39 @@ public class WarzoneMapper {
// life pool (always set after teams, so the teams' remaining lives get initialized properly by this setter)
warzone.setLifePool(warzoneConfig.getInt("lifePool"));
if (warzoneConfig.containsKey("lifePool")) {
warzone.setLifePool(warzoneConfig.getInt("lifePool"));
}
// monument heal
warzone.setMonumentHeal(warzoneConfig.getInt("monumentHeal"));
if (warzoneConfig.containsKey("monumentHeal")) {
warzone.setMonumentHeal(warzoneConfig.getInt("monumentHeal"));
}
// autoAssignOnly
warzone.setAutoAssignOnlyWithoutResettingLobby(warzoneConfig.getBoolean("autoAssignOnly"));
if (warzoneConfig.containsKey("autoAssignOnly")) {
warzone.setAutoAssignOnlyWithoutResettingLobby(warzoneConfig.getBoolean("autoAssignOnly"));
}
// flagPointsOnly
warzone.setFlagPointsOnly(warzoneConfig.getBoolean("flagPointsOnly"));
if (warzoneConfig.containsKey("flagPointsOnly")) {
warzone.setFlagPointsOnly(warzoneConfig.getBoolean("flagPointsOnly"));
}
// team cap
warzone.setTeamCap(warzoneConfig.getInt("teamCap"));
if (warzoneConfig.containsKey("teamCap")) {
warzone.setTeamCap(warzoneConfig.getInt("teamCap"));
}
// score cap
warzone.setScoreCap(warzoneConfig.getInt("scoreCap"));
if (warzoneConfig.containsKey("scoreCap")) {
warzone.setScoreCap(warzoneConfig.getInt("scoreCap"));
}
// blockHeads
warzone.setBlockHeads(warzoneConfig.getBoolean("blockHeads"));
if (warzoneConfig.containsKey("blockHeads")) {
warzone.setBlockHeads(warzoneConfig.getBoolean("blockHeads"));
}
// spawnStyle
String spawnStyle = warzoneConfig.getString("spawnStyle");
@ -214,31 +230,59 @@ public class WarzoneMapper {
}
// unbreakableZoneBlocks
warzone.setUnbreakableZoneBlocks(warzoneConfig.getBoolean("unbreakableZoneBlocks"));
if (warzoneConfig.containsKey("unbreakableZoneBlocks")) {
warzone.setUnbreakableZoneBlocks(warzoneConfig.getBoolean("unbreakableZoneBlocks"));
}
// disabled
warzone.setDisabled(warzoneConfig.getBoolean("disabled"));
if (warzoneConfig.containsKey("disabled")) {
warzone.setDisabled(warzoneConfig.getBoolean("disabled"));
}
// noCreatures
warzone.setNoCreatures(warzoneConfig.getBoolean("noCreatures"));
if (warzoneConfig.containsKey("noCreatures")) {
warzone.setNoCreatures(warzoneConfig.getBoolean("noCreatures"));
}
// glassWalls
warzone.setGlassWalls(warzoneConfig.getBoolean("glassWalls"));
if (warzoneConfig.containsKey("glassWalls")) {
warzone.setGlassWalls(warzoneConfig.getBoolean("glassWalls"));
}
// pvpInZone
if (warzoneConfig.containsKey("pvpInZone")) {
warzone.setPvpInZone(warzoneConfig.getBoolean("pvpInZone"));
}
// instaBreak
if (warzoneConfig.containsKey("instaBreak")) {
warzone.setInstaBreak(warzoneConfig.getBoolean("instaBreak"));
}
// minPlayers
warzone.setMinPlayers(warzoneConfig.getInt("minPlayers"));
if (warzoneConfig.containsKey("minPlayers")) {
warzone.setMinPlayers(warzoneConfig.getInt("minPlayers"));
}
// minTeams
warzone.setMinTeams(warzoneConfig.getInt("minTeams"));
if (warzoneConfig.containsKey("minTeams")) {
warzone.setMinTeams(warzoneConfig.getInt("minTeams"));
}
// resetOnEmpty
warzone.setResetOnEmpty(warzoneConfig.getBoolean("resetOnEmpty"));
if (warzoneConfig.containsKey("resetOnEmpty")) {
warzone.setResetOnEmpty(warzoneConfig.getBoolean("resetOnEmpty"));
}
// resetOnLoad
warzone.setResetOnLoad(warzoneConfig.getBoolean("resetOnLoad"));
if (warzoneConfig.containsKey("resetOnLoad")) {
warzone.setResetOnLoad(warzoneConfig.getBoolean("resetOnLoad"));
}
// resetOnUnload
warzone.setResetOnUnload(warzoneConfig.getBoolean("resetOnUnload"));
if (warzoneConfig.containsKey("resetOnUnload")) {
warzone.setResetOnUnload(warzoneConfig.getBoolean("resetOnUnload"));
}
// rallyPoint
String rallyPointStr = warzoneConfig.getString("rallyPoint");
@ -451,6 +495,12 @@ public class WarzoneMapper {
// glassWalls
warzoneConfig.setBoolean("glassWalls", warzone.isGlassWalls());
// pvpInZone
warzoneConfig.setBoolean("pvpInZone", warzone.isPvpInZone());
// instaBreak
warzoneConfig.setBoolean("instaBreak", warzone.isInstaBreak());
// minPlayers
warzoneConfig.setInt("minPlayers", warzone.getMinPlayers());

View File

@ -1,66 +0,0 @@
package com.tommytony.war.utils;
import org.bukkit.inventory.ItemStack;
public class InventoryStash {
private ItemStack[] contents;
private ItemStack helmet;
private ItemStack chest;
private ItemStack legs;
private ItemStack feet;
public InventoryStash(ItemStack[] contents) {
this.setContents(contents);
}
public InventoryStash(ItemStack[] contents, ItemStack helmet, ItemStack chest, ItemStack legs, ItemStack feet) {
this.setContents(contents);
this.setHelmet(helmet);
this.setChest(chest);
this.setLegs(legs);
this.setFeet(feet);
}
public void setContents(ItemStack[] contents) {
this.contents = contents;
}
public ItemStack[] getContents() {
return this.contents;
}
public void setHelmet(ItemStack helmet) {
this.helmet = helmet;
}
public ItemStack getHelmet() {
return this.helmet;
}
public void setChest(ItemStack chest) {
this.chest = chest;
}
public ItemStack getChest() {
return this.chest;
}
public void setLegs(ItemStack legs) {
this.legs = legs;
}
public ItemStack getLegs() {
return this.legs;
}
public void setFeet(ItemStack feet) {
this.feet = feet;
}
public ItemStack getFeet() {
return this.feet;
}
}

View File

@ -1,5 +1,5 @@
name: War
version: 1.6 (de Gaulle) PREVIEW 6
version: 1.6 (de Gaulle) FINAL
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
author: tommytony
website: war.tommytony.com

View File

@ -1,5 +1,5 @@
name: War
version: 1.6 (de Gaulle) PREVIEW 6
version: 1.6 (de Gaulle) FINAL
description: Lets you create TDM and CTF (warzones) for a more structured PVP experience.
author: tommytony
website: war.tommytony.com