Commit b7e294e8 authored by Florian Grabowski's avatar Florian Grabowski
Browse files

Code Style and Imports

parent b262e83d
/src/server/logs/ /src/server/logs/
/src/server/world/
/src/server/plugins/
/src/server/world_nether/
/src/server/world_the_end/
*.class *.class
/.idea/inspectionProfiles/Project_Default.xml /.idea/inspectionProfiles/Project_Default.xml
/.idea/sqldialects.xml /.idea/sqldialects.xml
*.mca
.console_history
package de._82grfl1bif.KPI_Visualizer.commands; package de._82grfl1bif.kpiVisualizer.commands;
import de._82grfl1bif.KPI_Visualizer.data.DataHolder; import de._82grfl1bif.kpiVisualizer.data.DataHolder;
import de._82grfl1bif.KPI_Visualizer.data.JsonParser; import de._82grfl1bif.kpiVisualizer.data.JsonParser;
import de._82grfl1bif.KPI_Visualizer.layouts.TreeMap.Rectangle; import de._82grfl1bif.kpiVisualizer.layouts.treeMap.Rectangle;
import de._82grfl1bif.KPI_Visualizer.layouts.TreeMap.Row; import de._82grfl1bif.kpiVisualizer.layouts.treeMap.Row;
import de._82grfl1bif.KPI_Visualizer.layouts.TreeMap.SquarifiedTreemapLayout; import de._82grfl1bif.kpiVisualizer.layouts.treeMap.SquarifiedTreemapLayout;
import de._82grfl1bif.KPI_Visualizer.structures.*; import de._82grfl1bif.kpiVisualizer.structures.Builder;
import de._82grfl1bif.kpiVisualizer.structures.Building;
import de._82grfl1bif.kpiVisualizer.structures.Foundation;
import de._82grfl1bif.kpiVisualizer.structures.Structure;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
...@@ -21,7 +24,7 @@ import java.awt.*; ...@@ -21,7 +24,7 @@ import java.awt.*;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
public class generateLayout implements CommandExecutor { public class GenerateLayout implements CommandExecutor {
@Override @Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
...@@ -29,7 +32,6 @@ public class generateLayout implements CommandExecutor { ...@@ -29,7 +32,6 @@ public class generateLayout implements CommandExecutor {
sender.sendMessage("please type or select the needed Arguments with tab."); sender.sendMessage("please type or select the needed Arguments with tab.");
return false; return false;
} }
sender.sendMessage("generating SimpleSquareLayout");
Server server = sender.getServer(); Server server = sender.getServer();
Builder builder = new Builder(server); Builder builder = new Builder(server);
Player player = server.getPlayer(sender.getName()); Player player = server.getPlayer(sender.getName());
...@@ -41,6 +43,7 @@ public class generateLayout implements CommandExecutor { ...@@ -41,6 +43,7 @@ public class generateLayout implements CommandExecutor {
if (player != null) { //check if Player exists for getting Start coordinates. if (player != null) { //check if Player exists for getting Start coordinates.
Location location = player.getLocation(); Location location = player.getLocation();
if (args[1].equals("SquarifiedTreemap")) { //check 2. Argument whether to use SquarifiedTreemap or SimpleSquare Layout. if (args[1].equals("SquarifiedTreemap")) { //check 2. Argument whether to use SquarifiedTreemap or SimpleSquare Layout.
sender.sendMessage("generating SquarifiedTreemapLayout");
BukkitRunnable t = new BukkitRunnable() { BukkitRunnable t = new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
...@@ -56,18 +59,13 @@ public class generateLayout implements CommandExecutor { ...@@ -56,18 +59,13 @@ public class generateLayout implements CommandExecutor {
}else{ }else{
builder.fillQube(location.clone().add(r.getOrigin().x,s.getDepth()+100,r.getOrigin().y),(int)(r.getWidth()),((Building)s).getHeight(),(int)(r.getHeight()),s.getMaterial()); builder.fillQube(location.clone().add(r.getOrigin().x,s.getDepth()+100,r.getOrigin().y),(int)(r.getWidth()),((Building)s).getHeight(),(int)(r.getHeight()),s.getMaterial());
} }
if(r.getHeight() >= 5 && r.getWidth() >= 5){
}else{
Bukkit.getLogger().log(Level.SEVERE,"the rectangle is too small");
}
} }
} }
} }
}; };
t.run(); t.run();
return true;
} else { } else {
sender.sendMessage("generating SimpleSquareLayout");
BukkitRunnable t = new BukkitRunnable() { BukkitRunnable t = new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
...@@ -80,8 +78,8 @@ public class generateLayout implements CommandExecutor { ...@@ -80,8 +78,8 @@ public class generateLayout implements CommandExecutor {
} }
}; };
t.run(); t.run();
return true;
} }
return true;
} else { } else {
Bukkit.getLogger().log(Level.SEVERE, "Kein Spieler gefunden."); Bukkit.getLogger().log(Level.SEVERE, "Kein Spieler gefunden.");
......
package de._82grfl1bif.KPI_Visualizer.commands; package de._82grfl1bif.kpiVisualizer.commands;
import de._82grfl1bif.KPI_Visualizer.data.DataHolder; import de._82grfl1bif.kpiVisualizer.data.DataHolder;
import de._82grfl1bif.KPI_Visualizer.structures.Builder; import de._82grfl1bif.kpiVisualizer.structures.Builder;
import de._82grfl1bif.KPI_Visualizer.structures.Building; import de._82grfl1bif.kpiVisualizer.structures.Building;
import de._82grfl1bif.KPI_Visualizer.structures.Structure; import de._82grfl1bif.kpiVisualizer.structures.Structure;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server; import org.bukkit.Server;
...@@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull; ...@@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.logging.Level; import java.util.logging.Level;
@Deprecated
public class SetPreset implements CommandExecutor { public class SetPreset implements CommandExecutor {
@Override @Override
......
package de._82grfl1bif.KPI_Visualizer.data; package de._82grfl1bif.kpiVisualizer.data;
import de._82grfl1bif.KPI_Visualizer.structures.Building; import de._82grfl1bif.kpiVisualizer.structures.Building;
import de._82grfl1bif.KPI_Visualizer.structures.Foundation; import de._82grfl1bif.kpiVisualizer.structures.Foundation;
import de._82grfl1bif.KPI_Visualizer.structures.Structure; import de._82grfl1bif.kpiVisualizer.structures.Structure;
import org.bukkit.Material; import org.bukkit.Material;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -70,7 +70,6 @@ public class DataHolder { ...@@ -70,7 +70,6 @@ public class DataHolder {
public static void generateTreeFromKlassenList(ArrayList<Klasse> klassen) { public static void generateTreeFromKlassenList(ArrayList<Klasse> klassen) {
foundation = new Foundation(0, Material.YELLOW_CONCRETE); foundation = new Foundation(0, Material.YELLOW_CONCRETE);
ArrayList<String> Pakete = new ArrayList<>();
for (Klasse currentKlasse : klassen) { for (Klasse currentKlasse : klassen) {
if (currentKlasse.depth >= 0) { if (currentKlasse.depth >= 0) {
String[] strings = currentKlasse.path.split("/"); String[] strings = currentKlasse.path.split("/");
...@@ -98,6 +97,7 @@ public class DataHolder { ...@@ -98,6 +97,7 @@ public class DataHolder {
} }
} }
@Deprecated
private static Building generateBuilding() { private static Building generateBuilding() {
Building result = new Building(ThreadLocalRandom.current().nextInt(4, 60 + 1), ThreadLocalRandom.current().nextInt(4, 200 + 1), Material.LIME_CONCRETE); Building result = new Building(ThreadLocalRandom.current().nextInt(4, 60 + 1), ThreadLocalRandom.current().nextInt(4, 200 + 1), Material.LIME_CONCRETE);
result.setLocation(foundation.getLocation()); result.setLocation(foundation.getLocation());
......
package de._82grfl1bif.KPI_Visualizer.data; package de._82grfl1bif.kpiVisualizer.data;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
...@@ -6,10 +6,16 @@ import org.json.simple.JSONArray; ...@@ -6,10 +6,16 @@ import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser; import org.json.simple.parser.JSONParser;
import java.io.*; import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
public class JsonParser { public class JsonParser {
...@@ -36,13 +42,13 @@ public class JsonParser { ...@@ -36,13 +42,13 @@ public class JsonParser {
JSONArray entities = (JSONArray) jsonObject.get("entities"); JSONArray entities = (JSONArray) jsonObject.get("entities");
ArrayList<Klasse> entitiesList = new ArrayList<>(); ArrayList<Klasse> entitiesList = new ArrayList<>();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd kk:mm:ss Z"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd kk:mm:ss Z");
for (int i=0; i < entities.size(); i++) { for (Object entity : entities) {
JSONObject object = (JSONObject) entities.get(i); JSONObject object = (JSONObject) entity;
JSONArray commits = (JSONArray) ((JSONObject) entities.get(i)).get("commits"); JSONArray commits = (JSONArray) ((JSONObject) entity).get("commits");
ArrayList<LocalDateTime> dates = new ArrayList<>(); ArrayList<LocalDateTime> dates = new ArrayList<>();
for (Object o: commits){ for (Object o : commits) {
Object date = ((JSONObject) o).get("date"); Object date = ((JSONObject) o).get("date");
LocalDateTime time = LocalDateTime.parse(date.toString(),formatter); LocalDateTime time = LocalDateTime.parse(date.toString(), formatter);
dates.add(time); dates.add(time);
} }
Klasse currentKlasse = new Klasse( Klasse currentKlasse = new Klasse(
...@@ -56,7 +62,7 @@ public class JsonParser { ...@@ -56,7 +62,7 @@ public class JsonParser {
((JSONArray) object.get("variables")).size(), ((JSONArray) object.get("variables")).size(),
Math.round(Float.parseFloat(object.get("complexity").toString())), Math.round(Float.parseFloat(object.get("complexity").toString())),
dates); dates);
if(currentKlasse.depth != -1)entitiesList.add(currentKlasse); if (currentKlasse.depth != -1) entitiesList.add(currentKlasse);
} }
entitiesList.sort(new DepthComparator()); entitiesList.sort(new DepthComparator());
DataHolder.generateTreeFromKlassenList(entitiesList); DataHolder.generateTreeFromKlassenList(entitiesList);
......
package de._82grfl1bif.KPI_Visualizer.data; package de._82grfl1bif.kpiVisualizer.data;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
......
package de._82grfl1bif.KPI_Visualizer.helpers; package de._82grfl1bif.kpiVisualizer.helpers;
import de._82grfl1bif.KPI_Visualizer.data.JsonParser; import de._82grfl1bif.kpiVisualizer.data.JsonParser;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter; import org.bukkit.command.TabCompleter;
......
package de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare; package de._82grfl1bif.kpiVisualizer.layouts.simpleSquare;
import de._82grfl1bif.KPI_Visualizer.structures.Structure; import de._82grfl1bif.kpiVisualizer.structures.Structure;
import java.awt.*; import java.awt.Point;
import java.util.ArrayList; import java.util.ArrayList;
public class Quadrat extends Shape { public class Quadrat extends Shape {
...@@ -62,6 +62,7 @@ public class Quadrat extends Shape { ...@@ -62,6 +62,7 @@ public class Quadrat extends Shape {
return new Point(topRightCorner.x-bottomLeftCorner.x,topRightCorner.y-bottomLeftCorner.y); return new Point(topRightCorner.x-bottomLeftCorner.x,topRightCorner.y-bottomLeftCorner.y);
} }
@Deprecated
public void applyCoordinates(Point coordinates){ public void applyCoordinates(Point coordinates){
this.bottomLeftCorner = coordinates; this.bottomLeftCorner = coordinates;
} }
......
package de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare; package de._82grfl1bif.kpiVisualizer.layouts.simpleSquare;
import java.awt.*; import java.awt.Point;
import java.util.ArrayList; import java.util.ArrayList;
public class Rectangle extends Shape { public class Rectangle extends Shape {
......
package de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare; package de._82grfl1bif.kpiVisualizer.layouts.simpleSquare;
import java.awt.Point; import java.awt.Point;
......
package de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare; package de._82grfl1bif.kpiVisualizer.layouts.simpleSquare;
import de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare.Quadrat; import de._82grfl1bif.kpiVisualizer.structures.Structure;
import de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare.Rectangle;
import de._82grfl1bif.KPI_Visualizer.structures.Structure;
import javax.management.AttributeNotFoundException; import javax.management.AttributeNotFoundException;
import java.awt.*; import java.awt.Point;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
...@@ -78,9 +76,9 @@ public class SimpleSquareLayout { ...@@ -78,9 +76,9 @@ public class SimpleSquareLayout {
layout.add(new Quadrat(new Point(q.bottomLeftCorner.y,q.bottomLeftCorner.x),new Point(q.topRightCorner.y,q.topRightCorner.x))); // gespiegeltes Quadrat layout.add(new Quadrat(new Point(q.bottomLeftCorner.y,q.bottomLeftCorner.x),new Point(q.topRightCorner.y,q.topRightCorner.x))); // gespiegeltes Quadrat
layout.add(new Quadrat(new Point(q.bottomLeftCorner.x,q.bottomLeftCorner.x),structure.getWidth().x)); // Oberes rechtes Quadrat layout.add(new Quadrat(new Point(q.bottomLeftCorner.x,q.bottomLeftCorner.x),structure.getWidth().x)); // Oberes rechtes Quadrat
if((this.size-(2*structure.getWidth().x)) > 0){ //falls Abstand zwischen den Quadraten ist. if((this.size-(2*structure.getWidth().x)) > 0){ //falls Abstand zwischen den Quadraten ist.
de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare.Rectangle rTop = new de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare.Rectangle(structure.getWidth().x,(this.size-2*structure.getWidth().x),new Point(q .topRightCorner.y,q.bottomLeftCorner.x)); de._82grfl1bif.kpiVisualizer.layouts.simpleSquare.Rectangle rTop = new de._82grfl1bif.kpiVisualizer.layouts.simpleSquare.Rectangle(structure.getWidth().x,(this.size-2*structure.getWidth().x),new Point(q .topRightCorner.y,q.bottomLeftCorner.x));
layout.addAll(rTop.splitToQuads(rTop)); layout.addAll(rTop.splitToQuads(rTop));
de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare.Rectangle rRight = new Rectangle((this.size-2*structure.getWidth().x),structure.getWidth().x,new Point(q.bottomLeftCorner.x,q.topRightCorner.y)); de._82grfl1bif.kpiVisualizer.layouts.simpleSquare.Rectangle rRight = new Rectangle((this.size-2*structure.getWidth().x),structure.getWidth().x,new Point(q.bottomLeftCorner.x,q.topRightCorner.y));
layout.addAll(rRight.splitToQuads(rRight)); layout.addAll(rRight.splitToQuads(rRight));
} }
} }
......
package de._82grfl1bif.KPI_Visualizer.layouts.TreeMap; package de._82grfl1bif.kpiVisualizer.layouts.treeMap;
import de._82grfl1bif.KPI_Visualizer.structures.Structure; import java.awt.Point;
import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
public class Rectangle{ public class Rectangle{
......
package de._82grfl1bif.KPI_Visualizer.layouts.TreeMap; package de._82grfl1bif.kpiVisualizer.layouts.treeMap;
import de._82grfl1bif.KPI_Visualizer.structures.Structure; import de._82grfl1bif.kpiVisualizer.structures.Structure;
import java.awt.*; import java.awt.Point;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
......
package de._82grfl1bif.KPI_Visualizer.layouts.TreeMap; package de._82grfl1bif.kpiVisualizer.layouts.treeMap;
import de._82grfl1bif.KPI_Visualizer.structures.Foundation; import de._82grfl1bif.kpiVisualizer.structures.Foundation;
import de._82grfl1bif.KPI_Visualizer.structures.Structure; import de._82grfl1bif.kpiVisualizer.structures.Structure;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class SquarifiedTreemapLayout { public class SquarifiedTreemapLayout {
private ArrayList<Row> rows = new ArrayList<>(); private final ArrayList<Row> rows;
public ArrayList<Row> getRows() { public ArrayList<Row> getRows() {
return rows; return rows;
......
package de._82grfl1bif.KPI_Visualizer; package de._82grfl1bif.kpiVisualizer;
import de._82grfl1bif.KPI_Visualizer.commands.SetPreset; import de._82grfl1bif.kpiVisualizer.commands.GenerateLayout;
import de._82grfl1bif.KPI_Visualizer.commands.generateLayout; import de._82grfl1bif.kpiVisualizer.commands.SetPreset;
import de._82grfl1bif.KPI_Visualizer.helpers.FileInputTabCompleter; import de._82grfl1bif.kpiVisualizer.helpers.FileInputTabCompleter;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.util.Objects;
public final class main extends JavaPlugin { public final class main extends JavaPlugin {
@Override @Override
public void onEnable() { public void onEnable() {
// Plugin startup logic // Plugin startup logic
getCommand("setPreset").setExecutor(new SetPreset()); Objects.requireNonNull(getCommand("setPreset")).setExecutor(new SetPreset());
getCommand("generateLayout").setExecutor(new generateLayout()); Objects.requireNonNull(getCommand("generateLayout")).setExecutor(new GenerateLayout());
getCommand("generateLayout").setTabCompleter(new FileInputTabCompleter()); Objects.requireNonNull(getCommand("generateLayout")).setTabCompleter(new FileInputTabCompleter());
} }
@Override @Override
......
package de._82grfl1bif.KPI_Visualizer.structures; package de._82grfl1bif.kpiVisualizer.structures;
import de._82grfl1bif.KPI_Visualizer.data.Klasse; import de._82grfl1bif.kpiVisualizer.data.Klasse;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
...@@ -10,11 +10,11 @@ import org.bukkit.block.BlockFace; ...@@ -10,11 +10,11 @@ import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
import java.time.Duration; import java.time.Duration;
import java.util.Objects;
import java.util.Random; import java.util.Random;
import java.util.logging.Level; import java.util.logging.Level;
import static de._82grfl1bif.KPI_Visualizer.data.Klasse.zeitSeitLetzterBearbeitungMin; @SuppressWarnings("ALL")
public class Builder { public class Builder {
Server server; Server server;
...@@ -94,7 +94,7 @@ public class Builder { ...@@ -94,7 +94,7 @@ public class Builder {
setWalls(startLocation, x, y, z, innerMaterial, glassMaterial); setWalls(startLocation, x, y, z, innerMaterial, glassMaterial);
setCorners(startLocation, x, y, z, facadeMaterial); setCorners(startLocation, x, y, z, facadeMaterial);
setFoundation(startLocation.clone().add(0, y, 0), x, z, facadeMaterial);//roof setFoundation(startLocation.clone().add(0, y, 0), x, z, facadeMaterial);//roof
fillQube(startLocation.clone().add(Math.round(x/2),y+1,Math.round(x/2)),1,antennaHeight,1,Material.COBBLESTONE_WALL); fillQube(startLocation.clone().add(Math.round(x/2f),y+1,Math.round(x/2f)),1,antennaHeight,1,Material.COBBLESTONE_WALL);
Random rm = new Random(); Random rm = new Random();
switch (rm.nextInt(3)+1){ switch (rm.nextInt(3)+1){
case 1: setCrane(startLocation,x,y,z,craneHeight,BlockFace.NORTH); case 1: setCrane(startLocation,x,y,z,craneHeight,BlockFace.NORTH);
...@@ -150,13 +150,13 @@ public class Builder { ...@@ -150,13 +150,13 @@ public class Builder {
}else { }else {
facadeInnerMaterial = Material.IRON_BARS; facadeInnerMaterial = Material.IRON_BARS;
} }
System.out.println(letzterBearbeitung); //System.out.println(letzterBearbeitung);
System.out.println(scaleLetzterBearbeitung); //System.out.println(scaleLetzterBearbeitung);
this.buildBuilding(s.getLocation().clone().add(1, s.getDepth() + 1,1), this.buildBuilding(s.getLocation().clone().add(1, s.getDepth() + 1,1),
s.getWidth().x - 2, s.getWidth().x - 2,
((Building) s).getHeight()+1, ((Building) s).getHeight()+1,
((Building)s).klasse.commits, ((Building)s).klasse.commits,
Math.round(((Building)s).klasse.complexity/100), Math.round(((Building)s).klasse.complexity/100f),
s.getWidth().x - 2, s.getWidth().x - 2,
facadeMaterial, facadeMaterial,
facadeInnerMaterial, facadeInnerMaterial,
...@@ -281,13 +281,13 @@ public class Builder { ...@@ -281,13 +281,13 @@ public class Builder {
default: default:
Bukkit.getLogger().log(Level.SEVERE, "falsche Orientierung übergeben!"); Bukkit.getLogger().log(Level.SEVERE, "falsche Orientierung übergeben!");
} }
sign1.setData(matSign); Objects.requireNonNull(sign1).setData(matSign);
sign2.setData(matSign); Objects.requireNonNull(sign2o).setData(matSign);
sign1.setGlowingText(true); sign1.setGlowingText(true);
sign2.setGlowingText(true); sign2.setGlowingText(true);
if (building.name.length() > 60) { if (building.name.length() > 60) {
sign1o.setData(matSign); Objects.requireNonNull(sign1o).setData(matSign);
sign2o.setData(matSign); Objects.requireNonNull(sign2o).setData(matSign);
sign1o.setGlowingText(true); sign1o.setGlowingText(true);
sign2o.setGlowingText(true); sign2o.setGlowingText(true);
setTextToSign(sign1, sign1o, building.name); setTextToSign(sign1, sign1o, building.name);
...@@ -351,7 +351,6 @@ public class Builder { ...@@ -351,7 +351,6 @@ public class Builder {
} }
public void setLegend(Location startLocation){ public void setLegend(Location startLocation){
org.bukkit.material.Sign matSign = new org.bukkit.material.Sign(Material.OAK_WALL_SIGN);
server.getWorlds().get(0).getBlockAt(startLocation.clone().add(0,0,-6)).setType(Material.WAXED_COPPER_BLOCK); server.getWorlds().get(0).getBlockAt(startLocation.clone().add(0,0,-6)).setType(Material.WAXED_COPPER_BLOCK);
server.getWorlds().get(0).getBlockAt(startLocation.clone().add(0,1,-6)).setType(Material.WAXED_EXPOSED_COPPER); server.getWorlds().get(0).getBlockAt(startLocation.clone().add(0,1,-6)).setType(Material.WAXED_EXPOSED_COPPER);
server.getWorlds().get(0).getBlockAt(startLocation.clone().add(0,2,-6)).setType(Material.WAXED_WEATHERED_COPPER); server.getWorlds().get(0).getBlockAt(startLocation.clone().add(0,2,-6)).setType(Material.WAXED_WEATHERED_COPPER);
...@@ -378,7 +377,7 @@ public class Builder { ...@@ -378,7 +377,7 @@ public class Builder {
private void setLegendBlock(Location startLocation,String s1,String s2,String s3){ private void setLegendBlock(Location startLocation,String s1,String s2,String s3){
org.bukkit.material.Sign matSign = new org.bukkit.material.Sign(Material.OAK_WALL_SIGN); org.bukkit.material.Sign matSign = new org.bukkit.material.Sign(Material.OAK_WALL_SIGN);
org.bukkit.block.Sign sign = null; org.bukkit.block.Sign sign;
server.getWorlds().get(0).getBlockAt(startLocation).setType(Material.OAK_WALL_SIGN); server.getWorlds().get(0).getBlockAt(startLocation).setType(Material.OAK_WALL_SIGN);
sign = (org.bukkit.block.Sign) server.getWorlds().get(0).getBlockAt(startLocation).getState(); sign = (org.bukkit.block.Sign) server.getWorlds().get(0).getBlockAt(startLocation).getState();
sign.setGlowingText(true); sign.setGlowingText(true);
......
package de._82grfl1bif.KPI_Visualizer.structures; package de._82grfl1bif.kpiVisualizer.structures;
import de._82grfl1bif.KPI_Visualizer.data.Klasse; import de._82grfl1bif.kpiVisualizer.data.Klasse;
import org.bukkit.Material; import org.bukkit.Material;
import java.awt.Point; import java.awt.Point;
...@@ -20,19 +20,10 @@ public class Building extends Structure{ ...@@ -20,19 +20,10 @@ public class Building extends Structure{
} }
} }
public Building(Point width/*and depth for complex algorithms*/, int height, Material material){
this.width = width;
this.height = height;
this.material = material;
if(this.width.x < 5 || this.width.y < 5){
throw new IllegalArgumentException("keine Gebäude kleiner 5 wegen 2 Gehweg");
}
}
public Building(Material material, Klasse klasse, String name){ //Buildings are Square -> no depth public Building(Material material, Klasse klasse, String name){ //Buildings are Square -> no depth
this.klasse = klasse; this.klasse = klasse;
this.material = material; this.material = material;
this.width = new Point((int)Math.round((klasse.variables+5)),(int)Math.round((klasse.variables+5))); //TODO: make this work with treemap and square this.width = new Point(Math.round((klasse.variables+5)), Math.round((klasse.variables+5))); //TODO: make this work with treemap and square
this.area = klasse.variables*25; this.area = klasse.variables*25;
this.name = name; this.name = name;
this.height = klasse.functions; this.height = klasse.functions;
......
package de._82grfl1bif.KPI_Visualizer.structures; package de._82grfl1bif.kpiVisualizer.structures;
import de._82grfl1bif.KPI_Visualizer.data.Klasse; import de._82grfl1bif.kpiVisualizer.data.Klasse;
import de._82grfl1bif.KPI_Visualizer.layouts.SimpleSquare.SimpleSquareLayout; import de._82grfl1bif.kpiVisualizer.layouts.simpleSquare.SimpleSquareLayout;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import javax.management.AttributeNotFoundException; import javax.management.AttributeNotFoundException;
import java.awt.*; import java.awt.Point;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
...@@ -214,7 +214,7 @@ public class Foundation extends Structure { ...@@ -214,7 +214,7 @@ public class Foundation extends Structure {
private boolean baseFoundation = true; private boolean baseFoundation = true;
public void organizeFoundation() { public void organizeFoundation() {
if (this.depth == 0 && baseFoundation) { //rootElement prepwork and recursion call if (this.depth == 0 && baseFoundation) { //rootElement prep-work and recursion call
ArrayList<Foundation> allFoundations = collectAllFoundations(); ArrayList<Foundation> allFoundations = collectAllFoundations();
baseFoundation = false; baseFoundation = false;
allFoundations.sort(new DepthComparator()); allFoundations.sort(new DepthComparator());
...@@ -249,6 +249,7 @@ public class Foundation extends Structure { ...@@ -249,6 +249,7 @@ public class Foundation extends Structure {
return fCollection; return fCollection;
} }
@Deprecated
public ArrayList<Building> collectAllBuildings() { //called on the base Foundation public ArrayList<Building> collectAllBuildings() { //called on the base Foundation
ArrayList<Building> buildings = new ArrayList<>(); ArrayList<Building> buildings = new ArrayList<>();
for (Structure s: children) { for (Structure s: children) {
......
package de._82grfl1bif.KPI_Visualizer.structures; package de._82grfl1bif.kpiVisualizer.structures;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import javax.persistence.Column; import java.awt.Point;
import javax.persistence.Entity;
import java.awt.*;
public abstract class Structure{ public abstract class Structure{
...@@ -33,6 +31,7 @@ public abstract class Structure{ ...@@ -33,6 +31,7 @@ public abstract class Structure{
this.location = location; this.location = location;
} }
@Deprecated
public void addVector(Vector vector){ public void addVector(Vector vector){
this.location.add(vector); this.location.add(vector);
} }
......
name: main name: main
version: '${project.version}' version: '${project.version}'
main: de._82grfl1bif.KPI_Visualizer.main main: de._82grfl1bif.kpiVisualizer.main
api-version: 1.17 api-version: 1.17
authors: [ FlorianGrabowski ] authors: [ FlorianGrabowski ]
description: Testing automated construcion of Buildings. description: Testing automated construcion of Buildings.
...@@ -9,4 +9,4 @@ commands: ...@@ -9,4 +9,4 @@ commands:
setPreset: setPreset:
description: setzt einen ein Json Preset. description: setzt einen ein Json Preset.
generateLayout: generateLayout:
description: generates Json description: generates Json
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment