Building.java 1009 Bytes
Newer Older
Florian Grabowski's avatar
Florian Grabowski committed
1
2
3
4
5
package de._82grfl1bif.KPI_Visualizer.structures;

import org.bukkit.Material;

import javax.persistence.Column;
6
import java.awt.*;
Florian Grabowski's avatar
Florian Grabowski committed
7
8
9
10
11
12

public class Building extends Structure{
    @Column(name = "height")
    private final int height;

    public Building(int width, int height, Material material){ //Buildings are Square -> no depth
13
14
15
16
17
18
19
20
21
22
        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
23
24
25
        this.width = width;
        this.height = height;
        this.material = material;
26
27
        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
28
29
30
31
32
33
34
        }
    }

    public int getHeight() {
        return this.height;
    }
}