diff --git a/src/main/java/com/lenis0012/bukkit/marriage2/internal/data/models/LocationModel.java b/src/main/java/com/lenis0012/bukkit/marriage2/internal/data/models/LocationModel.java new file mode 100644 index 0000000..f645333 --- /dev/null +++ b/src/main/java/com/lenis0012/bukkit/marriage2/internal/data/models/LocationModel.java @@ -0,0 +1,86 @@ +package com.lenis0012.bukkit.marriage2.internal.data.models; + +import javax.persistence.*; + +@Entity +@Table(name="marriage_players") +public class LocationModel { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(unique = true, updatable = false) + private int id; + + @Column + private String world; + + @Column + private double x; + + @Column + private double y; + + @Column + private double z; + + @Column + private float yaw; + + @Column + private float pitch; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getWorld() { + return world; + } + + public void setWorld(String world) { + this.world = world; + } + + public double getX() { + return x; + } + + public void setX(double x) { + this.x = x; + } + + public double getY() { + return y; + } + + public void setY(double y) { + this.y = y; + } + + public double getZ() { + return z; + } + + public void setZ(double z) { + this.z = z; + } + + public float getYaw() { + return yaw; + } + + public void setYaw(float yaw) { + this.yaw = yaw; + } + + public float getPitch() { + return pitch; + } + + public void setPitch(float pitch) { + this.pitch = pitch; + } +} diff --git a/src/main/java/com/lenis0012/bukkit/marriage2/internal/data/models/MarriageModel.java b/src/main/java/com/lenis0012/bukkit/marriage2/internal/data/models/MarriageModel.java new file mode 100644 index 0000000..69d257c --- /dev/null +++ b/src/main/java/com/lenis0012/bukkit/marriage2/internal/data/models/MarriageModel.java @@ -0,0 +1,37 @@ +package com.lenis0012.bukkit.marriage2.internal.data.models; + +import javax.persistence.*; +import java.sql.Timestamp; +import java.util.List; + +@Entity +@Table(name = "marriage_players") +public class MarriageModel { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(unique = true, updatable = false) + private int id; + + @Column(updatable = false, length = 128) + private String player1; + + @Column(updatable = false, length = 128) + private String player2; + + @ManyToMany + @JoinTable + private List players; + + @Column + private boolean pvpEnabled = true; + + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name="home_id") + private LocationModel home; + + @Column + private Timestamp marriedAt = new Timestamp(System.currentTimeMillis()); + + @Version + private long version; +} diff --git a/src/main/java/com/lenis0012/bukkit/marriage2/internal/data/models/PlayerModel.java b/src/main/java/com/lenis0012/bukkit/marriage2/internal/data/models/PlayerModel.java new file mode 100644 index 0000000..1fdcce4 --- /dev/null +++ b/src/main/java/com/lenis0012/bukkit/marriage2/internal/data/models/PlayerModel.java @@ -0,0 +1,10 @@ +package com.lenis0012.bukkit.marriage2.internal.data.models; + +import javax.persistence.ManyToMany; +import java.util.List; + +public class PlayerModel { + + @ManyToMany(mappedBy = "players") + private List marriages; +}