253 lines
6.1 KiB
Java
253 lines
6.1 KiB
Java
package us.tss3.blockparty.config;
|
|
|
|
import org.bukkit.Location;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.World;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/** Mutable POJO describing a single arena's configuration, mirrors arenas/<name>.yml. */
|
|
public class ArenaConfig {
|
|
|
|
private String name;
|
|
private String worldName;
|
|
private Location lobby;
|
|
private Location spawn;
|
|
private Location spectator;
|
|
private Location billboard;
|
|
private boolean billboardEnabled = true;
|
|
private int[] pos1; // x,y,z block coords
|
|
private int[] pos2;
|
|
|
|
private int minPlayers = 2;
|
|
private int maxPlayers = 16;
|
|
private int countdownDuration = 15;
|
|
private int roundPrepDuration = 5;
|
|
private int floorRemoveDelaySeconds = 1;
|
|
private int floorRestoreDelaySeconds = 3;
|
|
private int startingRoundTime = 20;
|
|
private int minimumRoundTime = 4;
|
|
private int roundTimeReduction = 1;
|
|
private int winEndingDelaySeconds = 6;
|
|
|
|
private List<Material> floorMaterials = new ArrayList<>();
|
|
private boolean allowJoinWhileStarting = true;
|
|
private boolean spectatorsAllowed = true;
|
|
private boolean enabled = false;
|
|
|
|
/** flat serialized layout: "x,y,z,MATERIAL" per generated block, empty until /bp generate */
|
|
private List<String> generatedLayout = new ArrayList<>();
|
|
|
|
public ArenaConfig(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public String getWorldName() {
|
|
return worldName;
|
|
}
|
|
|
|
public void setWorldName(String worldName) {
|
|
this.worldName = worldName;
|
|
}
|
|
|
|
public World getWorld() {
|
|
return worldName == null ? null : org.bukkit.Bukkit.getWorld(worldName);
|
|
}
|
|
|
|
public Location getLobby() {
|
|
return lobby;
|
|
}
|
|
|
|
public void setLobby(Location lobby) {
|
|
this.lobby = lobby;
|
|
if (lobby != null && lobby.getWorld() != null) {
|
|
this.worldName = lobby.getWorld().getName();
|
|
}
|
|
}
|
|
|
|
public Location getSpawn() {
|
|
return spawn;
|
|
}
|
|
|
|
public void setSpawn(Location spawn) {
|
|
this.spawn = spawn;
|
|
}
|
|
|
|
public Location getSpectator() {
|
|
return spectator;
|
|
}
|
|
|
|
public void setSpectator(Location spectator) {
|
|
this.spectator = spectator;
|
|
}
|
|
|
|
public Location getBillboard() {
|
|
return billboard;
|
|
}
|
|
|
|
public void setBillboard(Location billboard) {
|
|
this.billboard = billboard;
|
|
}
|
|
|
|
public boolean isBillboardEnabled() {
|
|
return billboardEnabled;
|
|
}
|
|
|
|
public void setBillboardEnabled(boolean billboardEnabled) {
|
|
this.billboardEnabled = billboardEnabled;
|
|
}
|
|
|
|
public boolean hasBillboard() {
|
|
return billboard != null && billboardEnabled;
|
|
}
|
|
|
|
public int[] getPos1() {
|
|
return pos1;
|
|
}
|
|
|
|
public void setPos1(int[] pos1) {
|
|
this.pos1 = pos1;
|
|
}
|
|
|
|
public int[] getPos2() {
|
|
return pos2;
|
|
}
|
|
|
|
public void setPos2(int[] pos2) {
|
|
this.pos2 = pos2;
|
|
}
|
|
|
|
public boolean hasFloorRegion() {
|
|
return pos1 != null && pos2 != null;
|
|
}
|
|
|
|
public int getMinPlayers() {
|
|
return minPlayers;
|
|
}
|
|
|
|
public void setMinPlayers(int minPlayers) {
|
|
this.minPlayers = minPlayers;
|
|
}
|
|
|
|
public int getMaxPlayers() {
|
|
return maxPlayers;
|
|
}
|
|
|
|
public void setMaxPlayers(int maxPlayers) {
|
|
this.maxPlayers = maxPlayers;
|
|
}
|
|
|
|
public int getCountdownDuration() {
|
|
return countdownDuration;
|
|
}
|
|
|
|
public void setCountdownDuration(int countdownDuration) {
|
|
this.countdownDuration = countdownDuration;
|
|
}
|
|
|
|
public int getRoundPrepDuration() {
|
|
return roundPrepDuration;
|
|
}
|
|
|
|
public void setRoundPrepDuration(int roundPrepDuration) {
|
|
this.roundPrepDuration = roundPrepDuration;
|
|
}
|
|
|
|
public int getFloorRemoveDelaySeconds() {
|
|
return floorRemoveDelaySeconds;
|
|
}
|
|
|
|
public void setFloorRemoveDelaySeconds(int floorRemoveDelaySeconds) {
|
|
this.floorRemoveDelaySeconds = floorRemoveDelaySeconds;
|
|
}
|
|
|
|
public int getFloorRestoreDelaySeconds() {
|
|
return floorRestoreDelaySeconds;
|
|
}
|
|
|
|
public void setFloorRestoreDelaySeconds(int floorRestoreDelaySeconds) {
|
|
this.floorRestoreDelaySeconds = floorRestoreDelaySeconds;
|
|
}
|
|
|
|
public int getStartingRoundTime() {
|
|
return startingRoundTime;
|
|
}
|
|
|
|
public void setStartingRoundTime(int startingRoundTime) {
|
|
this.startingRoundTime = startingRoundTime;
|
|
}
|
|
|
|
public int getMinimumRoundTime() {
|
|
return minimumRoundTime;
|
|
}
|
|
|
|
public void setMinimumRoundTime(int minimumRoundTime) {
|
|
this.minimumRoundTime = minimumRoundTime;
|
|
}
|
|
|
|
public int getRoundTimeReduction() {
|
|
return roundTimeReduction;
|
|
}
|
|
|
|
public void setRoundTimeReduction(int roundTimeReduction) {
|
|
this.roundTimeReduction = roundTimeReduction;
|
|
}
|
|
|
|
public int getWinEndingDelaySeconds() {
|
|
return winEndingDelaySeconds;
|
|
}
|
|
|
|
public void setWinEndingDelaySeconds(int winEndingDelaySeconds) {
|
|
this.winEndingDelaySeconds = winEndingDelaySeconds;
|
|
}
|
|
|
|
public List<Material> getFloorMaterials() {
|
|
return floorMaterials;
|
|
}
|
|
|
|
public void setFloorMaterials(List<Material> floorMaterials) {
|
|
this.floorMaterials = floorMaterials;
|
|
}
|
|
|
|
public boolean isAllowJoinWhileStarting() {
|
|
return allowJoinWhileStarting;
|
|
}
|
|
|
|
public void setAllowJoinWhileStarting(boolean allowJoinWhileStarting) {
|
|
this.allowJoinWhileStarting = allowJoinWhileStarting;
|
|
}
|
|
|
|
public boolean isSpectatorsAllowed() {
|
|
return spectatorsAllowed;
|
|
}
|
|
|
|
public void setSpectatorsAllowed(boolean spectatorsAllowed) {
|
|
this.spectatorsAllowed = spectatorsAllowed;
|
|
}
|
|
|
|
public boolean isEnabled() {
|
|
return enabled;
|
|
}
|
|
|
|
public void setEnabled(boolean enabled) {
|
|
this.enabled = enabled;
|
|
}
|
|
|
|
public List<String> getGeneratedLayout() {
|
|
return generatedLayout;
|
|
}
|
|
|
|
public void setGeneratedLayout(List<String> generatedLayout) {
|
|
this.generatedLayout = generatedLayout;
|
|
}
|
|
|
|
public boolean hasGeneratedLayout() {
|
|
return generatedLayout != null && !generatedLayout.isEmpty();
|
|
}
|
|
}
|