Building.java 1.61 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
16
17
18
19
20
21
        this.width.x = width;
        this.width.y = width;
        this.height = height;
        this.material = material;
        if(this.width.x < 3){
            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;
25
26
        if(this.width.x < 3 || this.width.y < 3){
            throw new IllegalArgumentException("keine Gebäude kleiner 3 wegen 2 Gehweg");
Florian Grabowski's avatar
Florian Grabowski committed
27
28
29
        }
    }

30
31
32
33
34
35
36
37
38
39
    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
        this.name = name;
        this.height = klasse.commits; // con be changed to likings TODO: find out which fits best.
        if(this.width.x < 3 || this.width.y < 3){
            throw new IllegalArgumentException("keine Gebäude kleiner 3 wegen 2 Gehweg");
        }
    }

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

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