Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ca.xshade.bukkit.towny.db;
- import java.io.Serializable;
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.HashSet;
- import java.util.Set;
- import com.avaje.ebean.validation.Length;
- import com.avaje.ebean.validation.NotEmpty;
- import com.avaje.ebean.validation.NotNull;
- import javax.persistence.*;
- import org.bukkit.Bukkit;
- import org.bukkit.entity.Player;
- /**
- *
- * @author FuzzeWuzze
- */
- @Entity()
- @Table(name = "towny_towns")
- public class TownyTown implements Serializable{
- @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
- private int id;
- @Column(name="tname")
- private String name;
- private int id_Mayor;
- private int totalBlocks;
- private int id_Home;
- @OneToMany(cascade = CascadeType.PERSIST, mappedBy = "town")
- private Set<TownyResident> residents = new HashSet<TownyResident>(0);
- private TownyResident Mayor;
- public TownyTown()
- {
- }
- public int getId(){ return id; }
- public void setId(int id){ this.id = id; }
- public String getName(){ return name; }
- public void setName(String name){ this.name = name; }
- public void addResident(TownyResident resident)
- {
- if(!getResidents().contains(resident))
- {
- getResidents().add(resident);
- if(resident.getTown() != null)
- {
- resident.getTown().getResidents().remove(resident);
- }
- resident.setTown(this);
- }
- }
- public Set<TownyResident> getResidents()
- {
- return residents;
- }
- public int getId_Mayor() {
- return id_Mayor;
- }
- public void setId_Mayor(int id_Mayor) {
- this.id_Mayor = id_Mayor;
- }
- public int getTotalBlocks() {
- return totalBlocks;
- }
- public void setTotalBlocks(int totalBlocks) {
- this.totalBlocks = totalBlocks;
- }
- public int getId_Home() {
- return id_Home;
- }
- public void setId_Home(int id_Home) {
- this.id_Home = id_Home;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement