Advertisement
Darven

Untitled

Nov 11th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.42 KB | None | 0 0
  1. package fr.thedarven.main.constructors;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.HashMap;
  5. import java.util.List;
  6. import java.util.Map;
  7. import java.util.UUID;
  8. import org.bukkit.Bukkit;
  9. import org.bukkit.GameMode;
  10. import org.bukkit.Location;
  11. import org.bukkit.entity.Player;
  12.  
  13. import fr.thedarven.main.TaupeGun;
  14. import fr.thedarven.utils.TeamCustom;
  15.  
  16. public class PlayerTaupe {
  17. private static Map<UUID, PlayerTaupe> playerManagerHashMap = new HashMap<>();
  18. private UUID uuid;
  19. private String name;
  20. private boolean alive;
  21. private int kill;
  22. private Location netherPortal;
  23.  
  24. private TeamCustom team;
  25. private TeamCustom startTeam;
  26. private TeamCustom teamTaupe;
  27. private TeamCustom teamSuperTaupe;
  28. private String claim;
  29.  
  30. private boolean canClick;
  31. private String createTeamName;
  32. private String createKitName;
  33.  
  34. public PlayerTaupe(UUID playerUuid) {
  35. this.uuid = playerUuid;
  36. this.name = Bukkit.getPlayer(playerUuid).getName();
  37. if(!TaupeGun.etat.equals(EnumGame.WAIT) && !TaupeGun.etat.equals(EnumGame.LOBBY)) {
  38. alive = false;
  39. team = TeamCustom.getSpectatorTeam();
  40. team.joinTeam(name);
  41. Bukkit.getPlayer(playerUuid).setGameMode(GameMode.SPECTATOR);
  42. }else {
  43. alive = true;
  44. Location lobby_spawn = new Location(Bukkit.getWorld("world"), 0.5, 201, 0.5);
  45. Bukkit.getPlayer(playerUuid).teleport(lobby_spawn);
  46. team = null;
  47. /* Location lobby_spawn = new Location(Bukkit.getWorld("taupegun"), 0.5, 201, 0.5);
  48. Bukkit.getPlayer(playerUuid).teleport(lobby_spawn); */
  49.  
  50. Bukkit.getPlayer(playerUuid).setHealth(20);
  51. Bukkit.getPlayer(playerUuid).setLevel(0);
  52. Bukkit.getPlayer(playerUuid).getInventory().clear();
  53. Bukkit.getPlayer(playerUuid).setGameMode(GameMode.SURVIVAL);
  54. }
  55. startTeam = null;
  56.  
  57. kill = 0;
  58. netherPortal = new Location(Bukkit.getWorld("world_nether"),0.0,0.0,0.0);
  59.  
  60. teamTaupe = null;
  61. teamSuperTaupe = null;
  62. claim = "aucun";
  63. canClick = true;
  64. createTeamName = null;
  65. createKitName = null;
  66.  
  67. playerManagerHashMap.put(this.uuid, this);
  68. }
  69.  
  70. public UUID getUuid() {
  71. return uuid;
  72. }
  73.  
  74. public boolean isAlive() {
  75. return alive;
  76. }
  77.  
  78. public String getCustomName() {
  79. return name;
  80. }
  81.  
  82. public TeamCustom getTeam() {
  83. return team;
  84. }
  85.  
  86. public TeamCustom getStartTeam() {
  87. return startTeam;
  88. }
  89.  
  90. public int getKill() {
  91. return kill;
  92. }
  93.  
  94. public Location getNetherPortal() {
  95. return netherPortal;
  96. }
  97.  
  98. public Player getPlayer(){
  99. if(isOnline()){
  100. return Bukkit.getPlayer(uuid);
  101. }
  102. return null;
  103. }
  104.  
  105. public boolean isOnline(){
  106. for(Player p : Bukkit.getOnlinePlayers()){
  107. if(p.getUniqueId().equals(this.uuid)){
  108. return true;
  109. }
  110. }
  111. return false;
  112. }
  113.  
  114. public void setAlive(boolean value) {
  115. alive = value;
  116. }
  117.  
  118. public void setCustomName(String value) {
  119. name = value;
  120. }
  121.  
  122. public void setKill(int value) {
  123. kill = value;
  124. }
  125.  
  126. public void setTeam(TeamCustom pTeam) {
  127. team = pTeam;
  128. }
  129.  
  130. public void setStartTeam(TeamCustom pTeam) {
  131. startTeam = pTeam;
  132. }
  133.  
  134. public void setNetherPortal(Location loc) {
  135. netherPortal = loc;
  136. }
  137.  
  138. public void setClaimTaupe(String claimParametre) {
  139. this.claim = claimParametre;
  140. }
  141.  
  142.  
  143.  
  144. public boolean isTaupe() {
  145. return teamTaupe != null;
  146. }
  147.  
  148. public boolean isSuperTaupe() {
  149. return teamSuperTaupe != null;
  150. }
  151.  
  152. public TeamCustom getTaupeTeam() {
  153. return teamTaupe;
  154. }
  155.  
  156. public TeamCustom getSuperTaupeTeam() {
  157. return teamSuperTaupe;
  158. }
  159.  
  160. public void setTaupeTeam(TeamCustom pTeam) {
  161. teamTaupe = pTeam;
  162. }
  163.  
  164. public void setSuperTaupeTeam(TeamCustom pTeam) {
  165. teamSuperTaupe = pTeam;
  166. }
  167.  
  168. public boolean isReveal() {
  169. return (isTaupe() && isAlive() && (team == teamTaupe || team == teamSuperTaupe));
  170. }
  171.  
  172. public boolean isSuperReveal() {
  173. return (isSuperTaupe() && isAlive() && team == teamSuperTaupe);
  174. }
  175.  
  176. public boolean revealTaupe() {
  177. if(!isReveal())
  178. return true;
  179. return false;
  180. }
  181.  
  182. public boolean revealSuperTaupe() {
  183. if(!isSuperReveal())
  184. return true;
  185. return false;
  186. }
  187.  
  188. public String getClaimTaupe() {
  189. return claim;
  190. }
  191.  
  192.  
  193.  
  194. public boolean getCanClick() {
  195. return this.canClick;
  196. }
  197.  
  198. public String getCreateTeamName() {
  199. return createTeamName;
  200. }
  201.  
  202. public String getCreateKitName() {
  203. return createKitName;
  204. }
  205.  
  206. public void setCanClick(boolean pCanClick) {
  207. this.canClick = pCanClick;
  208. }
  209.  
  210. public void setCreateTeamName(String pName) {
  211. createTeamName = pName;
  212. }
  213.  
  214. public void setCreateKitName(String pName) {
  215. createKitName = pName;
  216. }
  217.  
  218.  
  219.  
  220.  
  221. public static PlayerTaupe getPlayerManager(UUID playerUuid) {
  222. if(playerManagerHashMap.containsKey(playerUuid)) {
  223. return playerManagerHashMap.get(playerUuid);
  224. }
  225. return new PlayerTaupe(playerUuid);
  226. }
  227.  
  228. public static List<PlayerTaupe> getAlivePlayerManager(){
  229. List<PlayerTaupe> list = new ArrayList<PlayerTaupe>();
  230. for(PlayerTaupe pc : playerManagerHashMap.values()){
  231. if(pc.isAlive()){
  232. list.add(pc);
  233. }
  234. }
  235. return list;
  236. }
  237.  
  238. public static List<PlayerTaupe> getDeathPlayerManager(){
  239. List<PlayerTaupe> list = new ArrayList<PlayerTaupe>();
  240. for(PlayerTaupe pc : playerManagerHashMap.values()){
  241. if(!pc.isAlive()){
  242. list.add(pc);
  243. }
  244. }
  245. return list;
  246. }
  247.  
  248. public static List<PlayerTaupe> getAllPlayerManager(){
  249. List<PlayerTaupe> list = new ArrayList<PlayerTaupe>(playerManagerHashMap.values());
  250. return list;
  251. }
  252.  
  253. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement