package de._82grfl1bif.KPI_Visualizer.structures; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; import org.bukkit.block.Block; public class Builder { public void setFoundation(Server server, Location startLocation, int x, int z, Material material) { for (int cx = 0; cx < x; cx++) { for (int cz = 0; cz < z; cz++) { Block block = server.getWorlds().get(0).getBlockAt(startLocation.clone().add(cx, 0, cz)); block.setType(material); } } } public void fillQube(Server server, Location startLocation, int x, int y, int z, Material material) { for (int cy = 0; cy < y; cy++) { setFoundation(server, startLocation.clone().add(0, cy, 0), x, z, material); } } private void setWalls(Server server, Location startLocation, int x, int y,Material material) { Location save = startLocation.clone(); Location temp = startLocation.clone(); for (int cx = 0; cx < x - 1; cx++) {// x+x Wall for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(cx,cy,1)).setType(material); } } temp = save.clone(); for (int cz = 0; cz < x - 1; cz++) {// z+x Wall for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(1, cy, cz)).setType(material); } } temp = save.clone().add(0, 0, x - 1); for (int cx = 0; cx < x; cx++) {// x+x z+x Wall from x+x for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(cx, cy, -1)).setType(material); } } temp = save.clone().add(x - 1, 0, 0); for (int cz = 0; cz < x - 1; cz++) {// x+x z+x Wall from x+z for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(-1, cy, cz)).setType(material); } } temp = save.clone(); for (int cx = 0; cx < x - 1; cx++) {// x+x Wall for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(cx, cy, 0)).setType(Material.GLASS); } } temp = save.clone(); for (int cz = 0; cz < x - 1; cz++) {// z+x Wall for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(0, cy, cz)).setType(Material.GLASS); } } temp = save.clone().add(0, 0, x - 1); for (int cx = 0; cx < x; cx++) {// x+x z+x Wall from x+x for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(cx, cy, 0)).setType(Material.GLASS); } } temp = save.clone().add(x - 1, 0, 0); for (int cz = 0; cz < x - 1; cz++) {// x+x z+x Wall from x+z for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(0, cy, cz)).setType(Material.GLASS); } } temp = save.clone(); for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(0, cy, 0)).setType(Material.BLACKSTONE); } temp = save.clone().add(x - 1, 0, 0); for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(0, cy, 0)).setType(Material.BLACKSTONE); } temp = save.clone().add(0, 0, x - 1); for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(0, cy, 0)).setType(Material.BLACKSTONE); } temp = save.clone().add(x - 1, 0, x - 1); for (int cy = 0; cy < y; cy++) { server.getWorlds().get(0).getBlockAt(temp.clone().add(0, cy, 0)).setType(Material.BLACKSTONE); } save.add(0,y,0);//roof setFoundation(server,save,x,x,Material.BLACKSTONE); } public void buildBuilding(Server server, Location startLocation, int x, int y, Material material) { setWalls(server, startLocation.clone().add(0, 1, 0), x, y, material); } }