mcUsers.java 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512
  1. package com.gmail.nossr50;
  2. import java.io.*;
  3. import java.util.ArrayList;
  4. import java.util.Properties;
  5. import java.util.logging.Level;
  6. import java.util.logging.Logger;
  7. import org.bukkit.Location;
  8. import org.bukkit.entity.*;
  9. import org.bukkit.plugin.Plugin;
  10. public class mcUsers {
  11. private static volatile mcUsers instance;
  12. protected static final Logger log = Logger.getLogger("Minecraft");
  13. String location = "plugins/mcMMO/mcmmo.users";
  14. public static PlayerList players = new PlayerList();
  15. private Properties properties = new Properties();
  16. //To load
  17. public void load() throws IOException {
  18. properties.load(new FileInputStream(location));
  19. }
  20. //To save
  21. public void save() {
  22. try {
  23. properties.store(new FileOutputStream(location), null);
  24. }catch(IOException ex) {
  25. }
  26. }
  27. public void loadUsers(){
  28. File theDir = new File(location);
  29. if(!theDir.exists()){
  30. //properties = new PropertiesFile(location);
  31. FileWriter writer = null;
  32. try {
  33. writer = new FileWriter(location);
  34. writer.write("#Storage place for user information\r\n");
  35. } catch (Exception e) {
  36. log.log(Level.SEVERE, "Exception while creating " + location, e);
  37. } finally {
  38. try {
  39. if (writer != null) {
  40. writer.close();
  41. }
  42. } catch (IOException e) {
  43. log.log(Level.SEVERE, "Exception while closing writer for " + location, e);
  44. }
  45. }
  46. } else {
  47. //properties = new PropertiesFile(location);
  48. try {
  49. load();
  50. } catch (IOException e) {
  51. log.log(Level.SEVERE, "Exception while loading " + location, e);
  52. }
  53. }
  54. }
  55. //=====================================================================
  56. //Function: addUser
  57. //Input: Player player: The player to create a profile for
  58. //Output: none
  59. //Use: Loads the profile for the specified player
  60. //=====================================================================
  61. public static void addUser(Player player){
  62. players.addPlayer(player);
  63. }
  64. //=====================================================================
  65. //Function: removeUser
  66. //Input: Player player: The player to stop following
  67. //Output: none
  68. //Use: Creates the player profile
  69. //=====================================================================
  70. public static void removeUser(Player player){
  71. players.removePlayer(player);
  72. }
  73. //=====================================================================
  74. //Function: getProfile
  75. //Input: Player player: The player to find the profile for
  76. //Output: PlayerList.PlayerProfile: The profile
  77. //Use: Gets the player profile
  78. //=====================================================================
  79. public static PlayerList.PlayerProfile getProfile(Player player){
  80. return players.findProfile(player);
  81. }
  82. public static mcUsers getInstance() {
  83. if (instance == null) {
  84. instance = new mcUsers();
  85. }
  86. return instance;
  87. }
  88. public static void getRow(){
  89. }
  90. }
  91. class PlayerList
  92. {
  93. protected static final Logger log = Logger.getLogger("Minecraft");
  94. ArrayList<PlayerProfile> players;
  95. //=====================================================================
  96. //Function: PlayerList
  97. //Input: Player player: The player to create a profile object for
  98. //Output: none
  99. //Use: Initializes the ArrayList
  100. //=====================================================================
  101. public PlayerList() { players = new ArrayList<PlayerProfile>(); }
  102. //=====================================================================
  103. //Function: addPlayer
  104. //Input: Player player: The player to add
  105. //Output: None
  106. //Use: Add a profile of the specified player
  107. //=====================================================================
  108. public void addPlayer(Player player)
  109. {
  110. players.add(new PlayerProfile(player));
  111. }
  112. //=====================================================================
  113. //Function: removePlayer
  114. //Input: Player player: The player to remove
  115. //Output: None
  116. //Use: Remove the profile of the specified player
  117. //=====================================================================
  118. public void removePlayer(Player player)
  119. {
  120. players.remove(findProfile(player));
  121. }
  122. //=====================================================================
  123. //Function: findProfile
  124. //Input: Player player: The player to find's profile
  125. //Output: PlayerProfile: The profile of the specified player
  126. //Use: Get the profile for the specified player
  127. //=====================================================================
  128. public PlayerProfile findProfile(Player player)
  129. {
  130. for(PlayerProfile ply : players)
  131. {
  132. if(ply.isPlayer(player))
  133. return ply;
  134. }
  135. return null;
  136. }
  137. class PlayerProfile
  138. {
  139. protected final Logger log = Logger.getLogger("Minecraft");
  140. private String playerName, gather, wgather, woodcutting, repair, mining, party, myspawn, myspawnworld, unarmed, herbalism, excavation,
  141. archery, swords, axes, invite, acrobatics, repairgather, unarmedgather, herbalismgather, excavationgather, archerygather, swordsgather, axesgather, acrobaticsgather;
  142. private boolean dead, treeFellerMode, superBreakerMode, gigaDrillBreakerMode, serratedStrikesMode, axePreparationMode, skullSplitterMode, berserkMode;
  143. private int recentlyhurt = 0, bleedticks = 0, gigaDrillBreakerCooldown = 0, gigaDrillBreakerTicks = 0, berserkTicks = 0, berserkCooldown = 0, superBreakerTicks = 0, superBreakerCooldown = 0,
  144. serratedStrikesTicks = 0, skullSplitterTicks = 0, skullSplitterCooldown = 0, serratedStrikesCooldown = 0, treeFellerTicks = 0, treeFellerCooldown = 0,
  145. axePreparationTicks = 0;
  146. Player thisplayer;
  147. char defaultColor;
  148. String location = "plugins/mcMMO/mcmmo.users";
  149. //=====================================================================
  150. //Function: PlayerProfile
  151. //Input: Player player: The player to create a profile object for
  152. //Output: none
  153. //Use: Loads settings for the player or creates them if they don't
  154. // exist.
  155. //=====================================================================
  156. public PlayerProfile(Player player)
  157. {
  158. //Declare things
  159. playerName = player.getName();
  160. thisplayer = player;
  161. party = new String();
  162. myspawn = new String();
  163. myspawnworld = new String();
  164. mining = new String();
  165. repair = new String();
  166. repairgather = new String();
  167. unarmed = new String();
  168. unarmedgather = new String();
  169. herbalism = new String();
  170. herbalismgather = new String();
  171. excavation = new String();
  172. excavationgather = new String();
  173. archery = new String();
  174. archerygather = new String();
  175. swords = new String();
  176. swordsgather = new String();
  177. axes = new String();
  178. axesgather = new String();
  179. acrobatics = new String();
  180. acrobaticsgather = new String();
  181. invite = new String();
  182. //mining = "0";
  183. wgather = new String();
  184. //wgather = "0";
  185. woodcutting = new String();
  186. //woodcutting = "0";
  187. gather = new String();
  188. //gather = "0";
  189. party = null;
  190. dead = false;
  191. treeFellerMode = false;
  192. //Try to load the player and if they aren't found, append them
  193. if(!load())
  194. addPlayer();
  195. }
  196. public void scoreBoard()
  197. {
  198. try {
  199. //Open the user file
  200. FileReader file = new FileReader(location);
  201. BufferedReader in = new BufferedReader(file);
  202. String line = "";
  203. while((line = in.readLine()) != null)
  204. {
  205. }
  206. in.close();
  207. } catch (Exception e) {
  208. log.log(Level.SEVERE, "Exception while reading "
  209. + location + " (Are you sure you formatted it correctly?)", e);
  210. }
  211. }
  212. public boolean load()
  213. {
  214. try {
  215. //Open the user file
  216. FileReader file = new FileReader(location);
  217. BufferedReader in = new BufferedReader(file);
  218. String line = "";
  219. while((line = in.readLine()) != null)
  220. {
  221. //Find if the line contains the player we want.
  222. String[] character = line.split(":");
  223. if(!character[0].equals(playerName)){continue;}
  224. //Get Mining
  225. if(character.length > 1)
  226. mining = character[1];
  227. //Myspawn
  228. if(character.length > 2)
  229. myspawn = character[2];
  230. //Party
  231. if(character.length > 3)
  232. party = character[3];
  233. //Mining Gather
  234. if(character.length > 4)
  235. gather = character[4];
  236. if(character.length > 5)
  237. woodcutting = character[5];
  238. if(character.length > 6)
  239. wgather = character[6];
  240. if(character.length > 7)
  241. repair = character[7];
  242. if(character.length > 8)
  243. unarmed = character[8];
  244. if(character.length > 9)
  245. herbalism = character[9];
  246. if(character.length > 10)
  247. excavation = character[10];
  248. if(character.length > 11)
  249. archery = character[11];
  250. if(character.length > 12)
  251. swords = character[12];
  252. if(character.length > 13)
  253. axes = character[13];
  254. if(character.length > 14)
  255. acrobatics = character[14];
  256. if(character.length > 15)
  257. repairgather = character[15];
  258. if(character.length > 16)
  259. unarmedgather = character[16];
  260. if(character.length > 17)
  261. herbalismgather = character[17];
  262. if(character.length > 18)
  263. excavationgather = character[18];
  264. if(character.length > 19)
  265. archerygather = character[19];
  266. if(character.length > 20)
  267. swordsgather = character[20];
  268. if(character.length > 21)
  269. axesgather = character[21];
  270. if(character.length > 22)
  271. acrobaticsgather = character[22];
  272. if(character.length > 23)
  273. myspawnworld = character[23];
  274. in.close();
  275. return true;
  276. }
  277. in.close();
  278. } catch (Exception e) {
  279. log.log(Level.SEVERE, "Exception while reading "
  280. + location + " (Are you sure you formatted it correctly?)", e);
  281. }
  282. return false;
  283. }
  284. //=====================================================================
  285. // Function: save
  286. // Input: none
  287. // Output: None
  288. // Use: Writes current values of PlayerProfile to disk
  289. // Call this function to save current values
  290. //=====================================================================
  291. public void save()
  292. {
  293. try {
  294. //Open the file
  295. FileReader file = new FileReader(location);
  296. BufferedReader in = new BufferedReader(file);
  297. StringBuilder writer = new StringBuilder();
  298. String line = "";
  299. //While not at the end of the file
  300. while((line = in.readLine()) != null)
  301. {
  302. //Read the line in and copy it to the output it's not the player
  303. //we want to edit
  304. if(!line.split(":")[0].equalsIgnoreCase(playerName))
  305. {
  306. writer.append(line).append("\r\n");
  307. //Otherwise write the new player information
  308. } else {
  309. writer.append(playerName + ":");
  310. writer.append(mining + ":");
  311. writer.append(myspawn + ":");
  312. writer.append(party+":");
  313. writer.append(gather+":");
  314. writer.append(woodcutting+":");
  315. writer.append(wgather+":");
  316. writer.append(repair+":");
  317. writer.append(unarmed+":");
  318. writer.append(herbalism+":");
  319. writer.append(excavation+":");
  320. writer.append(archery+":");
  321. writer.append(swords+":");
  322. writer.append(axes+":");
  323. writer.append(acrobatics+":");
  324. writer.append(repairgather+":");
  325. writer.append(unarmedgather+":");
  326. writer.append(herbalismgather+":");
  327. writer.append(excavationgather+":");
  328. writer.append(archerygather+":");
  329. writer.append(swordsgather+":");
  330. writer.append(axesgather+":");
  331. writer.append(acrobaticsgather+":");
  332. writer.append(myspawnworld+":");
  333. writer.append("\r\n");
  334. }
  335. }
  336. in.close();
  337. //Write the new file
  338. FileWriter out = new FileWriter(location);
  339. out.write(writer.toString());
  340. out.close();
  341. } catch (Exception e) {
  342. log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e);
  343. }
  344. }
  345. public void addPlayer()
  346. {
  347. try {
  348. //Open the file to write the player
  349. FileWriter file = new FileWriter(location, true);
  350. BufferedWriter out = new BufferedWriter(file);
  351. //Add the player to the end
  352. out.append(playerName + ":");
  353. out.append(0 + ":"); //mining
  354. out.append(myspawn+":");
  355. out.append(party+":");
  356. out.append(0+":"); //gather
  357. out.append(0+":"); //woodcutting
  358. out.append(0+":"); //wgather
  359. out.append(0+":"); //repair
  360. out.append(0+":"); //unarmed
  361. out.append(0+":"); //herbalism
  362. out.append(0+":"); //excavation
  363. out.append(0+":"); //archery
  364. out.append(0+":"); //swords
  365. out.append(0+":"); //axes
  366. out.append(0+":"); //acrobatics
  367. out.append(0+":"); //repairgather
  368. out.append(0+":"); //unarmedgather
  369. out.append(0+":"); //herbalismgather
  370. out.append(0+":"); //excavationgather
  371. out.append(0+":"); //archerygather
  372. out.append(0+":"); //swordsgather
  373. out.append(0+":"); //axesgather
  374. out.append(0+":"); //acrobaticsgather
  375. out.append(thisplayer.getWorld().getName());
  376. //Add more in the same format as the line above
  377. out.newLine();
  378. out.close();
  379. } catch (Exception e) {
  380. log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e);
  381. }
  382. }
  383. //=====================================================================
  384. //Function: isPlayer
  385. //Input: None
  386. //Output: Player: The player this profile belongs to
  387. //Use: Finds if this profile belongs to a specified player
  388. //=====================================================================
  389. public boolean isPlayer(Player player)
  390. {
  391. return player.getName().equals(playerName);
  392. }
  393. public void decreaseLastHurt(){
  394. if(recentlyhurt >= 1){
  395. recentlyhurt--;
  396. }
  397. }
  398. public void decreaseBleedTicks(){
  399. if(bleedticks >= 1){
  400. bleedticks--;
  401. }
  402. }
  403. public Integer getBleedTicks(){
  404. return bleedticks;
  405. }
  406. public void setBleedTicks(Integer newvalue){
  407. bleedticks = newvalue;
  408. }
  409. public Boolean hasCooldowns(){
  410. if((treeFellerCooldown + superBreakerCooldown) >= 1){
  411. return true;
  412. } else {
  413. return false;
  414. }
  415. }
  416. /*
  417. * AXE PREPARATION
  418. */
  419. public boolean getAxePreparationMode(){
  420. return axePreparationMode;
  421. }
  422. public void setAxePreparationMode(Boolean bool){
  423. axePreparationMode = bool;
  424. }
  425. public Integer getAxePreparationTicks(){
  426. return axePreparationTicks;
  427. }
  428. public void setAxePreparationTicks(Integer newvalue){
  429. axePreparationTicks = newvalue;
  430. }
  431. public void decreaseAxePreparationTicks(){
  432. if(axePreparationTicks >= 1){
  433. axePreparationTicks--;
  434. }
  435. }
  436. /*
  437. * BERSERK MODE
  438. */
  439. public boolean getBerserkMode(){
  440. return berserkMode;
  441. }
  442. public void setBerserkMode(Boolean bool){
  443. berserkMode = bool;
  444. }
  445. public Integer getBerserkTicks(){
  446. return berserkTicks;
  447. }
  448. public void setBerserkTicks(Integer newvalue){
  449. berserkTicks = newvalue;
  450. }
  451. public void decreaseBerserkTicks(){
  452. if(berserkTicks >= 1){
  453. berserkTicks--;
  454. }
  455. }
  456. public void setBerserkCooldown(Integer newvalue){
  457. berserkCooldown = newvalue;
  458. }
  459. public int getBerserkCooldown(){
  460. return berserkCooldown;
  461. }
  462. public void decreaseBerserkCooldown(){
  463. if(berserkCooldown >= 1){
  464. berserkCooldown--;
  465. }
  466. }
  467. /*
  468. * SKULL SPLITTER
  469. */
  470. public boolean getSkullSplitterMode(){
  471. return skullSplitterMode;
  472. }
  473. public void setSkullSplitterMode(Boolean bool){
  474. skullSplitterMode = bool;
  475. }
  476. public Integer getSkullSplitterTicks(){
  477. return skullSplitterTicks;
  478. }
  479. public void setSkullSplitterTicks(Integer newvalue){
  480. skullSplitterTicks = newvalue;
  481. }
  482. public void decreaseSkullSplitterTicks(){
  483. if(skullSplitterTicks >= 1){
  484. skullSplitterTicks--;
  485. }
  486. }
  487. public void setSkullSplitterCooldown(Integer newvalue){
  488. skullSplitterCooldown = newvalue;
  489. }
  490. public int getSkullSplitterCooldown(){
  491. return skullSplitterCooldown;
  492. }
  493. public void decreaseSkullSplitterCooldown(){
  494. if(skullSplitterCooldown >= 1){
  495. skullSplitterCooldown--;
  496. }
  497. }
  498. /*
  499. * SERRATED STRIKES
  500. */
  501. public boolean getSerratedStrikesMode(){
  502. return serratedStrikesMode;
  503. }
  504. public void setSerratedStrikesMode(Boolean bool){
  505. serratedStrikesMode = bool;
  506. }
  507. public Integer getSerratedStrikesTicks(){
  508. return serratedStrikesTicks;
  509. }
  510. public void setSerratedStrikesTicks(Integer newvalue){
  511. serratedStrikesTicks = newvalue;
  512. }
  513. public void decreaseSerratedStrikesTicks(){
  514. if(serratedStrikesTicks >= 1){
  515. serratedStrikesTicks--;
  516. }
  517. }
  518. public void setSerratedStrikesCooldown(Integer newvalue){
  519. serratedStrikesCooldown = newvalue;
  520. }
  521. public int getSerratedStrikesCooldown(){
  522. return serratedStrikesCooldown;
  523. }
  524. public void decreaseSerratedStrikesCooldown(){
  525. if(serratedStrikesCooldown >= 1){
  526. serratedStrikesCooldown--;
  527. }
  528. }
  529. /*
  530. * GIGA DRILL BREAKER
  531. */
  532. public boolean getGigaDrillBreakerMode(){
  533. return gigaDrillBreakerMode;
  534. }
  535. public void setGigaDrillBreakerMode(Boolean bool){
  536. gigaDrillBreakerMode = bool;
  537. }
  538. public Integer getGigaDrillBreakerTicks(){
  539. return gigaDrillBreakerTicks;
  540. }
  541. public void setGigaDrillBreakerTicks(Integer newvalue){
  542. gigaDrillBreakerTicks = newvalue;
  543. }
  544. public void decreaseGigaDrillBreakerTicks(){
  545. if(gigaDrillBreakerTicks >= 1){
  546. gigaDrillBreakerTicks--;
  547. }
  548. }
  549. public void setGigaDrillBreakerCooldown(Integer newvalue){
  550. gigaDrillBreakerCooldown = newvalue;
  551. }
  552. public int getGigaDrillBreakerCooldown(){
  553. return gigaDrillBreakerCooldown;
  554. }
  555. public void decreaseGigaDrillBreakerCooldown(){
  556. if(gigaDrillBreakerCooldown >= 1){
  557. gigaDrillBreakerCooldown--;
  558. }
  559. }
  560. /*
  561. * TREE FELLER STUFF
  562. */
  563. public boolean getTreeFellerMode(){
  564. return treeFellerMode;
  565. }
  566. public void setTreeFellerMode(Boolean bool){
  567. treeFellerMode = bool;
  568. }
  569. public Integer getTreeFellerTicks(){
  570. return treeFellerTicks;
  571. }
  572. public void setTreeFellerTicks(Integer newvalue){
  573. treeFellerTicks = newvalue;
  574. }
  575. public void decreaseTreeFellerTicks(){
  576. if(treeFellerTicks >= 1){
  577. treeFellerTicks--;
  578. }
  579. }
  580. public void setTreeFellerCooldown(Integer newvalue){
  581. treeFellerCooldown = newvalue;
  582. }
  583. public int getTreeFellerCooldown(){
  584. return treeFellerCooldown;
  585. }
  586. public void decreaseTreeFellerCooldown(){
  587. if(treeFellerCooldown >= 1){
  588. treeFellerCooldown--;
  589. }
  590. }
  591. /*
  592. * MINING
  593. */
  594. public boolean getSuperBreakerMode(){
  595. return superBreakerMode;
  596. }
  597. public void setSuperBreakerMode(Boolean bool){
  598. superBreakerMode = bool;
  599. }
  600. public Integer getSuperBreakerTicks(){
  601. return superBreakerTicks;
  602. }
  603. public void setSuperBreakerTicks(Integer newvalue){
  604. superBreakerTicks = newvalue;
  605. }
  606. public void decreaseSuperBreakerTicks(){
  607. if(superBreakerTicks >= 1){
  608. superBreakerTicks--;
  609. }
  610. }
  611. public void setSuperBreakerCooldown(Integer newvalue){
  612. superBreakerCooldown = newvalue;
  613. }
  614. public int getSuperBreakerCooldown(){
  615. return superBreakerCooldown;
  616. }
  617. public void decreaseSuperBreakerCooldown(){
  618. if(superBreakerCooldown >= 1){
  619. superBreakerCooldown--;
  620. }
  621. }
  622. public Integer getRecentlyHurt(){
  623. return recentlyhurt;
  624. }
  625. public void setRecentlyHurt(Integer newvalue){
  626. recentlyhurt = newvalue;
  627. }
  628. public void skillUpAxes(int newskill){
  629. int x = 0;
  630. if(axes != null){
  631. if(isInt(axes)){
  632. x = Integer.parseInt(axes);
  633. }else {
  634. axes = "0";
  635. x = Integer.parseInt(axes);
  636. }
  637. }
  638. x += newskill;
  639. axes = Integer.toString(x);
  640. save();
  641. }
  642. public void skillUpAcrobatics(int newskill){
  643. int x = 0;
  644. if(acrobatics != null){
  645. if(isInt(acrobatics)){
  646. x = Integer.parseInt(acrobatics);
  647. }else {
  648. acrobatics = "0";
  649. x = Integer.parseInt(acrobatics);
  650. }
  651. }
  652. x += newskill;
  653. acrobatics = Integer.toString(x);
  654. save();
  655. }
  656. public void skillUpSwords(int newskill){
  657. int x = 0;
  658. if(swords != null){
  659. if(isInt(swords)){
  660. x = Integer.parseInt(swords);
  661. }else {
  662. swords = "0";
  663. x = Integer.parseInt(swords);
  664. }
  665. }
  666. x += newskill;
  667. swords = Integer.toString(x);
  668. save();
  669. }
  670. public void skillUpArchery(int newskill){
  671. int x = 0;
  672. if(archery != null){
  673. if(isInt(archery)){
  674. x = Integer.parseInt(archery);
  675. }else {
  676. archery = "0";
  677. x = Integer.parseInt(archery);
  678. }
  679. }
  680. x += newskill;
  681. archery = Integer.toString(x);
  682. save();
  683. }
  684. public void skillUpRepair(int newskill){
  685. int x = 0;
  686. if(repair != null){
  687. if(isInt(repair)){
  688. x = Integer.parseInt(repair);
  689. }else {
  690. repair = "0";
  691. x = Integer.parseInt(repair);
  692. }
  693. }
  694. x += newskill;
  695. repair = Integer.toString(x);
  696. save();
  697. }
  698. public void skillUpMining(int newmining){
  699. int x = 0;
  700. if(mining != null){
  701. if(isInt(mining)){
  702. x = Integer.parseInt(mining);
  703. }else {
  704. mining = "0";
  705. x = Integer.parseInt(mining);
  706. }
  707. }
  708. x += newmining;
  709. mining = Integer.toString(x);
  710. save();
  711. }
  712. public void skillUpUnarmed(int newskill){
  713. int x = 0;
  714. if(unarmed != null){
  715. if(isInt(unarmed)){
  716. x = Integer.parseInt(unarmed);
  717. }else {
  718. unarmed = "0";
  719. x = Integer.parseInt(unarmed);
  720. }
  721. }
  722. x += newskill;
  723. unarmed = Integer.toString(x);
  724. save();
  725. }
  726. public void skillUpHerbalism(int newskill){
  727. int x = 0;
  728. if(herbalism != null){
  729. if(isInt(herbalism)){
  730. x = Integer.parseInt(herbalism);
  731. }else {
  732. herbalism = "0";
  733. x = Integer.parseInt(herbalism);
  734. }
  735. }
  736. x += newskill;
  737. herbalism = Integer.toString(x);
  738. save();
  739. }
  740. public void skillUpExcavation(int newskill){
  741. int x = 0;
  742. if(excavation != null){
  743. if(isInt(excavation)){
  744. x = Integer.parseInt(excavation);
  745. }else {
  746. excavation = "0";
  747. x = Integer.parseInt(excavation);
  748. }
  749. }
  750. x += newskill;
  751. excavation = Integer.toString(x);
  752. save();
  753. }
  754. public void skillUpWoodCutting(int newskill){
  755. int x = 0;
  756. if(woodcutting != null){
  757. if(isInt(woodcutting)){
  758. x = Integer.parseInt(woodcutting);
  759. }else {
  760. woodcutting = "0";
  761. x = Integer.parseInt(woodcutting);
  762. }
  763. }
  764. x += newskill;
  765. woodcutting = Integer.toString(x);
  766. save();
  767. }
  768. public String getRepair(){
  769. if(repair != null && !repair.equals("") && !repair.equals("null")){
  770. return repair;
  771. } else {
  772. return "0";
  773. }
  774. }
  775. public String getMining(){
  776. if(mining != null && !mining.equals("") && !mining.equals("null")){
  777. return mining;
  778. } else {
  779. return "0";
  780. }
  781. }
  782. public String getUnarmed(){
  783. if(unarmed != null && !unarmed.equals("") && !unarmed.equals("null")){
  784. return unarmed;
  785. } else {
  786. return "0";
  787. }
  788. }
  789. public String getHerbalism(){
  790. if(herbalism != null && !herbalism.equals("") && !herbalism.equals("null")){
  791. return herbalism;
  792. } else {
  793. return "0";
  794. }
  795. }
  796. public String getExcavation(){
  797. if(excavation != null && !excavation.equals("") && !excavation.equals("null")){
  798. return excavation;
  799. } else {
  800. return "0";
  801. }
  802. }
  803. public String getArchery(){
  804. if(archery != null && !archery.equals("") && !archery.equals("null")){
  805. return archery;
  806. } else {
  807. return "0";
  808. }
  809. }
  810. public String getSwords(){
  811. if(swords != null && !swords.equals("") && !swords.equals("null")){
  812. return swords;
  813. } else {
  814. return "0";
  815. }
  816. }
  817. public String getAxes(){
  818. if(axes != null && !axes.equals("") && !axes.equals("null")){
  819. return axes;
  820. } else {
  821. return "0";
  822. }
  823. }
  824. public String getAcrobatics(){
  825. if(acrobatics != null && !acrobatics.equals("") && !acrobatics.equals("null")){
  826. return acrobatics;
  827. } else {
  828. return "0";
  829. }
  830. }
  831. public int getMiningInt(){
  832. if(isInt(mining)){
  833. int x = Integer.parseInt(mining);
  834. return x;
  835. } else{
  836. return 0;
  837. }
  838. }
  839. public int getUnarmedInt(){
  840. if(isInt(unarmed)){
  841. int x = Integer.parseInt(unarmed);
  842. return x;
  843. } else{
  844. return 0;
  845. }
  846. }
  847. public int getArcheryInt(){
  848. if(isInt(archery)){
  849. int x = Integer.parseInt(archery);
  850. return x;
  851. } else{
  852. return 0;
  853. }
  854. }
  855. public int getSwordsInt(){
  856. if(isInt(swords)){
  857. int x = Integer.parseInt(swords);
  858. return x;
  859. } else{
  860. return 0;
  861. }
  862. }
  863. public int getAxesInt(){
  864. if(isInt(axes)){
  865. int x = Integer.parseInt(axes);
  866. return x;
  867. } else{
  868. return 0;
  869. }
  870. }
  871. public int getAcrobaticsInt(){
  872. if(isInt(acrobatics)){
  873. int x = Integer.parseInt(acrobatics);
  874. return x;
  875. } else{
  876. return 0;
  877. }
  878. }
  879. public int getHerbalismInt(){
  880. if(isInt(herbalism)){
  881. int x = Integer.parseInt(herbalism);
  882. return x;
  883. } else{
  884. return 0;
  885. }
  886. }
  887. public int getExcavationInt(){
  888. if(isInt(excavation)){
  889. int x = Integer.parseInt(excavation);
  890. return x;
  891. } else{
  892. return 0;
  893. }
  894. }
  895. public int getRepairInt(){
  896. if(isInt(repair)){
  897. int x = Integer.parseInt(repair);
  898. return x;
  899. } else{
  900. return 0;
  901. }
  902. }
  903. public int getWoodCuttingInt(){
  904. if(isInt(woodcutting)){
  905. int x = Integer.parseInt(woodcutting);
  906. return x;
  907. } else{
  908. return 0;
  909. }
  910. }
  911. public String getWoodCutting(){
  912. if(woodcutting != null && !woodcutting.equals("") && !woodcutting.equals("null")){
  913. return woodcutting;
  914. } else {
  915. return "0";
  916. }
  917. }
  918. /*
  919. * EXPERIENCE STUFF
  920. */
  921. public void clearRepairGather(){
  922. repairgather = "0";
  923. }
  924. public void clearUnarmedGather(){
  925. unarmedgather = "0";
  926. }
  927. public void clearHerbalismGather(){
  928. herbalismgather = "0";
  929. }
  930. public void clearExcavationGather(){
  931. excavationgather = "0";
  932. }
  933. public void clearArcheryGather(){
  934. archerygather = "0";
  935. }
  936. public void clearSwordsGather(){
  937. swordsgather = "0";
  938. }
  939. public void clearAxesGather(){
  940. axesgather = "0";
  941. }
  942. public void clearAcrobaticsGather(){
  943. acrobaticsgather = "0";
  944. }
  945. public void addAcrobaticsGather(int newgather)
  946. {
  947. int x = 0;
  948. if(isInt(acrobaticsgather)){
  949. x = Integer.parseInt(acrobaticsgather);
  950. }
  951. x += newgather;
  952. acrobaticsgather = String.valueOf(x);
  953. save();
  954. }
  955. public void addAxesGather(int newgather)
  956. {
  957. int x = 0;
  958. if(isInt(axesgather)){
  959. x = Integer.parseInt(axesgather);
  960. }
  961. x += newgather;
  962. axesgather = String.valueOf(x);
  963. save();
  964. }
  965. public void addSwordsGather(int newgather)
  966. {
  967. int x = 0;
  968. if(isInt(swordsgather)){
  969. x = Integer.parseInt(swordsgather);
  970. }
  971. x += newgather;
  972. swordsgather = String.valueOf(x);
  973. save();
  974. }
  975. public void addArcheryGather(int newgather)
  976. {
  977. int x = 0;
  978. if(isInt(archerygather)){
  979. x = Integer.parseInt(archerygather);
  980. }
  981. x += newgather;
  982. archerygather = String.valueOf(x);
  983. save();
  984. }
  985. public void addExcavationGather(int newgather)
  986. {
  987. int x = 0;
  988. if(isInt(excavationgather)){
  989. x = Integer.parseInt(excavationgather);
  990. }
  991. x += newgather;
  992. excavationgather = String.valueOf(x);
  993. save();
  994. }
  995. public void addHerbalismGather(int newgather)
  996. {
  997. int x = 0;
  998. if(isInt(herbalismgather)){
  999. x = Integer.parseInt(herbalismgather);
  1000. }
  1001. x += newgather;
  1002. herbalismgather = String.valueOf(x);
  1003. save();
  1004. }
  1005. public void addRepairGather(int newgather)
  1006. {
  1007. int x = 0;
  1008. if(isInt(repairgather)){
  1009. x = Integer.parseInt(repairgather);
  1010. }
  1011. x += newgather;
  1012. repairgather = String.valueOf(x);
  1013. save();
  1014. }
  1015. public void addUnarmedGather(int newgather)
  1016. {
  1017. int x = 0;
  1018. if(isInt(unarmedgather)){
  1019. x = Integer.parseInt(unarmedgather);
  1020. }
  1021. x += newgather;
  1022. unarmedgather = String.valueOf(x);
  1023. save();
  1024. }
  1025. public void addWoodcuttingGather(int newgather)
  1026. {
  1027. int x = 0;
  1028. if(isInt(wgather)){
  1029. x = Integer.parseInt(wgather);
  1030. }
  1031. x += newgather;
  1032. wgather = String.valueOf(x);
  1033. save();
  1034. }
  1035. public void removeWoodCuttingGather(int newgather){
  1036. int x = 0;
  1037. if(isInt(wgather)){
  1038. x = Integer.parseInt(wgather);
  1039. }
  1040. x -= newgather;
  1041. wgather = String.valueOf(x);
  1042. save();
  1043. }
  1044. public void addMiningGather(int newgather)
  1045. {
  1046. int x = 0;
  1047. if(isInt(gather)){
  1048. x = Integer.parseInt(gather);
  1049. } else {
  1050. x = 0;
  1051. }
  1052. x += newgather;
  1053. gather = String.valueOf(x);
  1054. save();
  1055. }
  1056. public void removeMiningGather(int newgather){
  1057. int x = 0;
  1058. if(isInt(gather)){
  1059. x = Integer.parseInt(gather);
  1060. }
  1061. x -= newgather;
  1062. gather = String.valueOf(x);
  1063. save();
  1064. }
  1065. public void removeRepairGather(int newgather){
  1066. int x = 0;
  1067. if(isInt(repairgather)){
  1068. x = Integer.parseInt(repairgather);
  1069. }
  1070. x -= newgather;
  1071. repairgather = String.valueOf(x);
  1072. save();
  1073. }
  1074. public void removeUnarmedGather(int newgather){
  1075. int x = 0;
  1076. if(isInt(unarmedgather)){
  1077. x = Integer.parseInt(unarmedgather);
  1078. }
  1079. x -= newgather;
  1080. unarmedgather = String.valueOf(x);
  1081. save();
  1082. }
  1083. public void removeHerbalismGather(int newgather){
  1084. int x = 0;
  1085. if(isInt(herbalismgather)){
  1086. x = Integer.parseInt(herbalismgather);
  1087. }
  1088. x -= newgather;
  1089. herbalismgather = String.valueOf(x);
  1090. save();
  1091. }
  1092. public void removeExcavationGather(int newgather){
  1093. int x = 0;
  1094. if(isInt(excavationgather)){
  1095. x = Integer.parseInt(excavationgather);
  1096. }
  1097. x -= newgather;
  1098. excavationgather = String.valueOf(x);
  1099. save();
  1100. }
  1101. public void removeArcheryGather(int newgather){
  1102. int x = 0;
  1103. if(isInt(archerygather)){
  1104. x = Integer.parseInt(archerygather);
  1105. }
  1106. x -= newgather;
  1107. archerygather = String.valueOf(x);
  1108. save();
  1109. }
  1110. public void removeSwordsGather(int newgather){
  1111. int x = 0;
  1112. if(isInt(swordsgather)){
  1113. x = Integer.parseInt(swordsgather);
  1114. }
  1115. x -= newgather;
  1116. swordsgather = String.valueOf(x);
  1117. save();
  1118. }
  1119. public void removeAxesGather(int newgather){
  1120. int x = 0;
  1121. if(isInt(axesgather)){
  1122. x = Integer.parseInt(axesgather);
  1123. }
  1124. x -= newgather;
  1125. axesgather = String.valueOf(x);
  1126. save();
  1127. }
  1128. public void removeAcrobaticsGather(int newgather){
  1129. int x = 0;
  1130. if(isInt(acrobaticsgather)){
  1131. x = Integer.parseInt(acrobaticsgather);
  1132. }
  1133. x -= newgather;
  1134. acrobaticsgather = String.valueOf(x);
  1135. save();
  1136. }
  1137. public boolean isInt(String string){
  1138. try {
  1139. int x = Integer.parseInt(string);
  1140. }
  1141. catch(NumberFormatException nFE) {
  1142. return false;
  1143. }
  1144. return true;
  1145. }
  1146. public boolean isDouble(String string){
  1147. try {
  1148. Double x = Double.valueOf(string);
  1149. }
  1150. catch(NumberFormatException nFE) {
  1151. return false;
  1152. }
  1153. return true;
  1154. }
  1155. public void acceptInvite(){
  1156. party = invite;
  1157. invite = "";
  1158. save();
  1159. }
  1160. public void modifyInvite(String invitename){
  1161. invite = invitename;
  1162. }
  1163. //Returns player gather
  1164. public String getMiningGather(){
  1165. if(gather != null && !gather.equals("") && !gather.equals("null")){
  1166. return gather;
  1167. } else {
  1168. return "0";
  1169. }
  1170. }
  1171. public String getInvite() { return invite; }
  1172. public String getWoodCuttingGather(){
  1173. if(wgather != null && !wgather.equals("") && !wgather.equals("null")){
  1174. return wgather;
  1175. } else {
  1176. return "0";
  1177. }
  1178. }
  1179. public String getRepairGather(){
  1180. if(repairgather != null && !repairgather.equals("") && !repairgather.equals("null")){
  1181. return repairgather;
  1182. } else {
  1183. return "0";
  1184. }
  1185. }
  1186. public String getHerbalismGather(){
  1187. if(herbalismgather != null && !herbalismgather.equals("") && !herbalismgather.equals("null")){
  1188. return herbalismgather;
  1189. } else {
  1190. return "0";
  1191. }
  1192. }
  1193. public String getExcavationGather(){
  1194. if(excavationgather != null && !excavationgather.equals("") && !excavationgather.equals("null")){
  1195. return excavationgather;
  1196. } else {
  1197. return "0";
  1198. }
  1199. }
  1200. public String getArcheryGather(){
  1201. if(archerygather != null && !archerygather.equals("") && !archerygather.equals("null")){
  1202. return archerygather;
  1203. } else {
  1204. return "0";
  1205. }
  1206. }
  1207. public String getSwordsGather(){
  1208. if(swordsgather != null && !swordsgather.equals("") && !swordsgather.equals("null")){
  1209. return swordsgather;
  1210. } else {
  1211. return "0";
  1212. }
  1213. }
  1214. public String getAxesGather(){
  1215. if(axesgather != null && !axesgather.equals("") && !axesgather.equals("null")){
  1216. return axesgather;
  1217. } else {
  1218. return "0";
  1219. }
  1220. }
  1221. public String getAcrobaticsGather(){
  1222. if(acrobaticsgather != null && !acrobaticsgather.equals("") && !acrobaticsgather.equals("null")){
  1223. return acrobaticsgather;
  1224. } else {
  1225. return "0";
  1226. }
  1227. }
  1228. public String getUnarmedGather(){
  1229. if(unarmedgather != null && !unarmedgather.equals("") && !unarmedgather.equals("null")){
  1230. return unarmedgather;
  1231. } else {
  1232. return "0";
  1233. }
  1234. }
  1235. public int getWoodCuttingGatherInt() {
  1236. if(isInt(wgather)){
  1237. return Integer.parseInt(wgather);
  1238. } else {
  1239. wgather = "0";
  1240. save();
  1241. return 0;
  1242. }
  1243. }
  1244. public int getRepairGatherInt() {
  1245. if(isInt(repairgather)){
  1246. return Integer.parseInt(repairgather);
  1247. } else {
  1248. repairgather = "0";
  1249. save();
  1250. return 0;
  1251. }
  1252. }
  1253. public int getUnarmedGatherInt() {
  1254. if(isInt(unarmedgather)){
  1255. return Integer.parseInt(unarmedgather);
  1256. } else {
  1257. unarmedgather = "0";
  1258. save();
  1259. return 0;
  1260. }
  1261. }
  1262. public int getHerbalismGatherInt() {
  1263. if(isInt(herbalismgather)){
  1264. return Integer.parseInt(herbalismgather);
  1265. } else {
  1266. herbalismgather = "0";
  1267. save();
  1268. return 0;
  1269. }
  1270. }
  1271. public int getExcavationGatherInt() {
  1272. if(isInt(excavationgather)){
  1273. return Integer.parseInt(excavationgather);
  1274. } else {
  1275. excavationgather = "0";
  1276. save();
  1277. return 0;
  1278. }
  1279. }
  1280. public int getArcheryGatherInt() {
  1281. if(isInt(archerygather)){
  1282. return Integer.parseInt(archerygather);
  1283. } else {
  1284. archerygather = "0";
  1285. save();
  1286. return 0;
  1287. }
  1288. }
  1289. public int getSwordsGatherInt() {
  1290. if(isInt(swordsgather)){
  1291. return Integer.parseInt(swordsgather);
  1292. } else {
  1293. swordsgather = "0";
  1294. save();
  1295. return 0;
  1296. }
  1297. }
  1298. public int getAxesGatherInt() {
  1299. if(isInt(axesgather)){
  1300. return Integer.parseInt(axesgather);
  1301. } else {
  1302. axesgather = "0";
  1303. save();
  1304. return 0;
  1305. }
  1306. }
  1307. public int getAcrobaticsGatherInt() {
  1308. if(isInt(acrobaticsgather)){
  1309. return Integer.parseInt(acrobaticsgather);
  1310. } else {
  1311. acrobaticsgather = "0";
  1312. save();
  1313. return 0;
  1314. }
  1315. }
  1316. public void modifyskill(int newvalue, String skillname){
  1317. if(skillname.toLowerCase().equals("mining")){
  1318. mining = String.valueOf(newvalue);
  1319. }
  1320. if(skillname.toLowerCase().equals("woodcutting")){
  1321. woodcutting = String.valueOf(newvalue);
  1322. }
  1323. if(skillname.toLowerCase().equals("repair")){
  1324. repair = String.valueOf(newvalue);
  1325. }
  1326. if(skillname.toLowerCase().equals("herbalism")){
  1327. herbalism = String.valueOf(newvalue);
  1328. }
  1329. if(skillname.toLowerCase().equals("acrobatics")){
  1330. acrobatics = String.valueOf(newvalue);
  1331. }
  1332. if(skillname.toLowerCase().equals("swords")){
  1333. swords = String.valueOf(newvalue);
  1334. }
  1335. if(skillname.toLowerCase().equals("archery")){
  1336. archery = String.valueOf(newvalue);
  1337. }
  1338. if(skillname.toLowerCase().equals("unarmed")){
  1339. unarmed = String.valueOf(newvalue);
  1340. }
  1341. if(skillname.toLowerCase().equals("excavation")){
  1342. excavation = String.valueOf(newvalue);
  1343. }
  1344. if(skillname.toLowerCase().equals("axes")){
  1345. axes = String.valueOf(newvalue);
  1346. }
  1347. save();
  1348. }
  1349. public Integer getXpToLevel(String skillname){
  1350. if(skillname.equals("mining")){
  1351. return ((getMiningInt() + 50) * mcLoadProperties.miningxpmodifier) * mcLoadProperties.globalxpmodifier;
  1352. }
  1353. if(skillname.equals("woodcutting")){
  1354. return ((getWoodCuttingInt() + 50) * mcLoadProperties.woodcuttingxpmodifier) * mcLoadProperties.globalxpmodifier;
  1355. }
  1356. if(skillname.equals("repair")){
  1357. return ((getRepairInt() + 50) * mcLoadProperties.repairxpmodifier) * mcLoadProperties.globalxpmodifier;
  1358. }
  1359. if(skillname.equals("herbalism")){
  1360. return ((getHerbalismInt() + 50) * mcLoadProperties.herbalismxpmodifier) * mcLoadProperties.globalxpmodifier;
  1361. }
  1362. if(skillname.equals("acrobatics")){
  1363. return ((getAcrobaticsInt() + 50) * mcLoadProperties.acrobaticsxpmodifier) * mcLoadProperties.globalxpmodifier;
  1364. }
  1365. if(skillname.equals("swords")){
  1366. return ((getSwordsInt() + 50) * mcLoadProperties.swordsxpmodifier) * mcLoadProperties.globalxpmodifier;
  1367. }
  1368. if(skillname.equals("archery")){
  1369. return ((getArcheryInt() + 50) * mcLoadProperties.archeryxpmodifier) * mcLoadProperties.globalxpmodifier;
  1370. }
  1371. if(skillname.equals("unarmed")){
  1372. return ((getUnarmedInt() + 50) * mcLoadProperties.unarmedxpmodifier) * mcLoadProperties.globalxpmodifier;
  1373. }
  1374. if(skillname.equals("excavation")){
  1375. return ((getExcavationInt() + 50) * mcLoadProperties.excavationxpmodifier) * mcLoadProperties.globalxpmodifier;
  1376. }
  1377. if(skillname.equals("axes")){
  1378. return ((getAxesInt() + 50) * mcLoadProperties.axesxpmodifier) * mcLoadProperties.globalxpmodifier;
  1379. } else {
  1380. return 0;
  1381. }
  1382. }
  1383. public int getPowerLevel(){
  1384. int x = 0;
  1385. x+=getMiningInt()+getRepairInt()+getWoodCuttingInt()+getUnarmedInt()+getHerbalismInt()+getExcavationInt()+getArcheryInt()+getSwordsInt()+getAxesInt()+getAcrobaticsInt();
  1386. return x;
  1387. }
  1388. public int getMiningGatherInt() {
  1389. if(isInt(gather)){
  1390. return Integer.parseInt(gather);
  1391. } else {
  1392. gather = "0";
  1393. save();
  1394. return 0;
  1395. }
  1396. }
  1397. //Store the player's party
  1398. public void setParty(String newParty)
  1399. {
  1400. party = newParty;
  1401. save();
  1402. }
  1403. //Retrieve the player's party
  1404. public String getParty() {return party;}
  1405. //Remove party
  1406. public void removeParty() {
  1407. party = null;
  1408. save();
  1409. }
  1410. //Retrieve whether or not the player is in a party
  1411. public boolean inParty() {
  1412. if(party != null && !party.equals("") && !party.equals("null")){
  1413. return true;
  1414. } else {
  1415. return false;
  1416. }
  1417. }
  1418. //Retrieve whether or not the player has an invite
  1419. public boolean hasPartyInvite() {
  1420. if(invite != null && !invite.equals("") && !invite.equals("null")){
  1421. return true;
  1422. } else {
  1423. return false;
  1424. }
  1425. }
  1426. public String getMySpawnWorld(Plugin plugin){
  1427. if(myspawnworld != null && !myspawnworld.equals("") && !myspawnworld.equals("null")){
  1428. return myspawnworld;
  1429. } else {
  1430. return plugin.getServer().getWorlds().get(0).toString();
  1431. }
  1432. }
  1433. //Save a users spawn location
  1434. public void setMySpawn(double x, double y, double z, String myspawnworldlocation){
  1435. myspawn = x+","+y+","+z;
  1436. myspawnworld = myspawnworldlocation;
  1437. save();
  1438. }
  1439. public String getX(){
  1440. String[] split = myspawn.split(",");
  1441. String x = split[0];
  1442. return x;
  1443. }
  1444. public String getY(){
  1445. String[] split = myspawn.split(",");
  1446. String y = split[1];
  1447. return y;
  1448. }
  1449. public String getZ(){
  1450. String[] split = myspawn.split(",");
  1451. String z = split[2];
  1452. return z;
  1453. }
  1454. public void setDead(boolean x){
  1455. dead = x;
  1456. save();
  1457. }
  1458. public boolean isDead(){
  1459. return dead;
  1460. }
  1461. public Location getMySpawn(Player player){
  1462. Location loc = player.getWorld().getSpawnLocation();
  1463. if(isDouble(getX()) && isDouble(getY()) && isDouble(getX())){
  1464. loc.setX(Double.parseDouble(mcUsers.getProfile(player).getX()));
  1465. loc.setY(Double.parseDouble(mcUsers.getProfile(player).getY()));
  1466. loc.setZ(Double.parseDouble(mcUsers.getProfile(player).getZ()));
  1467. } else {
  1468. return null;
  1469. }
  1470. loc.setYaw(0);
  1471. loc.setPitch(0);
  1472. return loc;
  1473. }
  1474. }
  1475. }