Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.58 KB | None | 0 0
  1. package com.squallz.wispclasses.objects;
  2.  
  3. import com.squallz.wispclasses.enums.ClassType;
  4. import org.bukkit.boss.BossBar;
  5. import org.bukkit.entity.Entity;
  6. import org.bukkit.inventory.Inventory;
  7. import org.bukkit.scheduler.BukkitTask;
  8.  
  9. import java.util.ArrayList;
  10. import java.util.List;
  11.  
  12. public class CPlayer {
  13.  
  14. private String uuid;
  15. private String name;
  16. private ClassType classType;
  17. private Boolean inAbilityMode;
  18. private Double maxMana;
  19. private transient Boolean stunned;
  20. private transient List<Ability> abilities;
  21. private transient Double mana = 50.0;
  22. private transient List<Entity> minions = new ArrayList<>();
  23. private transient Integer minionTime = 30;
  24. private transient Boolean minionsOut = false;
  25. private transient Integer soulHarvestStacks = 0;
  26. private transient Boolean isChoosingClass;
  27. private transient Boolean wandCooldown;
  28. private transient Integer wandCooldownTime;
  29. private transient BukkitTask passiveAvoidanceTask = null;
  30. private transient BossBar manaBar;
  31. private transient BossBar minionBar;
  32. private transient Inventory playerInventory;
  33.  
  34. public CPlayer (String uuid, String name, ClassType classType, Boolean inAbilityMode, Double maxMana) {
  35. this.uuid = uuid;
  36. this.name = name;
  37. this.classType = classType;
  38. this.inAbilityMode = inAbilityMode;
  39. this.stunned = false;
  40. this.maxMana = maxMana;
  41.  
  42. setMana(50.0);
  43. }
  44.  
  45. public ClassType getClassType() {
  46. return classType;
  47. }
  48.  
  49. public String getUUID() {
  50. return this.uuid;
  51. }
  52.  
  53. public String getName() {
  54. return name;
  55. }
  56.  
  57. public Inventory getPlayerInventory() {
  58. if(playerInventory != null) {
  59. return playerInventory;
  60. } else {
  61. return null;
  62. }
  63. }
  64.  
  65. public void setPlayerInventory(Inventory inventory) {
  66. this.playerInventory = inventory;
  67. }
  68.  
  69. public void setAbilities(List<Ability> abilities) {
  70. this.abilities = abilities;
  71. }
  72.  
  73. public List<Ability> getAbilities() {
  74. return this.abilities;
  75. }
  76.  
  77. public void setManaBar(BossBar manaBar) {
  78. this.manaBar = manaBar;
  79. }
  80.  
  81. public BossBar getManaBar() {
  82. if(manaBar != null) {
  83. return manaBar;
  84. } else {
  85. return null;
  86. }
  87. }
  88.  
  89. public void setMinionBar(BossBar minionBar) {
  90. this.minionBar = minionBar;
  91. }
  92.  
  93. public BossBar getMinionBar() {
  94. if(minionBar != null) {
  95. return minionBar;
  96. } else {
  97. return null;
  98. }
  99. }
  100.  
  101. public Boolean hasEnoughMana(Integer manaNeeded) {
  102. if(getMana() != null) {
  103. if(getMana() >= manaNeeded) {
  104. return true;
  105. } else {
  106. return false;
  107. }
  108. } else {
  109. return true;
  110. }
  111. }
  112.  
  113. public BukkitTask getPassiveAvoidanceTask() {
  114. if(passiveAvoidanceTask != null) {
  115. return passiveAvoidanceTask;
  116. } else {
  117. return null;
  118. }
  119. }
  120.  
  121. public void setPassiveAvoidanceTask(BukkitTask bukkitTask) {
  122. this.passiveAvoidanceTask = bukkitTask;
  123. }
  124.  
  125. public Boolean hasWandCooldown() {
  126. if(wandCooldown == null) {
  127. return false;
  128. } else {
  129. return wandCooldown;
  130. }
  131. }
  132.  
  133. public Integer getWandCooldownTime() {
  134. if(wandCooldownTime != null) {
  135. return wandCooldownTime;
  136. } else {
  137. return 0;
  138. }
  139. }
  140.  
  141. public void setWandCooldown(Boolean bool) {
  142. this.wandCooldown = bool;
  143. }
  144.  
  145. public void setWandCooldownTime(Integer time) {
  146. this.wandCooldownTime = time;
  147. }
  148.  
  149. public Boolean getIsChoosingClass() {
  150. if(isChoosingClass != null) {
  151. return isChoosingClass;
  152. } else {
  153. return false;
  154. }
  155. }
  156.  
  157. public void setIsChoosingClass(Boolean bool) {
  158. this.isChoosingClass = bool;
  159. }
  160.  
  161. public Integer getSoulHarvestStacks() {
  162. if(soulHarvestStacks != null) {
  163. return soulHarvestStacks;
  164. } else {
  165. return 0;
  166. }
  167. }
  168.  
  169. public void addSoulHarvestStack() {
  170. if(soulHarvestStacks == null) {
  171. soulHarvestStacks = 0;
  172. }
  173.  
  174. soulHarvestStacks+=1;
  175. }
  176.  
  177. public void removeSoulHarvestStack(Integer amount) {
  178. soulHarvestStacks -= amount;
  179. }
  180.  
  181. public Ability getAbilityByName(String abilityName) {
  182. for(Ability abilities : getAbilities()) {
  183. if(abilities.getName().equalsIgnoreCase(abilityName)) {
  184. return abilities;
  185. }
  186. }
  187.  
  188. return null;
  189. }
  190.  
  191. public Boolean isStunned(){
  192. if(stunned != null) {
  193. return stunned;
  194. }
  195. return false;
  196. }
  197.  
  198. public void setMana(Double mana) {
  199. this.mana = mana;
  200. }
  201.  
  202. public void setMinionsOut(Boolean bool) {
  203. this.minionsOut = bool;
  204. }
  205.  
  206. public Boolean hasMinionsOut() {
  207. if(minionsOut != null) {
  208. return minionsOut;
  209. } else {
  210. return false;
  211. }
  212. }
  213.  
  214. public double getMinionTime() {
  215. if(minionTime != null) {
  216. return minionTime;
  217. } else {
  218. return 30;
  219. }
  220. }
  221.  
  222. public void setMinionTime(Integer minionTime) {
  223. this.minionTime = minionTime;
  224. }
  225.  
  226. public List<Entity> getMinions() {
  227. return minions;
  228. }
  229.  
  230. public void addMinion(Entity minion) {
  231. if(minions == null) {
  232. this.minions = new ArrayList<>();
  233. }
  234.  
  235. minions.add(minion);
  236. }
  237.  
  238. public void removeMinion(Entity minion) {
  239. if(minions.contains(minion)) {
  240. minions.remove(minion);
  241. }
  242. }
  243.  
  244. public Double getMana() {
  245. return mana;
  246. }
  247.  
  248. public void stun() {
  249. this.stunned = true;
  250. }
  251.  
  252. public void unStun() {
  253. this.stunned = false;
  254. }
  255.  
  256. public boolean isInAbilityMode() {
  257. return inAbilityMode;
  258. }
  259.  
  260. public Double getMaxMana() {
  261. return maxMana;
  262. }
  263.  
  264. public void setMaxMana(Double maxMana) {
  265. this.maxMana = maxMana;
  266. }
  267.  
  268. public void toggleAbilityMode() {
  269. if(isInAbilityMode()) {
  270. inAbilityMode = false;
  271. } else {
  272. inAbilityMode = true;
  273. }
  274. }
  275.  
  276. public void setClassType(ClassType classType) {
  277. this.classType = classType;
  278. }
  279. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement