mirror of
https://github.com/taoneill/war.git
synced 2024-11-30 14:13:23 +01:00
Custom lobby materials + hub and lobby outline
Closes gh-63. Warhub and lobby materials can be customized. Warzones take warhub materials as default. Customizable materials: floor, outline (of floor - NEW), gate, light. Only changeable through the war.yml or warzone-x.yml file.
This commit is contained in:
parent
4bebb2d50e
commit
c6b04faa55
@ -45,11 +45,11 @@ import com.tommytony.war.mapper.WarYmlMapper;
|
|||||||
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
import com.tommytony.war.mapper.WarzoneYmlMapper;
|
||||||
import com.tommytony.war.spout.SpoutDisplayer;
|
import com.tommytony.war.spout.SpoutDisplayer;
|
||||||
import com.tommytony.war.structure.WarHub;
|
import com.tommytony.war.structure.WarHub;
|
||||||
|
import com.tommytony.war.structure.HubLobbyMaterials;
|
||||||
import com.tommytony.war.structure.ZoneLobby;
|
import com.tommytony.war.structure.ZoneLobby;
|
||||||
import com.tommytony.war.utility.ChatFixUtil;
|
import com.tommytony.war.utility.ChatFixUtil;
|
||||||
import com.tommytony.war.utility.PlayerState;
|
import com.tommytony.war.utility.PlayerState;
|
||||||
import com.tommytony.war.utility.WarLogFormatter;
|
import com.tommytony.war.utility.WarLogFormatter;
|
||||||
import com.tommytony.war.utility.WarhubMaterials;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main class of War
|
* Main class of War
|
||||||
@ -95,7 +95,7 @@ public class War extends JavaPlugin {
|
|||||||
|
|
||||||
private Logger warLogger;
|
private Logger warLogger;
|
||||||
|
|
||||||
private WarhubMaterials warhubMaterials;
|
private HubLobbyMaterials warhubMaterials = new HubLobbyMaterials(20, (byte)0, 5, (byte)0, 49, (byte)0, 89, (byte)0); // default floor glass, outline planks, gate obsidian, light glowstone
|
||||||
|
|
||||||
public War() {
|
public War() {
|
||||||
super();
|
super();
|
||||||
@ -974,11 +974,11 @@ public class War extends JavaPlugin {
|
|||||||
return this.spoutMessenger ;
|
return this.spoutMessenger ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWarhubMaterials(WarhubMaterials warhubMaterials) {
|
public void setWarhubMaterials(HubLobbyMaterials warhubMaterials) {
|
||||||
this.warhubMaterials = warhubMaterials;
|
this.warhubMaterials = warhubMaterials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WarhubMaterials getWarhubMaterials() {
|
public HubLobbyMaterials getWarhubMaterials() {
|
||||||
return this.warhubMaterials;
|
return this.warhubMaterials;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import com.tommytony.war.spout.SpoutDisplayer;
|
|||||||
import com.tommytony.war.structure.Bomb;
|
import com.tommytony.war.structure.Bomb;
|
||||||
import com.tommytony.war.structure.Cake;
|
import com.tommytony.war.structure.Cake;
|
||||||
import com.tommytony.war.structure.Monument;
|
import com.tommytony.war.structure.Monument;
|
||||||
|
import com.tommytony.war.structure.HubLobbyMaterials;
|
||||||
import com.tommytony.war.structure.ZoneLobby;
|
import com.tommytony.war.structure.ZoneLobby;
|
||||||
import com.tommytony.war.structure.ZoneWallGuard;
|
import com.tommytony.war.structure.ZoneWallGuard;
|
||||||
import com.tommytony.war.utility.LoadoutSelection;
|
import com.tommytony.war.utility.LoadoutSelection;
|
||||||
@ -77,6 +78,8 @@ public class Warzone {
|
|||||||
private final TeamConfigBag teamDefaultConfig;
|
private final TeamConfigBag teamDefaultConfig;
|
||||||
private InventoryBag defaultInventories = new InventoryBag();
|
private InventoryBag defaultInventories = new InventoryBag();
|
||||||
|
|
||||||
|
private HubLobbyMaterials lobbyMaterials = null;
|
||||||
|
|
||||||
private boolean isEndOfGame = false;
|
private boolean isEndOfGame = false;
|
||||||
private boolean isReinitializing = false;
|
private boolean isReinitializing = false;
|
||||||
private final Object gameEndLock = new Object();
|
private final Object gameEndLock = new Object();
|
||||||
@ -87,6 +90,16 @@ public class Warzone {
|
|||||||
this.warzoneConfig = new WarzoneConfigBag(this);
|
this.warzoneConfig = new WarzoneConfigBag(this);
|
||||||
this.teamDefaultConfig = new TeamConfigBag(); // don't use ctor with Warzone, as this changes config resolution
|
this.teamDefaultConfig = new TeamConfigBag(); // don't use ctor with Warzone, as this changes config resolution
|
||||||
this.volume = new ZoneVolume(name, this.getWorld(), this);
|
this.volume = new ZoneVolume(name, this.getWorld(), this);
|
||||||
|
this.lobbyMaterials = new HubLobbyMaterials(
|
||||||
|
War.war.getWarhubMaterials().getFloorId(),
|
||||||
|
War.war.getWarhubMaterials().getFloorData(),
|
||||||
|
War.war.getWarhubMaterials().getOutlineId(),
|
||||||
|
War.war.getWarhubMaterials().getOutlineData(),
|
||||||
|
War.war.getWarhubMaterials().getGateId(),
|
||||||
|
War.war.getWarhubMaterials().getGateData(),
|
||||||
|
War.war.getWarhubMaterials().getLightId(),
|
||||||
|
War.war.getWarhubMaterials().getLightData()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Warzone getZoneByName(String name) {
|
public static Warzone getZoneByName(String name) {
|
||||||
@ -1386,4 +1399,12 @@ public class Warzone {
|
|||||||
this.name = newName;
|
this.name = newName;
|
||||||
this.volume.setName(newName);
|
this.volume.setName(newName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HubLobbyMaterials getLobbyMaterials() {
|
||||||
|
return this.lobbyMaterials;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLobbyMaterials(HubLobbyMaterials lobbyMaterials) {
|
||||||
|
this.lobbyMaterials = lobbyMaterials;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import com.tommytony.war.War;
|
|||||||
import com.tommytony.war.Warzone;
|
import com.tommytony.war.Warzone;
|
||||||
import com.tommytony.war.mapper.VolumeMapper;
|
import com.tommytony.war.mapper.VolumeMapper;
|
||||||
import com.tommytony.war.structure.WarHub;
|
import com.tommytony.war.structure.WarHub;
|
||||||
import com.tommytony.war.utility.WarhubMaterials;
|
import com.tommytony.war.structure.HubLobbyMaterials;
|
||||||
import com.tommytony.war.volume.Volume;
|
import com.tommytony.war.volume.Volume;
|
||||||
|
|
||||||
public class RestoreYmlWarhubJob implements Runnable {
|
public class RestoreYmlWarhubJob implements Runnable {
|
||||||
@ -38,6 +38,14 @@ public class RestoreYmlWarhubJob implements Runnable {
|
|||||||
floorData = floorMaterialSection.getInt("data");
|
floorData = floorMaterialSection.getInt("data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int outlineId = 5; // default planks
|
||||||
|
int outlineData = 0;
|
||||||
|
ConfigurationSection outlineMaterialSection = warhubConfig.getConfigurationSection("materials.outline");
|
||||||
|
if (outlineMaterialSection != null) {
|
||||||
|
outlineId = outlineMaterialSection.getInt("id");
|
||||||
|
outlineData = outlineMaterialSection.getInt("data");
|
||||||
|
}
|
||||||
|
|
||||||
int gateId = 49; // default obsidian
|
int gateId = 49; // default obsidian
|
||||||
int gateData = 0;
|
int gateData = 0;
|
||||||
ConfigurationSection gateMaterialSection = warhubConfig.getConfigurationSection("materials.gate");
|
ConfigurationSection gateMaterialSection = warhubConfig.getConfigurationSection("materials.gate");
|
||||||
@ -54,7 +62,7 @@ public class RestoreYmlWarhubJob implements Runnable {
|
|||||||
lightData = lightMaterialSection.getInt("data");
|
lightData = lightMaterialSection.getInt("data");
|
||||||
}
|
}
|
||||||
|
|
||||||
War.war.setWarhubMaterials(new WarhubMaterials(floorId, (byte)floorData, gateId, (byte)gateData, lightId, (byte)lightData));
|
War.war.setWarhubMaterials(new HubLobbyMaterials(floorId, (byte)floorData, outlineId, (byte)outlineData, gateId, (byte)gateData, lightId, (byte)lightData));
|
||||||
|
|
||||||
World world = War.war.getServer().getWorld(worldName);
|
World world = War.war.getServer().getWorld(worldName);
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
|
@ -171,6 +171,9 @@ public class WarYmlMapper {
|
|||||||
ConfigurationSection floorSection = hubConfigSection.createSection("materials.floor");
|
ConfigurationSection floorSection = hubConfigSection.createSection("materials.floor");
|
||||||
floorSection.set("id", War.war.getWarhubMaterials().getFloorId());
|
floorSection.set("id", War.war.getWarhubMaterials().getFloorId());
|
||||||
floorSection.set("data", War.war.getWarhubMaterials().getFloorData());
|
floorSection.set("data", War.war.getWarhubMaterials().getFloorData());
|
||||||
|
ConfigurationSection outlineSection = hubConfigSection.createSection("materials.outline");
|
||||||
|
outlineSection.set("id", War.war.getWarhubMaterials().getOutlineId());
|
||||||
|
outlineSection.set("data", War.war.getWarhubMaterials().getOutlineData());
|
||||||
ConfigurationSection gateSection = hubConfigSection.createSection("materials.gate");
|
ConfigurationSection gateSection = hubConfigSection.createSection("materials.gate");
|
||||||
gateSection.set("id", War.war.getWarhubMaterials().getGateId());
|
gateSection.set("id", War.war.getWarhubMaterials().getGateId());
|
||||||
gateSection.set("data", War.war.getWarhubMaterials().getGateData());
|
gateSection.set("data", War.war.getWarhubMaterials().getGateData());
|
||||||
|
@ -22,6 +22,7 @@ import com.tommytony.war.config.TeamConfig;
|
|||||||
import com.tommytony.war.config.TeamKind;
|
import com.tommytony.war.config.TeamKind;
|
||||||
import com.tommytony.war.structure.Bomb;
|
import com.tommytony.war.structure.Bomb;
|
||||||
import com.tommytony.war.structure.Cake;
|
import com.tommytony.war.structure.Cake;
|
||||||
|
import com.tommytony.war.structure.HubLobbyMaterials;
|
||||||
import com.tommytony.war.structure.Monument;
|
import com.tommytony.war.structure.Monument;
|
||||||
import com.tommytony.war.structure.ZoneLobby;
|
import com.tommytony.war.structure.ZoneLobby;
|
||||||
import com.tommytony.war.volume.Volume;
|
import com.tommytony.war.volume.Volume;
|
||||||
@ -296,6 +297,41 @@ public class WarzoneYmlMapper {
|
|||||||
lobbyFace = BlockFace.WEST;
|
lobbyFace = BlockFace.WEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lobby materials
|
||||||
|
int floorId = War.war.getWarhubMaterials().getFloorId(); // default warhub
|
||||||
|
int floorData = War.war.getWarhubMaterials().getFloorData();
|
||||||
|
ConfigurationSection floorMaterialSection = warzoneRootSection.getConfigurationSection(lobbyPrefix + "materials.floor");
|
||||||
|
if (floorMaterialSection != null) {
|
||||||
|
floorId = floorMaterialSection.getInt("id");
|
||||||
|
floorData = floorMaterialSection.getInt("data");
|
||||||
|
}
|
||||||
|
|
||||||
|
int outlineId = War.war.getWarhubMaterials().getOutlineId();
|
||||||
|
int outlineData = War.war.getWarhubMaterials().getOutlineData();
|
||||||
|
ConfigurationSection outlineMaterialSection = warzoneRootSection.getConfigurationSection(lobbyPrefix + "materials.outline");
|
||||||
|
if (outlineMaterialSection != null) {
|
||||||
|
outlineId = outlineMaterialSection.getInt("id");
|
||||||
|
outlineData = outlineMaterialSection.getInt("data");
|
||||||
|
}
|
||||||
|
|
||||||
|
int gateId = War.war.getWarhubMaterials().getGateId();
|
||||||
|
int gateData = War.war.getWarhubMaterials().getGateData();;
|
||||||
|
ConfigurationSection gateMaterialSection = warzoneRootSection.getConfigurationSection(lobbyPrefix + "materials.gate");
|
||||||
|
if (gateMaterialSection != null) {
|
||||||
|
gateId = gateMaterialSection.getInt("id");
|
||||||
|
gateData = gateMaterialSection.getInt("data");
|
||||||
|
}
|
||||||
|
|
||||||
|
int lightId = War.war.getWarhubMaterials().getLightId();
|
||||||
|
int lightData = War.war.getWarhubMaterials().getLightData();
|
||||||
|
ConfigurationSection lightMaterialSection = warzoneRootSection.getConfigurationSection(lobbyPrefix + "materials.light");
|
||||||
|
if (lightMaterialSection != null) {
|
||||||
|
lightId = lightMaterialSection.getInt("id");
|
||||||
|
lightData = lightMaterialSection.getInt("data");
|
||||||
|
}
|
||||||
|
|
||||||
|
warzone.setLobbyMaterials(new HubLobbyMaterials(floorId, (byte)floorData, outlineId, (byte)outlineData, gateId, (byte)gateData, lightId, (byte)lightData));
|
||||||
|
|
||||||
// lobby world
|
// lobby world
|
||||||
String lobbyWorldName = warzoneRootSection.getString(lobbyPrefix + "world");
|
String lobbyWorldName = warzoneRootSection.getString(lobbyPrefix + "world");
|
||||||
World lobbyWorld = War.war.getServer().getWorld(lobbyWorldName);
|
World lobbyWorld = War.war.getServer().getWorld(lobbyWorldName);
|
||||||
@ -355,6 +391,19 @@ public class WarzoneYmlMapper {
|
|||||||
ConfigurationSection lobbySection = warzoneInfoSection.createSection("lobby");
|
ConfigurationSection lobbySection = warzoneInfoSection.createSection("lobby");
|
||||||
lobbySection.set("orientation", lobbyOrientation);
|
lobbySection.set("orientation", lobbyOrientation);
|
||||||
lobbySection.set("world", warzone.getLobby().getVolume().getWorld().getName());
|
lobbySection.set("world", warzone.getLobby().getVolume().getWorld().getName());
|
||||||
|
|
||||||
|
ConfigurationSection floorSection = lobbySection.createSection("materials.floor");
|
||||||
|
floorSection.set("id", warzone.getLobbyMaterials().getFloorId());
|
||||||
|
floorSection.set("data", warzone.getLobbyMaterials().getFloorData());
|
||||||
|
ConfigurationSection outlineSection = lobbySection.createSection("materials.outline");
|
||||||
|
outlineSection.set("id", warzone.getLobbyMaterials().getOutlineId());
|
||||||
|
outlineSection.set("data", warzone.getLobbyMaterials().getOutlineData());
|
||||||
|
ConfigurationSection gateSection = lobbySection.createSection("materials.gate");
|
||||||
|
gateSection.set("id", warzone.getLobbyMaterials().getGateId());
|
||||||
|
gateSection.set("data", warzone.getLobbyMaterials().getGateData());
|
||||||
|
ConfigurationSection lightSection = lobbySection.createSection("materials.light");
|
||||||
|
lightSection.set("id", warzone.getLobbyMaterials().getLightId());
|
||||||
|
lightSection.set("data", warzone.getLobbyMaterials().getLightData());
|
||||||
}
|
}
|
||||||
|
|
||||||
// rallyPoint
|
// rallyPoint
|
||||||
|
@ -1,18 +1,23 @@
|
|||||||
package com.tommytony.war.utility;
|
package com.tommytony.war.structure;
|
||||||
|
|
||||||
public class WarhubMaterials {
|
public class HubLobbyMaterials {
|
||||||
private final int floorId;
|
private final int floorId;
|
||||||
private final byte floorData;
|
private final byte floorData;
|
||||||
|
|
||||||
|
private final int outlineId;
|
||||||
|
private final byte outlineData;
|
||||||
|
|
||||||
private final int gateId;
|
private final int gateId;
|
||||||
private final byte gateData;
|
private final byte gateData;
|
||||||
|
|
||||||
private final int lightId;
|
private final int lightId;
|
||||||
private final byte lightData;
|
private final byte lightData;
|
||||||
|
|
||||||
public WarhubMaterials(int floorId, byte floorData, int gateId, byte gateData, int lightId, byte lightData) {
|
public HubLobbyMaterials(int floorId, byte floorData, int outlineId, byte outlineData, int gateId, byte gateData, int lightId, byte lightData) {
|
||||||
this.floorId = floorId;
|
this.floorId = floorId;
|
||||||
this.floorData = floorData;
|
this.floorData = floorData;
|
||||||
|
this.outlineId = outlineId;
|
||||||
|
this.outlineData = outlineData;
|
||||||
this.gateId = gateId;
|
this.gateId = gateId;
|
||||||
this.gateData = gateData;
|
this.gateData = gateData;
|
||||||
this.lightId = lightId;
|
this.lightId = lightId;
|
||||||
@ -43,4 +48,12 @@ public class WarhubMaterials {
|
|||||||
return lightData;
|
return lightData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOutlineId() {
|
||||||
|
return outlineId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getOutlineData() {
|
||||||
|
return outlineData;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -157,6 +157,8 @@ public class WarHub {
|
|||||||
// materials
|
// materials
|
||||||
Material floor = Material.getMaterial(War.war.getWarhubMaterials().getFloorId());
|
Material floor = Material.getMaterial(War.war.getWarhubMaterials().getFloorId());
|
||||||
byte floorData = War.war.getWarhubMaterials().getFloorData();
|
byte floorData = War.war.getWarhubMaterials().getFloorData();
|
||||||
|
Material outline = Material.getMaterial(War.war.getWarhubMaterials().getOutlineId());
|
||||||
|
byte outlineData = War.war.getWarhubMaterials().getOutlineData();
|
||||||
Material gate = Material.getMaterial(War.war.getWarhubMaterials().getGateId());
|
Material gate = Material.getMaterial(War.war.getWarhubMaterials().getGateId());
|
||||||
byte gateData = War.war.getWarhubMaterials().getGateData();
|
byte gateData = War.war.getWarhubMaterials().getGateData();
|
||||||
Material light = Material.getMaterial(War.war.getWarhubMaterials().getLightId());
|
Material light = Material.getMaterial(War.war.getWarhubMaterials().getLightId());
|
||||||
@ -169,6 +171,11 @@ public class WarHub {
|
|||||||
this.volume.setFaceMaterial(BlockFace.DOWN, floor, floorData);
|
this.volume.setFaceMaterial(BlockFace.DOWN, floor, floorData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!outline.equals(Material.AIR)) {
|
||||||
|
// If air, leave original blocks.
|
||||||
|
this.volume.setFloorOutlineMaterial(outline, outlineData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// draw gates
|
// draw gates
|
||||||
Block currentGateBlock = BlockInfo.getBlock(this.location.getWorld(), this.volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(front, hubDepth).getRelative(right, 2);
|
Block currentGateBlock = BlockInfo.getBlock(this.location.getWorld(), this.volume.getCornerOne()).getRelative(BlockFace.UP).getRelative(front, hubDepth).getRelative(right, 2);
|
||||||
|
@ -276,13 +276,37 @@ public class ZoneLobby {
|
|||||||
this.setGatePositions(BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock));
|
this.setGatePositions(BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock));
|
||||||
// flatten the area (set all but floor to air, then replace any floor air blocks with glass)
|
// flatten the area (set all but floor to air, then replace any floor air blocks with glass)
|
||||||
this.volume.clearBlocksThatDontFloat();
|
this.volume.clearBlocksThatDontFloat();
|
||||||
this.volume.setToMaterial(Material.AIR);
|
|
||||||
this.volume.setFaceMaterial(BlockFace.DOWN, Material.GLASS, (byte)0); // beautiful
|
Volume withoutFloor = new Volume(this.volume.getName() + "-nofloor", this.volume.getWorld());
|
||||||
|
withoutFloor.setCornerOne(new BlockInfo(this.volume.getCornerOne().getX(),
|
||||||
|
this.volume.getCornerOne().getY(),
|
||||||
|
this.volume.getCornerOne().getZ(),
|
||||||
|
this.volume.getCornerOne().getTypeId(),
|
||||||
|
this.volume.getCornerOne().getData()));
|
||||||
|
withoutFloor.setCornerOne(this.volume.getCornerTwo());
|
||||||
|
withoutFloor.setToMaterial(Material.AIR);
|
||||||
|
|
||||||
|
Material floor = Material.getMaterial(warzone.getLobbyMaterials().getFloorId());
|
||||||
|
byte floorData = warzone.getLobbyMaterials().getFloorData();
|
||||||
|
Material outline = Material.getMaterial(warzone.getLobbyMaterials().getOutlineId());
|
||||||
|
byte outlineData = warzone.getLobbyMaterials().getOutlineData();
|
||||||
|
Material gate = Material.getMaterial(warzone.getLobbyMaterials().getGateId());
|
||||||
|
byte gateData = warzone.getLobbyMaterials().getGateData();
|
||||||
|
|
||||||
|
if (!floor.equals(Material.AIR)) {
|
||||||
|
// If air, leave original blocks.
|
||||||
|
this.volume.setFaceMaterial(BlockFace.DOWN, floor, floorData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!outline.equals(Material.AIR)) {
|
||||||
|
// If air, leave original blocks.
|
||||||
|
this.volume.setFloorOutlineMaterial(outline, outlineData);
|
||||||
|
}
|
||||||
|
|
||||||
// add war hub link gate
|
// add war hub link gate
|
||||||
if (War.war.getWarHub() != null) {
|
if (War.war.getWarHub() != null) {
|
||||||
Block linkGateBlock = BlockInfo.getBlock(this.volume.getWorld(), this.warHubLinkGate);
|
Block linkGateBlock = BlockInfo.getBlock(this.volume.getWorld(), this.warHubLinkGate);
|
||||||
this.placeGate(linkGateBlock, Material.OBSIDIAN);
|
this.placeGate(linkGateBlock, gate, gateData);
|
||||||
// add warhub sign
|
// add warhub sign
|
||||||
String[] lines = new String[4];
|
String[] lines = new String[4];
|
||||||
lines[0] = "";
|
lines[0] = "";
|
||||||
@ -341,12 +365,22 @@ public class ZoneLobby {
|
|||||||
SignHelper.setToSign(War.war, zoneSignBlock, data, lines);
|
SignHelper.setToSign(War.war, zoneSignBlock, data, lines);
|
||||||
|
|
||||||
// lets get some light in here
|
// lets get some light in here
|
||||||
|
Material light = Material.getMaterial(this.warzone.getLobbyMaterials().getLightId());
|
||||||
|
byte lightData = this.warzone.getLobbyMaterials().getLightData();
|
||||||
if (this.wall == BlockFace.NORTH || this.wall == BlockFace.SOUTH) {
|
if (this.wall == BlockFace.NORTH || this.wall == BlockFace.SOUTH) {
|
||||||
BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.WEST, this.lobbyHalfSide - 1).getRelative(this.wall, 9).setType(Material.GLOWSTONE);
|
Block one = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.WEST, this.lobbyHalfSide - 1).getRelative(this.wall, 9);
|
||||||
BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.EAST, this.lobbyHalfSide - 1).getRelative(this.wall, 9).setType(Material.GLOWSTONE);
|
one.setType(light);
|
||||||
|
one.setData(lightData);
|
||||||
|
Block two = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.EAST, this.lobbyHalfSide - 1).getRelative(this.wall, 9);
|
||||||
|
two.setType(light);
|
||||||
|
two.setData(lightData);
|
||||||
} else {
|
} else {
|
||||||
BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.NORTH, this.lobbyHalfSide - 1).getRelative(this.wall, 9).setType(Material.GLOWSTONE);
|
Block one = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.NORTH, this.lobbyHalfSide - 1).getRelative(this.wall, 9);
|
||||||
BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.SOUTH, this.lobbyHalfSide - 1).getRelative(this.wall, 9).setType(Material.GLOWSTONE);
|
one.setType(light);
|
||||||
|
one.setData(lightData);
|
||||||
|
Block two = BlockInfo.getBlock(this.volume.getWorld(), this.lobbyMiddleWallBlock).getRelative(BlockFace.DOWN).getRelative(BlockFace.SOUTH, this.lobbyHalfSide - 1).getRelative(this.wall, 9);
|
||||||
|
two.setType(light);
|
||||||
|
two.setData(lightData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
War.war.log("Failed to initalize zone lobby for zone " + this.warzone.getName(), java.util.logging.Level.WARNING);
|
War.war.log("Failed to initalize zone lobby for zone " + this.warzone.getName(), java.util.logging.Level.WARNING);
|
||||||
@ -416,7 +450,8 @@ public class ZoneLobby {
|
|||||||
leftSide = BlockFace.NORTH;
|
leftSide = BlockFace.NORTH;
|
||||||
rightSide = BlockFace.SOUTH;
|
rightSide = BlockFace.SOUTH;
|
||||||
}
|
}
|
||||||
block.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
|
block.getRelative(BlockFace.DOWN).setType(Material.getMaterial(this.warzone.getLobbyMaterials().getLightId()));
|
||||||
|
block.getRelative(BlockFace.DOWN).setData(this.warzone.getLobbyMaterials().getLightData());
|
||||||
this.setBlock(block.getRelative(leftSide), teamKind);
|
this.setBlock(block.getRelative(leftSide), teamKind);
|
||||||
this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP), teamKind);
|
this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP), teamKind);
|
||||||
this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), teamKind);
|
this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), teamKind);
|
||||||
@ -427,7 +462,7 @@ public class ZoneLobby {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void placeGate(Block block, Material material) {
|
private void placeGate(Block block, Material material, byte data) {
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
BlockFace leftSide = null; // look at the zone
|
BlockFace leftSide = null; // look at the zone
|
||||||
BlockFace rightSide = null;
|
BlockFace rightSide = null;
|
||||||
@ -444,14 +479,15 @@ public class ZoneLobby {
|
|||||||
leftSide = BlockFace.NORTH;
|
leftSide = BlockFace.NORTH;
|
||||||
rightSide = BlockFace.SOUTH;
|
rightSide = BlockFace.SOUTH;
|
||||||
}
|
}
|
||||||
block.getRelative(BlockFace.DOWN).setType(Material.GLOWSTONE);
|
block.getRelative(BlockFace.DOWN).setType(Material.getMaterial(this.warzone.getLobbyMaterials().getLightId()));
|
||||||
this.setBlock(block.getRelative(leftSide), material);
|
block.getRelative(BlockFace.DOWN).setData(this.warzone.getLobbyMaterials().getLightData());
|
||||||
this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP), material);
|
this.setBlock(block.getRelative(leftSide), material, data);
|
||||||
this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), material);
|
this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP), material, data);
|
||||||
this.setBlock(block.getRelative(rightSide), material);
|
this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), material, data);
|
||||||
this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP), material);
|
this.setBlock(block.getRelative(rightSide), material, data);
|
||||||
this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), material);
|
this.setBlock(block.getRelative(leftSide).getRelative(BlockFace.UP), material, data);
|
||||||
this.setBlock(block.getRelative(BlockFace.UP).getRelative(BlockFace.UP), material);
|
this.setBlock(block.getRelative(rightSide).getRelative(BlockFace.UP).getRelative(BlockFace.UP), material, data);
|
||||||
|
this.setBlock(block.getRelative(BlockFace.UP).getRelative(BlockFace.UP), material, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,8 +496,9 @@ public class ZoneLobby {
|
|||||||
block.setData(kind.getData());
|
block.setData(kind.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBlock(Block block, Material material) {
|
private void setBlock(Block block, Material material, byte data) {
|
||||||
block.setType(material);
|
block.setType(material);
|
||||||
|
block.setData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void placeAutoAssignGate() {
|
private void placeAutoAssignGate() {
|
||||||
@ -484,7 +521,9 @@ public class ZoneLobby {
|
|||||||
List<Team> teams = this.warzone.getTeams();
|
List<Team> teams = this.warzone.getTeams();
|
||||||
|
|
||||||
Block autoAssignGateBlock = BlockInfo.getBlock(this.volume.getWorld(), this.autoAssignGate);
|
Block autoAssignGateBlock = BlockInfo.getBlock(this.volume.getWorld(), this.autoAssignGate);
|
||||||
this.setBlock(autoAssignGateBlock.getRelative(BlockFace.DOWN), (Material.GLOWSTONE));
|
this.setBlock(autoAssignGateBlock.getRelative(BlockFace.DOWN),
|
||||||
|
Material.getMaterial(this.warzone.getLobbyMaterials().getLightId()),
|
||||||
|
this.warzone.getLobbyMaterials().getLightData());
|
||||||
int size = teams.size();
|
int size = teams.size();
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
TeamKind[] doorBlockKinds = new TeamKind[7];
|
TeamKind[] doorBlockKinds = new TeamKind[7];
|
||||||
|
@ -474,6 +474,28 @@ public class Volume {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFloorOutlineMaterial(Material outline, byte outlineData) {
|
||||||
|
try {
|
||||||
|
if (this.hasTwoCorners() && this.isSaved()) {
|
||||||
|
int x = this.getMinX();
|
||||||
|
for (int i = 0; i < this.getSizeX(); i++) {
|
||||||
|
int z = this.getMinZ();
|
||||||
|
for (int k = 0; k < this.getSizeZ(); k++) {
|
||||||
|
if (x == this.getMinX() || x == this.getMaxX() || z == this.getMinZ() || z == this.getMaxZ()) {
|
||||||
|
Block currentBlock = this.getWorld().getBlockAt(x, this.getMinY(), z);
|
||||||
|
currentBlock.setType(outline);
|
||||||
|
currentBlock.setData(outlineData);
|
||||||
|
}
|
||||||
|
z++;
|
||||||
|
}
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
War.war.log("Failed to set floor ouline block to " + outline + "in volume " + this.name + "." + e.getClass().toString() + " " + e.getMessage(), Level.WARNING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void switchMaterials(Material[] oldTypes, Material newType) {
|
private void switchMaterials(Material[] oldTypes, Material newType) {
|
||||||
try {
|
try {
|
||||||
int i = 0, j = 0, k = 0;
|
int i = 0, j = 0, k = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user