Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. package ca.xshade.bukkit.towny.db;
  2.  
  3. import java.io.Serializable;
  4. import java.util.ArrayList;
  5. import java.util.Collection;
  6. import java.util.HashSet;
  7. import java.util.Set;
  8.  
  9. import com.avaje.ebean.validation.Length;
  10. import com.avaje.ebean.validation.NotEmpty;
  11. import com.avaje.ebean.validation.NotNull;
  12.  
  13. import javax.persistence.*;
  14. import org.bukkit.Bukkit;
  15. import org.bukkit.entity.Player;
  16.  
  17. /**
  18. *
  19. * @author FuzzeWuzze
  20. */
  21. @Entity()
  22. @Table(name = "towny_towns")
  23. public class TownyTown implements Serializable{
  24.  
  25. @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
  26. private int id;
  27.  
  28. @Column(name="tname")
  29. private String name;
  30.  
  31. private int id_Mayor;
  32. private int totalBlocks;
  33. private int id_Home;
  34.  
  35. @OneToMany(cascade = CascadeType.PERSIST, mappedBy = "town")
  36. private Set<TownyResident> residents = new HashSet<TownyResident>(0);
  37.  
  38. private TownyResident Mayor;
  39.  
  40. public TownyTown()
  41. {
  42.  
  43. }
  44.  
  45. public int getId(){ return id; }
  46. public void setId(int id){ this.id = id; }
  47.  
  48. public String getName(){ return name; }
  49. public void setName(String name){ this.name = name; }
  50.  
  51. public void addResident(TownyResident resident)
  52. {
  53. if(!getResidents().contains(resident))
  54. {
  55. getResidents().add(resident);
  56. if(resident.getTown() != null)
  57. {
  58. resident.getTown().getResidents().remove(resident);
  59. }
  60. resident.setTown(this);
  61. }
  62. }
  63.  
  64. public Set<TownyResident> getResidents()
  65. {
  66. return residents;
  67. }
  68.  
  69.  
  70. public int getId_Mayor() {
  71. return id_Mayor;
  72. }
  73.  
  74. public void setId_Mayor(int id_Mayor) {
  75. this.id_Mayor = id_Mayor;
  76. }
  77.  
  78. public int getTotalBlocks() {
  79. return totalBlocks;
  80. }
  81.  
  82. public void setTotalBlocks(int totalBlocks) {
  83. this.totalBlocks = totalBlocks;
  84. }
  85.  
  86. public int getId_Home() {
  87. return id_Home;
  88. }
  89.  
  90. public void setId_Home(int id_Home) {
  91. this.id_Home = id_Home;
  92. }
  93.  
  94.  
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement