mirror of
https://github.com/taoneill/war.git
synced 2024-11-13 05:54:31 +01:00
Closes gh-267. Glass walls can be turned off with glasswalls:off. Clearing the latest locations at unload - hello big leak.
This commit is contained in:
commit
b62e8ffd53
@ -73,6 +73,7 @@ public class War extends JavaPlugin {
|
||||
private boolean defaultBlockHeads = true;
|
||||
private boolean defaultFriendlyFire = false;
|
||||
private boolean defaultAutoAssignOnly = false;
|
||||
private boolean defaultFlagPointsOnly = false;
|
||||
private boolean defaultUnbreakableZoneBlocks = false;
|
||||
private boolean defaultNoCreatures = false;
|
||||
private boolean defaultGlassWalls = true;
|
||||
@ -164,6 +165,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
this.getServer().getScheduler().cancelTasks(this);
|
||||
this.playerListener.purgeLatestPositions();
|
||||
|
||||
this.log("War v" + this.desc.getVersion() + " is off.", Level.INFO);
|
||||
this.setLoaded(false);
|
||||
@ -260,6 +262,10 @@ public class War extends JavaPlugin {
|
||||
String onOff = namedParams.get("autoassign");
|
||||
warzone.setAutoAssignOnly(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
if (namedParams.containsKey("flagpointsonly")) {
|
||||
String onOff = namedParams.get("flagpointsonly");
|
||||
warzone.setFlagPointsOnly(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
if (namedParams.containsKey("blockheads")) {
|
||||
String onOff = namedParams.get("blockheads");
|
||||
warzone.setBlockHeads(onOff.equals("on") || onOff.equals("true"));
|
||||
@ -352,6 +358,10 @@ public class War extends JavaPlugin {
|
||||
String onOff = namedParams.get("autoassign");
|
||||
this.setDefaultAutoAssignOnly(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
if (namedParams.containsKey("flagpointsonly")) {
|
||||
String onOff = namedParams.get("flagpointsonly");
|
||||
this.setDefaultFlagPointsOnly(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
if (namedParams.containsKey("pvpinzonesonly")) {
|
||||
String onOff = namedParams.get("pvpinzonesonly");
|
||||
this.setPvpInZonesOnly(onOff.equals("on") || onOff.equals("true"));
|
||||
@ -390,6 +400,10 @@ public class War extends JavaPlugin {
|
||||
String onOff = namedParams.get("nocreatures");
|
||||
this.setDefaultNoCreatures(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
if (namedParams.containsKey("glasswalls")) {
|
||||
String onOff = namedParams.get("glasswalls");
|
||||
this.setDefaultGlassWalls(onOff.equals("on") || onOff.equals("true"));
|
||||
}
|
||||
|
||||
if (namedParams.containsKey("resetonempty")) {
|
||||
String onOff = namedParams.get("resetonempty");
|
||||
@ -428,7 +442,8 @@ public class War extends JavaPlugin {
|
||||
+ " teamsize:" + zone.getTeamCap()
|
||||
+ " maxscore:" + zone.getScoreCap()
|
||||
+ " ff:" + String.valueOf(zone.getFriendlyFire())
|
||||
+ " autoassign:" + String.valueOf(zone.getAutoAssignOnly())
|
||||
+ " autoassign:" + String.valueOf(zone.isAutoAssignOnly())
|
||||
+ " flagpointsonly:" + String.valueOf(zone.isFlagPointsOnly())
|
||||
+ " blockheads:" + String.valueOf(zone.isBlockHeads())
|
||||
+ " spawnstyle:" + zone.getSpawnStyle()
|
||||
+ " flagreturn:" + zone.getFlagReturn()
|
||||
@ -436,6 +451,7 @@ public class War extends JavaPlugin {
|
||||
+ " unbreakable:" + String.valueOf(zone.isUnbreakableZoneBlocks())
|
||||
+ " disabled:" + String.valueOf(zone.isDisabled())
|
||||
+ " nocreatures:" + String.valueOf(zone.isNoCreatures())
|
||||
+ " glasswalls:" + String.valueOf(zone.isGlassWalls())
|
||||
+ " resetonempty:" + String.valueOf(zone.isResetOnEmpty())
|
||||
+ " resetonload:" + String.valueOf(zone.isResetOnLoad())
|
||||
+ " resetonunload:" + String.valueOf(zone.isResetOnUnload());
|
||||
@ -443,24 +459,26 @@ public class War extends JavaPlugin {
|
||||
|
||||
public String printConfig() {
|
||||
return "War config -"
|
||||
+ " pvpinzonesonly:" + String.valueOf(War.war.isPvpInZonesOnly())
|
||||
+ " disablepvpmessage:" + String.valueOf(War.war.isDisablePvpMessage())
|
||||
+ " buildinzonesonly:" + String.valueOf(War.war.isBuildInZonesOnly())
|
||||
+ " pvpinzonesonly:" + String.valueOf(this.isPvpInZonesOnly())
|
||||
+ " disablepvpmessage:" + String.valueOf(this.isDisablePvpMessage())
|
||||
+ " buildinzonesonly:" + String.valueOf(this.isBuildInZonesOnly())
|
||||
+ " - Warzone defaults -"
|
||||
+ " lifepool:" + War.war.getDefaultLifepool()
|
||||
+ " teamsize:" + War.war.getDefaultTeamCap()
|
||||
+ " maxscore:" + War.war.getDefaultScoreCap()
|
||||
+ " ff:" + String.valueOf(War.war.isDefaultFriendlyFire())
|
||||
+ " autoassign:" + String.valueOf(War.war.isDefaultAutoAssignOnly())
|
||||
+ " blockheads:" + String.valueOf(War.war.isDefaultBlockHeads())
|
||||
+ " spawnstyle:" + War.war.getDefaultSpawnStyle()
|
||||
+ " flagreturn:" + War.war.getDefaultFlagReturn()
|
||||
+ " monumentheal:" + War.war.getDefaultMonumentHeal()
|
||||
+ " unbreakable:" + String.valueOf(War.war.isDefaultUnbreakableZoneBlocks())
|
||||
+ " nocreatures:" + String.valueOf(War.war.isDefaultNoCreatures())
|
||||
+ " resetonempty:" + String.valueOf(War.war.isDefaultResetOnEmpty())
|
||||
+ " resetonload:" + String.valueOf(War.war.isDefaultResetOnLoad())
|
||||
+ " resetonunload:" + String.valueOf(War.war.isDefaultResetOnUnload());
|
||||
+ " lifepool:" + this.getDefaultLifepool()
|
||||
+ " teamsize:" + this.getDefaultTeamCap()
|
||||
+ " maxscore:" + this.getDefaultScoreCap()
|
||||
+ " ff:" + String.valueOf(this.isDefaultFriendlyFire())
|
||||
+ " autoassign:" + String.valueOf(this.isDefaultAutoAssignOnly())
|
||||
+ " flagpointsonly:" + String.valueOf(this.isDefaultFlagPointsOnly())
|
||||
+ " blockheads:" + String.valueOf(this.isDefaultBlockHeads())
|
||||
+ " spawnstyle:" + this.getDefaultSpawnStyle()
|
||||
+ " flagreturn:" + this.getDefaultFlagReturn()
|
||||
+ " monumentheal:" + this.getDefaultMonumentHeal()
|
||||
+ " unbreakable:" + String.valueOf(this.isDefaultUnbreakableZoneBlocks())
|
||||
+ " nocreatures:" + String.valueOf(this.isDefaultNoCreatures())
|
||||
+ " glasswalls:" + String.valueOf(this.isDefaultGlassWalls())
|
||||
+ " resetonempty:" + String.valueOf(this.isDefaultResetOnEmpty())
|
||||
+ " resetonload:" + String.valueOf(this.isDefaultResetOnLoad())
|
||||
+ " resetonunload:" + String.valueOf(this.isDefaultResetOnUnload());
|
||||
}
|
||||
|
||||
private void setZoneRallyPoint(String warzoneName, Player player) {
|
||||
@ -898,6 +916,14 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
|
||||
public boolean isDefaultGlassWalls() {
|
||||
return defaultGlassWalls;
|
||||
return this.defaultGlassWalls;
|
||||
}
|
||||
|
||||
public void setDefaultFlagPointsOnly(boolean defaultFlagPointsOnly) {
|
||||
this.defaultFlagPointsOnly = defaultFlagPointsOnly;
|
||||
}
|
||||
|
||||
public boolean isDefaultFlagPointsOnly() {
|
||||
return this.defaultFlagPointsOnly;
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +228,8 @@ public class WarPlayerListener extends PlayerListener {
|
||||
if (previousLocation != null &&
|
||||
playerLoc.getBlockX() == previousLocation.getBlockX() &&
|
||||
playerLoc.getBlockY() == previousLocation.getBlockY() &&
|
||||
playerLoc.getBlockZ() == previousLocation.getBlockZ()) {
|
||||
playerLoc.getBlockZ() == previousLocation.getBlockZ() &&
|
||||
playerLoc.getWorld() == previousLocation.getWorld()) {
|
||||
// we only care when people change location
|
||||
return;
|
||||
}
|
||||
@ -450,6 +451,10 @@ public class WarPlayerListener extends PlayerListener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void purgeLatestPositions() {
|
||||
this.latestLocations.clear();
|
||||
}
|
||||
|
||||
private void handleDisabledZone(PlayerMoveEvent event, Player player, Warzone zone) {
|
||||
if (zone.getLobby() != null) {
|
||||
@ -467,4 +472,6 @@ public class WarPlayerListener extends PlayerListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ public class Warzone {
|
||||
private List<ZoneWallGuard> zoneWallGuards = new ArrayList<ZoneWallGuard>();
|
||||
private ZoneLobby lobby;
|
||||
private boolean autoAssignOnly;
|
||||
private boolean flagPointsOnly;
|
||||
private boolean blockHeads;
|
||||
private boolean unbreakableZoneBlocks;
|
||||
private boolean disabled = false;
|
||||
@ -75,6 +76,7 @@ public class Warzone {
|
||||
this.setLifePool(War.war.getDefaultLifepool());
|
||||
this.setLoadout(War.war.getDefaultLoadout());
|
||||
this.setAutoAssignOnly(War.war.isDefaultAutoAssignOnly());
|
||||
this.setFlagPointsOnly(War.war.isDefaultFlagPointsOnly());
|
||||
this.teamCap = War.war.getDefaultTeamCap();
|
||||
this.scoreCap = War.war.getDefaultScoreCap();
|
||||
this.monumentHeal = War.war.getDefaultMonumentHeal();
|
||||
@ -169,6 +171,11 @@ public class Warzone {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public void setTeleport(Location location) {
|
||||
this.teleport = location;
|
||||
}
|
||||
@ -383,6 +390,11 @@ public class Warzone {
|
||||
return this.friendlyFire;
|
||||
}
|
||||
|
||||
public void setFriendlyFire(boolean ffOn) {
|
||||
this.friendlyFire = ffOn;
|
||||
}
|
||||
|
||||
|
||||
public void setLoadout(HashMap<Integer, ItemStack> newLoadout) {
|
||||
this.loadout.clear();
|
||||
for (Integer slot : newLoadout.keySet()) {
|
||||
@ -416,10 +428,6 @@ public class Warzone {
|
||||
return this.monumentHeal;
|
||||
}
|
||||
|
||||
public void setFriendlyFire(boolean ffOn) {
|
||||
this.friendlyFire = ffOn;
|
||||
}
|
||||
|
||||
public boolean hasPlayerInventory(String playerName) {
|
||||
return this.inventories.containsKey(playerName);
|
||||
}
|
||||
@ -681,10 +689,6 @@ public class Warzone {
|
||||
playerGuards.clear();
|
||||
}
|
||||
|
||||
public boolean getAutoAssignOnly() {
|
||||
return this.isAutoAssignOnly();
|
||||
}
|
||||
|
||||
public void setLobby(ZoneLobby lobby) {
|
||||
this.lobby = lobby;
|
||||
}
|
||||
@ -756,7 +760,7 @@ public class Warzone {
|
||||
for (Team t : teams) {
|
||||
t.teamcast("The battle is over. Team " + playerTeam.getName() + " lost: " + player.getName() + " died and there were no lives left in their life pool.");
|
||||
|
||||
if (t.getPlayers().size() != 0) {
|
||||
if (t.getPlayers().size() != 0 && !this.flagPointsOnly) {
|
||||
if (!t.getName().equals(playerTeam.getName())) {
|
||||
// all other teams get a point
|
||||
t.addPoint();
|
||||
@ -1083,6 +1087,14 @@ public class Warzone {
|
||||
}
|
||||
|
||||
public boolean isGlassWalls() {
|
||||
return glassWalls;
|
||||
return this.glassWalls;
|
||||
}
|
||||
|
||||
public void setFlagPointsOnly(boolean flagPointsOnly) {
|
||||
this.flagPointsOnly = flagPointsOnly;
|
||||
}
|
||||
|
||||
public boolean isFlagPointsOnly() {
|
||||
return this.flagPointsOnly;
|
||||
}
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ public class ZoneLobby {
|
||||
rightSide = BlockFace.SOUTH;
|
||||
}
|
||||
this.teamGateBlocks.clear();
|
||||
if (this.warzone.getAutoAssignOnly()) {
|
||||
if (this.warzone.isAutoAssignOnly()) {
|
||||
this.autoAssignGate = new BlockInfo(lobbyMiddleWallBlock);
|
||||
} else {
|
||||
this.autoAssignGate = null;
|
||||
|
@ -98,6 +98,9 @@ public class WarMapper {
|
||||
// defaultAutoAssignOnly
|
||||
War.war.setDefaultAutoAssignOnly(warConfig.getBoolean("defaultAutoAssignOnly"));
|
||||
|
||||
// defaultFlagPointsOnly
|
||||
War.war.setDefaultFlagPointsOnly(warConfig.getBoolean("defaultFlagPointsOnly"));
|
||||
|
||||
// defaultTeamCap
|
||||
War.war.setDefaultTeamCap(warConfig.getInt("defaultTeamCap"));
|
||||
|
||||
@ -147,6 +150,9 @@ public class WarMapper {
|
||||
|
||||
// defaultNoCreatures
|
||||
War.war.setDefaultNoCreatures(warConfig.getBoolean("defaultNoCreatures"));
|
||||
|
||||
// defaultGlassWalls
|
||||
War.war.setDefaultGlassWalls(warConfig.getBoolean("defaultGlassWalls"));
|
||||
|
||||
// defaultResetOnEmpty
|
||||
War.war.setDefaultResetOnEmpty(warConfig.getBoolean("defaultResetOnEmpty"));
|
||||
@ -216,6 +222,9 @@ public class WarMapper {
|
||||
// defaultAutoAssignOnly
|
||||
warConfig.setBoolean("defaultAutoAssignOnly", War.war.isDefaultAutoAssignOnly());
|
||||
|
||||
// defaultFlagPointsOnly
|
||||
warConfig.setBoolean("defaultFlagPointsOnly", War.war.isDefaultFlagPointsOnly());
|
||||
|
||||
// defaultTeamCap
|
||||
warConfig.setInt("defaultTeamCap", War.war.getDefaultTeamCap());
|
||||
|
||||
@ -257,6 +266,9 @@ public class WarMapper {
|
||||
// defaultNoCreatures
|
||||
warConfig.setBoolean("defaultNoCreatures", War.war.isDefaultNoCreatures());
|
||||
|
||||
// defaultGlassWalls
|
||||
warConfig.setBoolean("defaultGlassWalls", War.war.isDefaultGlassWalls());
|
||||
|
||||
// defaultResetOnEmpty
|
||||
warConfig.setBoolean("defaultResetOnEmpty", War.war.isDefaultResetOnEmpty());
|
||||
|
||||
@ -266,9 +278,6 @@ public class WarMapper {
|
||||
// defaultResetOnUnload
|
||||
warConfig.setBoolean("defaultResetOnUnload", War.war.isDefaultResetOnUnload());
|
||||
|
||||
// defaultDropLootOnDeath
|
||||
// warConfig.setBoolean("defaultDropLootOnDeath", war.isDefaultDropLootOnDeath());
|
||||
|
||||
// warhub
|
||||
String hubStr = "";
|
||||
WarHub hub = War.war.getWarHub();
|
||||
|
@ -150,6 +150,9 @@ public class WarzoneMapper {
|
||||
// autoAssignOnly
|
||||
warzone.setAutoAssignOnly(warzoneConfig.getBoolean("autoAssignOnly"));
|
||||
|
||||
// flagPointsOnly
|
||||
warzone.setAutoAssignOnly(warzoneConfig.getBoolean("flagPointsOnly"));
|
||||
|
||||
// team cap
|
||||
warzone.setTeamCap(warzoneConfig.getInt("teamCap"));
|
||||
|
||||
@ -191,8 +194,12 @@ public class WarzoneMapper {
|
||||
// disabled
|
||||
warzone.setDisabled(warzoneConfig.getBoolean("disabled"));
|
||||
|
||||
// defaultNoCreatures
|
||||
// noCreatures
|
||||
warzone.setNoCreatures(warzoneConfig.getBoolean("noCreatures"));
|
||||
|
||||
// glassWalls
|
||||
warzone.setGlassWalls(warzoneConfig.getBoolean("glassWalls"));
|
||||
|
||||
|
||||
// resetOnEmpty
|
||||
warzone.setResetOnEmpty(warzoneConfig.getBoolean("resetOnEmpty"));
|
||||
@ -359,6 +366,9 @@ public class WarzoneMapper {
|
||||
// autoAssignOnly
|
||||
warzoneConfig.setBoolean("autoAssignOnly", warzone.isAutoAssignOnly());
|
||||
|
||||
// flagPointsOnly
|
||||
warzoneConfig.setBoolean("flagPointsOnly", warzone.isFlagPointsOnly());
|
||||
|
||||
// team cap
|
||||
warzoneConfig.setInt("teamCap", warzone.getTeamCap());
|
||||
|
||||
@ -393,6 +403,9 @@ public class WarzoneMapper {
|
||||
|
||||
// noCreatures
|
||||
warzoneConfig.setBoolean("noCreatures", warzone.isNoCreatures());
|
||||
|
||||
// glassWalls
|
||||
warzoneConfig.setBoolean("glassWalls", warzone.isGlassWalls());
|
||||
|
||||
// resetOnEmpty
|
||||
warzoneConfig.setBoolean("resetOnEmpty", warzone.isResetOnEmpty());
|
||||
@ -462,12 +475,6 @@ public class WarzoneMapper {
|
||||
if (warzone.getLobby() != null) {
|
||||
VolumeMapper.save(warzone.getLobby().getVolume(), warzone.getName());
|
||||
}
|
||||
|
||||
// if (saveBlocks) {
|
||||
// war.getLogger().info("Saved warzone " + warzone.getName() + " config and blocks.");
|
||||
// } else {
|
||||
// war.getLogger().info("Saved warzone " + warzone.getName() + " config.");
|
||||
// }
|
||||
}
|
||||
|
||||
public static void delete(String name) {
|
||||
|
Loading…
Reference in New Issue
Block a user