Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2014
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.55 KB | None | 0 0
  1. package me.InfiniumDevelopments.DarkRP;
  2.  
  3. import java.util.List;
  4. import java.util.Random;
  5.  
  6. import net.minecraft.server.v1_6_R3.Block;
  7.  
  8. import org.bukkit.Bukkit;
  9. import org.bukkit.ChatColor;
  10. import org.bukkit.Effect;
  11. import org.bukkit.Location;
  12. import org.bukkit.block.Sign;
  13. import org.bukkit.entity.Player;
  14. import org.bukkit.event.EventHandler;
  15. import org.bukkit.event.Listener;
  16. import org.bukkit.event.block.BlockPlaceEvent;
  17. import org.bukkit.event.player.PlayerInteractEvent;
  18. import org.bukkit.inventory.ItemStack;
  19. import org.bukkit.inventory.PlayerInventory;
  20. import org.bukkit.inventory.meta.ItemMeta;
  21. import org.bukkit.potion.PotionEffect;
  22. import org.bukkit.potion.PotionEffectType;
  23. import org.bukkit.scheduler.BukkitScheduler;
  24.  
  25. public class DrugHandler implements Listener {
  26. public DarkRPMain plugin;
  27.  
  28. public PotionEffect withdraw1 = new PotionEffect(PotionEffectType.SLOW, 72000, 1);
  29. public PotionEffect withdraw2 = new PotionEffect(PotionEffectType.SLOW_DIGGING, 72000, 1);
  30. public PotionEffect withdraw3 = new PotionEffect(PotionEffectType.CONFUSION, 72000, 0);
  31.  
  32. public DrugHandler(DarkRPMain instance) {
  33. plugin = instance;
  34. }
  35.  
  36. @EventHandler
  37. public boolean onBlockPlace(final BlockPlaceEvent event) {
  38. final Player player = (Player) event.getPlayer();
  39. BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
  40. ItemStack i = event.getItemInHand();
  41. ItemMeta im = i.getItemMeta();
  42. // Strings for the lores of special items ..
  43. String dl = "Generic Drug";
  44. if (event.getBlockPlaced() == Block.STONE) {
  45. player.sendMessage("Testing.");
  46. if (im.getLore().contains(dl)) {
  47. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  48.  
  49. @Override
  50. public void run() {
  51. Sign sign = (Sign) event.getBlockPlaced();
  52. sign.setLine(0, "[Drug Lab]");
  53. sign.setLine(1, player.getName());
  54. sign.setLine(2, "price");
  55. sign.setLine(3, "Generic Drug");
  56. player.sendMessage("You successfully created a drug lab!");
  57.  
  58. }
  59.  
  60. }, 1L);
  61.  
  62.  
  63. }
  64. }
  65.  
  66. return false;
  67. }
  68.  
  69. @SuppressWarnings("deprecation")
  70. @EventHandler
  71. public boolean onItemClick(PlayerInteractEvent event) {
  72. final BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
  73. final Player player = event.getPlayer();
  74. PlayerInventory pi = player.getInventory();
  75. ItemStack item = event.getItem();
  76. ItemMeta im = item.getItemMeta();
  77. List<String> lore = im.getLore();
  78. // Strings for the Lore of each drug
  79. String BathSalts = "Bath Salts";
  80. String CrystalMeth = "Crystal Meth";
  81. String Ketamine = "Ketamine";
  82. String Cocaine = "Cocaine";
  83. String Heroin = "Heroin";
  84. String LSD = "LSD";
  85. String Weed = "Weed";
  86. String Alcohol = "Alcohol";
  87. String GHB = "GHB";
  88. String INBOMe = "25I-NBOMe";
  89. try {
  90. int drugCount = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  91. if (lore.contains(BathSalts)) {
  92. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  93. if (drugCount >= 7) {
  94. Random rand = new Random();
  95. int selector;
  96. for (int counter =1; counter <=1; counter++) {
  97. selector = 1 + rand.nextInt(5); // Returning 1-5
  98. if (selector == 1) {
  99. player.setHealth(0);
  100. }
  101. }
  102. }
  103. }
  104. else {
  105. if (drugCount >= 5) {
  106. Random rand = new Random();
  107. int selector;
  108. for (int counter =1; counter <=1; counter++) {
  109. selector = 1 + rand.nextInt(5); // Returning 1-5
  110. if (selector == 1) {
  111. player.setHealth(0);
  112. }
  113. }
  114. }
  115. }
  116. plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
  117. plugin.saveConfig();
  118. pi.remove(item);
  119. player.sendMessage("Your count is " + drugCount);
  120. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  121.  
  122.  
  123. @Override
  124. public void run() {
  125. player.sendMessage("Test...");
  126. int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  127. // Checking to see if the player has the Tolerance permission ...
  128. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  129. if (count >= 7) {
  130. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  131. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY+ "You can cure the effects by either using more or becoming clean.");
  132. player.addPotionEffect(withdraw1);
  133. player.addPotionEffect(withdraw2);
  134. player.addPotionEffect(withdraw3);
  135.  
  136. }
  137. else {
  138. return;
  139. }
  140. }
  141. else {
  142. if (count >=5) {
  143. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  144. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You can cure the effects by either using more or becoming clean.");
  145. player.addPotionEffect(withdraw1);
  146. player.addPotionEffect(withdraw2);
  147. player.addPotionEffect(withdraw3);
  148.  
  149. }
  150. else {
  151. return;
  152. }
  153. }
  154.  
  155. }
  156.  
  157. }, 12000L);
  158. }
  159. else if (lore.contains(CrystalMeth)) {
  160. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  161. if (drugCount >= 7) {
  162. Random rand = new Random();
  163. int selector;
  164. for (int counter =1; counter <=1; counter++) {
  165. selector = 1 + rand.nextInt(5); // Returning 1-5
  166. if (selector == 1) {
  167. player.setHealth(0);
  168. }
  169. }
  170. }
  171. }
  172. else {
  173. if (drugCount >= 5) {
  174. Random rand = new Random();
  175. int selector;
  176. for (int counter =1; counter <=1; counter++) {
  177. selector = 1 + rand.nextInt(5); // Returning 1-5
  178. if (selector == 1) {
  179. player.setHealth(0);
  180. }
  181. }
  182. }
  183. }
  184. plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
  185. plugin.saveConfig();
  186. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 6000, 1));
  187. player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 6000, 0));
  188. pi.remove(item);
  189. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  190.  
  191.  
  192. @Override
  193. public void run() {
  194. player.sendMessage("Test...");
  195. int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  196. // Checking to see if the player has the Tolerance permission ...
  197. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  198. if (count >= 7) {
  199. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  200. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY+ "You can cure the effects by either using more or becoming clean.");
  201. player.addPotionEffect(withdraw1);
  202. player.addPotionEffect(withdraw2);
  203. player.addPotionEffect(withdraw3);
  204.  
  205. }
  206. else {
  207. return;
  208. }
  209. }
  210. else {
  211. if (count >=5) {
  212. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  213. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You can cure the effects by either using more or becoming clean.");
  214. player.addPotionEffect(withdraw1);
  215. player.addPotionEffect(withdraw2);
  216. player.addPotionEffect(withdraw3);
  217.  
  218. }
  219. else {
  220. return;
  221. }
  222. }
  223.  
  224. }
  225.  
  226. }, 6000L);
  227. }
  228. else if (lore.contains(Ketamine)) {
  229. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  230. if (drugCount >= 7) {
  231. Random rand = new Random();
  232. int selector;
  233. for (int counter =1; counter <=1; counter++) {
  234. selector = 1 + rand.nextInt(5); // Returning 1-5
  235. if (selector == 1) {
  236. player.setHealth(0);
  237. }
  238. }
  239. }
  240. }
  241. else {
  242. if (drugCount >= 5) {
  243. Random rand = new Random();
  244. int selector;
  245. for (int counter =1; counter <=1; counter++) {
  246. selector = 1 + rand.nextInt(5); // Returning 1-5
  247. if (selector == 1) {
  248. player.setHealth(0);
  249. }
  250. }
  251. }
  252. }
  253. plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
  254. plugin.saveConfig();
  255. player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 3600, 0));
  256. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 3600, 0));
  257. pi.remove(item);
  258. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  259.  
  260.  
  261. @Override
  262. public void run() {
  263. player.sendMessage("Test...");
  264. int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  265. // Checking to see if the player has the Tolerance permission ...
  266. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  267. if (count >= 7) {
  268. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  269. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY+ "You can cure the effects by either using more or becoming clean.");
  270. player.addPotionEffect(withdraw1);
  271. player.addPotionEffect(withdraw2);
  272. player.addPotionEffect(withdraw3);
  273.  
  274. }
  275. else {
  276. return;
  277. }
  278. }
  279. else {
  280. if (count >=5) {
  281. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  282. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You can cure the effects by either using more or becoming clean.");
  283. player.addPotionEffect(withdraw1);
  284. player.addPotionEffect(withdraw2);
  285. player.addPotionEffect(withdraw3);
  286.  
  287. }
  288. else {
  289. return;
  290. }
  291. }
  292.  
  293. }
  294.  
  295. }, 3600L);
  296. }
  297. else if (lore.contains(Cocaine)) {
  298. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  299. if (drugCount >= 7) {
  300. Random rand = new Random();
  301. int selector;
  302. for (int counter =1; counter <=1; counter++) {
  303. selector = 1 + rand.nextInt(5); // Returning 1-5
  304. if (selector == 1) {
  305. player.setHealth(0);
  306. }
  307. }
  308. }
  309. }
  310. else {
  311. if (drugCount >= 5) {
  312. Random rand = new Random();
  313. int selector;
  314. for (int counter =1; counter <=1; counter++) {
  315. selector = 1 + rand.nextInt(5); // Returning 1-5
  316. if (selector == 1) {
  317. player.setHealth(0);
  318. }
  319. }
  320. }
  321. }
  322. plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
  323. plugin.saveConfig();
  324. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 12000, 0));
  325. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  326.  
  327. @Override
  328. public void run() {
  329. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 6000, 0));
  330. player.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 6000, 0));
  331. player.sendMessage(ChatColor.ITALIC + "I'm not feeling so well anymore ...");
  332. }
  333.  
  334. }, 12000L);
  335. pi.remove(item);
  336. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  337.  
  338.  
  339. @Override
  340. public void run() {
  341. player.sendMessage("Test...");
  342. int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  343. // Checking to see if the player has the Tolerance permission ...
  344. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  345. if (count >= 7) {
  346. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  347. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY+ "You can cure the effects by either using more or becoming clean.");
  348. player.addPotionEffect(withdraw1);
  349. player.addPotionEffect(withdraw2);
  350. player.addPotionEffect(withdraw3);
  351.  
  352. }
  353. else {
  354. return;
  355. }
  356. }
  357. else {
  358. if (count >=5) {
  359. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  360. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You can cure the effects by either using more or becoming clean.");
  361. player.addPotionEffect(withdraw1);
  362. player.addPotionEffect(withdraw2);
  363. player.addPotionEffect(withdraw3);
  364.  
  365. }
  366. else {
  367. return;
  368. }
  369. }
  370.  
  371. }
  372.  
  373. }, 18000L);
  374. }
  375. else if (lore.contains(Heroin)) {
  376. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  377. if (drugCount >= 7) {
  378. Random rand = new Random();
  379. int selector;
  380. for (int counter =1; counter <=1; counter++) {
  381. selector = 1 + rand.nextInt(5); // Returning 1-5
  382. if (selector == 1) {
  383. player.setHealth(0);
  384. }
  385. }
  386. }
  387. }
  388. else {
  389. if (drugCount >= 5) {
  390. Random rand = new Random();
  391. int selector;
  392. for (int counter =1; counter <=1; counter++) {
  393. selector = 1 + rand.nextInt(5); // Returning 1-5
  394. if (selector == 1) {
  395. player.setHealth(0);
  396. }
  397. }
  398. }
  399. }
  400. plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
  401. plugin.saveConfig();
  402. player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 10800, 1));
  403. player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 3600, 0));
  404. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  405.  
  406. @Override
  407. public void run() {
  408. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 7200, 0));
  409. }
  410.  
  411. }, 10800L);
  412. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  413.  
  414. @Override
  415. public void run() {
  416. player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 3600, 0));
  417.  
  418. }
  419.  
  420. }, 14400L);
  421. pi.remove(item);
  422. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  423.  
  424.  
  425. @Override
  426. public void run() {
  427. player.sendMessage("Test...");
  428. int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  429. // Checking to see if the player has the Tolerance permission ...
  430. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  431. if (count >= 7) {
  432. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  433. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY+ "You can cure the effects by either using more or becoming clean.");
  434. player.addPotionEffect(withdraw1);
  435. player.addPotionEffect(withdraw2);
  436. player.addPotionEffect(withdraw3);
  437.  
  438. }
  439. else {
  440. return;
  441. }
  442. }
  443. else {
  444. if (count >=5) {
  445. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  446. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You can cure the effects by either using more or becoming clean.");
  447. player.addPotionEffect(withdraw1);
  448. player.addPotionEffect(withdraw2);
  449. player.addPotionEffect(withdraw3);
  450.  
  451. }
  452. else {
  453. return;
  454. }
  455. }
  456.  
  457. }
  458.  
  459. }, 18000L);
  460. }
  461. else if (lore.contains(LSD)) {
  462. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  463. if (drugCount >= 7) {
  464. Random rand = new Random();
  465. int selector;
  466. for (int counter =1; counter <=1; counter++) {
  467. selector = 1 + rand.nextInt(5); // Returning 1-5
  468. if (selector == 1) {
  469. player.setHealth(0);
  470. }
  471. }
  472. }
  473. }
  474. else {
  475. if (drugCount >= 5) {
  476. Random rand = new Random();
  477. int selector;
  478. for (int counter =1; counter <=1; counter++) {
  479. selector = 1 + rand.nextInt(5); // Returning 1-5
  480. if (selector == 1) {
  481. player.setHealth(0);
  482. }
  483. }
  484. }
  485. }
  486. plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
  487. plugin.saveConfig();
  488. pi.remove(item);
  489. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  490.  
  491.  
  492. @Override
  493. public void run() {
  494. player.sendMessage("Test...");
  495. int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  496. // Checking to see if the player has the Tolerance permission ...
  497. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  498. if (count >= 7) {
  499. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  500. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY+ "You can cure the effects by either using more or becoming clean.");
  501. player.addPotionEffect(withdraw1);
  502. player.addPotionEffect(withdraw2);
  503. player.addPotionEffect(withdraw3);
  504.  
  505. }
  506. else {
  507. return;
  508. }
  509. }
  510. else {
  511. if (count >=5) {
  512. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  513. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You can cure the effects by either using more or becoming clean.");
  514. player.addPotionEffect(withdraw1);
  515. player.addPotionEffect(withdraw2);
  516. player.addPotionEffect(withdraw3);
  517.  
  518. }
  519. else {
  520. return;
  521. }
  522. }
  523.  
  524. }
  525.  
  526. }, 12000L);
  527. }
  528. else if (lore.contains(Weed)) {
  529. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  530. if (drugCount >= 7) {
  531. Random rand = new Random();
  532. int selector;
  533. for (int counter =1; counter <=1; counter++) {
  534. selector = 1 + rand.nextInt(5); // Returning 1-5
  535. if (selector == 1) {
  536. player.setHealth(0);
  537. }
  538. }
  539. }
  540. }
  541. else {
  542. if (drugCount >= 5) {
  543. Random rand = new Random();
  544. int selector;
  545. for (int counter =1; counter <=1; counter++) {
  546. selector = 1 + rand.nextInt(5); // Returning 1-5
  547. if (selector == 1) {
  548. player.setHealth(0);
  549. }
  550. }
  551. }
  552. }
  553. plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
  554. plugin.saveConfig();
  555. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 6000, 0));
  556. player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 3000, 0));
  557. pi.remove(item);
  558. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  559.  
  560.  
  561. @Override
  562. public void run() {
  563. player.sendMessage("Test...");
  564. int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  565. // Checking to see if the player has the Tolerance permission ...
  566. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  567. if (count >= 7) {
  568. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  569. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY+ "You can cure the effects by either using more or becoming clean.");
  570. player.addPotionEffect(withdraw1);
  571. player.addPotionEffect(withdraw2);
  572. player.addPotionEffect(withdraw3);
  573.  
  574. }
  575. else {
  576. return;
  577. }
  578. }
  579. else {
  580. if (count >=5) {
  581. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  582. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You can cure the effects by either using more or becoming clean.");
  583. player.addPotionEffect(withdraw1);
  584. player.addPotionEffect(withdraw2);
  585. player.addPotionEffect(withdraw3);
  586.  
  587. }
  588. else {
  589. return;
  590. }
  591. }
  592.  
  593. }
  594.  
  595. }, 6000L);
  596.  
  597. scheduler.scheduleSyncRepeatingTask(this.plugin, new Runnable() {
  598. int counter = 0;
  599. @Override
  600. public void run() {
  601. if (counter <= 10) {
  602. Location pl = player.getLocation();
  603. player.getWorld().playEffect(pl, Effect.SMOKE, 1);
  604. player.getWorld().playEffect(pl, Effect.SMOKE, 2);
  605. player.getWorld().playEffect(pl, Effect.SMOKE, 3);
  606. player.getWorld().playEffect(pl, Effect.SMOKE, 4);
  607. player.getWorld().playEffect(pl, Effect.SMOKE, 5);
  608. player.getWorld().playEffect(pl, Effect.SMOKE, 6);
  609. player.getWorld().playEffect(pl, Effect.SMOKE, 7);
  610. player.getWorld().playEffect(pl, Effect.SMOKE, 8);
  611. counter = counter +1;
  612. }
  613. else {
  614. scheduler.cancelTask(0);
  615. }
  616.  
  617. }
  618.  
  619. }, 20L, 20L);
  620.  
  621.  
  622. }
  623. else if (lore.contains(Alcohol)) {
  624. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  625. if (drugCount >= 7) {
  626. Random rand = new Random();
  627. int selector;
  628. for (int counter =1; counter <=1; counter++) {
  629. selector = 1 + rand.nextInt(5); // Returning 1-5
  630. if (selector == 1) {
  631. player.setHealth(0);
  632. }
  633. }
  634. }
  635. }
  636. else {
  637. if (drugCount >= 5) {
  638. Random rand = new Random();
  639. int selector;
  640. for (int counter =1; counter <=1; counter++) {
  641. selector = 1 + rand.nextInt(5); // Returning 1-5
  642. if (selector == 1) {
  643. player.setHealth(0);
  644. }
  645. }
  646. }
  647. }
  648. plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
  649. plugin.saveConfig();
  650. pi.remove(item);
  651. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  652.  
  653.  
  654. @Override
  655. public void run() {
  656. player.sendMessage("Test...");
  657. int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  658. // Checking to see if the player has the Tolerance permission ...
  659. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  660. if (count >= 7) {
  661. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  662. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY+ "You can cure the effects by either using more or becoming clean.");
  663. player.addPotionEffect(withdraw1);
  664. player.addPotionEffect(withdraw2);
  665. player.addPotionEffect(withdraw3);
  666.  
  667. }
  668. else {
  669. return;
  670. }
  671. }
  672. else {
  673. if (count >=5) {
  674. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  675. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You can cure the effects by either using more or becoming clean.");
  676. player.addPotionEffect(withdraw1);
  677. player.addPotionEffect(withdraw2);
  678. player.addPotionEffect(withdraw3);
  679.  
  680. }
  681. else {
  682. return;
  683. }
  684. }
  685.  
  686. }
  687.  
  688. }, 6000L);
  689. }
  690. else if (lore.contains(GHB)) {
  691. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  692. if (drugCount >= 7) {
  693. Random rand = new Random();
  694. int selector;
  695. for (int counter =1; counter <=1; counter++) {
  696. selector = 1 + rand.nextInt(5); // Returning 1-5
  697. if (selector == 1) {
  698. player.setHealth(0);
  699. }
  700. }
  701. }
  702. }
  703. else {
  704. if (drugCount >= 5) {
  705. Random rand = new Random();
  706. int selector;
  707. for (int counter =1; counter <=1; counter++) {
  708. selector = 1 + rand.nextInt(5); // Returning 1-5
  709. if (selector == 1) {
  710. player.setHealth(0);
  711. }
  712. }
  713. }
  714. }
  715. plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
  716. plugin.saveConfig();
  717. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 12000, 0));
  718. player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 12000, 0));
  719. pi.remove(item);
  720. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  721.  
  722.  
  723. @Override
  724. public void run() {
  725. player.sendMessage("Test...");
  726. int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  727. // Checking to see if the player has the Tolerance permission ...
  728. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  729. if (count >= 7) {
  730. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  731. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY+ "You can cure the effects by either using more or becoming clean.");
  732. player.addPotionEffect(withdraw1);
  733. player.addPotionEffect(withdraw2);
  734. player.addPotionEffect(withdraw3);
  735.  
  736. }
  737. else {
  738. return;
  739. }
  740. }
  741. else {
  742. if (count >=5) {
  743. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  744. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You can cure the effects by either using more or becoming clean.");
  745. player.addPotionEffect(withdraw1);
  746. player.addPotionEffect(withdraw2);
  747. player.addPotionEffect(withdraw3);
  748.  
  749. }
  750. else {
  751. return;
  752. }
  753. }
  754.  
  755. }
  756.  
  757. }, 12000L);
  758. }
  759. else if (lore.contains(INBOMe)) {
  760. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  761. if (drugCount >= 7) {
  762. Random rand = new Random();
  763. int selector;
  764. for (int counter =1; counter <=1; counter++) {
  765. selector = 1 + rand.nextInt(5); // Returning 1-5
  766. if (selector == 1) {
  767. player.setHealth(0);
  768. }
  769. }
  770. }
  771. }
  772. else {
  773. if (drugCount >= 5) {
  774. Random rand = new Random();
  775. int selector;
  776. for (int counter =1; counter <=1; counter++) {
  777. selector = 1 + rand.nextInt(5); // Returning 1-5
  778. if (selector == 1) {
  779. player.setHealth(0);
  780. }
  781. }
  782. }
  783. }
  784. plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
  785. plugin.saveConfig();
  786. Random number = new Random();
  787. int selector;
  788.  
  789. for (int counter =1; counter <=1; counter++) {
  790. selector = 1 + number.nextInt(2); // returning either 1 or 2
  791. if (selector == 1) {
  792. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 4800, 0));
  793. player.sendMessage(ChatColor.ITALIC + "Whoa everything feels slow ...");
  794. }
  795. else if (selector == 2) {
  796. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4800, 0));
  797. player.sendMessage(ChatColor.ITALIC + "Whoa I feel like I could just run forever ...");
  798. }
  799. }
  800. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  801.  
  802. @Override
  803. public void run() {
  804. Random number = new Random();
  805. int selector;
  806.  
  807. for (int counter =1; counter <=1; counter++) {
  808. selector = 1 + number.nextInt(2); // returning either 1 or 2
  809. if (selector == 1) {
  810. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 4800, 0));
  811. player.sendMessage(ChatColor.ITALIC + "Whoa everything feels slow ...");
  812. }
  813. else if (selector == 2) {
  814. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4800, 0));
  815. player.sendMessage(ChatColor.ITALIC + "Whoa I feel like I could just run forever ...");
  816. }
  817. }
  818.  
  819. }
  820.  
  821. }, 4800L);
  822. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  823.  
  824. @Override
  825. public void run() {
  826. Random number = new Random();
  827. int selector;
  828.  
  829. for (int counter =1; counter <=1; counter++) {
  830. selector = 1 + number.nextInt(2); // returning either 1 or 2
  831. if (selector == 1) {
  832. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 4800, 0));
  833. player.sendMessage(ChatColor.ITALIC + "Whoa everything feels slow ...");
  834. }
  835. else if (selector == 2) {
  836. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4800, 0));
  837. player.sendMessage(ChatColor.ITALIC + "Whoa I feel like I could just run forever ...");
  838. }
  839. }
  840.  
  841. }
  842.  
  843. }, 9600L);
  844. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  845.  
  846. @Override
  847. public void run() {
  848. Random number = new Random();
  849. int selector;
  850.  
  851. for (int counter =1; counter <=1; counter++) {
  852. selector = 1 + number.nextInt(2); // returning either 1 or 2
  853. if (selector == 1) {
  854. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 4800, 0));
  855. player.sendMessage(ChatColor.ITALIC + "Whoa everything feels slow ...");
  856. }
  857. else if (selector == 2) {
  858. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4800, 0));
  859. player.sendMessage(ChatColor.ITALIC + "Whoa I feel like I could just run forever ...");
  860. }
  861. }
  862.  
  863. }
  864.  
  865. }, 14400L);
  866. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  867.  
  868. @Override
  869. public void run() {
  870. Random number = new Random();
  871. int selector;
  872.  
  873. for (int counter =1; counter <=1; counter++) {
  874. selector = 1 + number.nextInt(2); // returning either 1 or 2
  875. if (selector == 1) {
  876. player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 4800, 0));
  877. player.sendMessage(ChatColor.ITALIC + "Whoa everything feels slow ...");
  878. }
  879. else if (selector == 2) {
  880. player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4800, 0));
  881. player.sendMessage(ChatColor.ITALIC + "Whoa I feel like I could just run forever ...");
  882. }
  883. }
  884.  
  885. }
  886.  
  887. }, 19200L);
  888. pi.remove(item);
  889. scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
  890.  
  891.  
  892. @Override
  893. public void run() {
  894. player.sendMessage("Test...");
  895. int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
  896. // Checking to see if the player has the Tolerance permission ...
  897. if (player.hasPermission("MineRP.Drugs.Tolerance")) {
  898. if (count >= 7) {
  899. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  900. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY+ "You can cure the effects by either using more or becoming clean.");
  901. player.addPotionEffect(withdraw1);
  902. player.addPotionEffect(withdraw2);
  903. player.addPotionEffect(withdraw3);
  904.  
  905. }
  906. else {
  907. return;
  908. }
  909. }
  910. else {
  911. if (count >=5) {
  912. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
  913. player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You can cure the effects by either using more or becoming clean.");
  914. player.addPotionEffect(withdraw1);
  915. player.addPotionEffect(withdraw2);
  916. player.addPotionEffect(withdraw3);
  917.  
  918. }
  919. else {
  920. return;
  921. }
  922. }
  923.  
  924. }
  925.  
  926. }, 24000L);
  927. }
  928. else {
  929. return false;
  930. }
  931. }
  932. catch (Exception e) {
  933. e.printStackTrace();
  934. }
  935.  
  936. return false;
  937. }
  938.  
  939. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement