Building.java 1.65 KB
Newer Older
Florian Grabowski's avatar
Florian Grabowski committed
1
2
package de._82grfl1bif.KPI_Visualizer.structures;

3
import de._82grfl1bif.KPI_Visualizer.data.Klasse;
Florian Grabowski's avatar
Florian Grabowski committed
4
5
import org.bukkit.Material;

6
import java.awt.Point;
Florian Grabowski's avatar
Florian Grabowski committed
7
8
9
10
11

public class Building extends Structure{
    private final int height;

    public Building(int width, int height, Material material){ //Buildings are Square -> no depth
12
13
14
15
        this.width.x = width;
        this.width.y = width;
        this.height = height;
        this.material = material;
Florian Grabowski's avatar
Florian Grabowski committed
16
        if(this.width.x < 5){
17
18
19
20
21
            throw new IllegalArgumentException("keine Gebäude kleiner 3 wegen 2 Gehweg");
        }
    }

    public Building(Point width, int height, Material material){ //Buildings are Square -> no depth
Florian Grabowski's avatar
Florian Grabowski committed
22
23
24
        this.width = width;
        this.height = height;
        this.material = material;
Florian Grabowski's avatar
Florian Grabowski committed
25
        if(this.width.x < 5 || this.width.y < 5){
26
            throw new IllegalArgumentException("keine Gebäude kleiner 3 wegen 2 Gehweg");
Florian Grabowski's avatar
Florian Grabowski committed
27
28
29
        }
    }

30
31
32
    public Building(Material material, Klasse klasse, String name){ //Buildings are Square -> no depth
        this.material = material;
        this.width = new Point(5,5); //TODO: make this work with treemap and square
Florian Grabowski's avatar
Florian Grabowski committed
33
        this.area = klasse.qloc;
34
35
        this.name = name;
        this.height = klasse.commits; // con be changed to likings TODO: find out which fits best.
Florian Grabowski's avatar
Florian Grabowski committed
36
        if(this.width.x < 5 || this.width.y < 5){
37
38
39
40
            throw new IllegalArgumentException("keine Gebäude kleiner 3 wegen 2 Gehweg");
        }
    }

Florian Grabowski's avatar
Florian Grabowski committed
41
42
43
    public int getHeight() {
        return this.height;
    }
44
45
46
47
48
49

    @Override
    public Structure getFromTree(String checkName) {
        if(this.name.equals(checkName))return this;
        return null;
    }
Florian Grabowski's avatar
Florian Grabowski committed
50
}