Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.InfiniumDevelopments.DarkRP;
- import java.util.List;
- import java.util.Random;
- import net.minecraft.server.v1_6_R3.Block;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Effect;
- import org.bukkit.Location;
- import org.bukkit.block.Sign;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.BlockPlaceEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.PlayerInventory;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- import org.bukkit.scheduler.BukkitScheduler;
- public class DrugHandler implements Listener {
- public DarkRPMain plugin;
- public PotionEffect withdraw1 = new PotionEffect(PotionEffectType.SLOW, 72000, 1);
- public PotionEffect withdraw2 = new PotionEffect(PotionEffectType.SLOW_DIGGING, 72000, 1);
- public PotionEffect withdraw3 = new PotionEffect(PotionEffectType.CONFUSION, 72000, 0);
- public DrugHandler(DarkRPMain instance) {
- plugin = instance;
- }
- @EventHandler
- public boolean onBlockPlace(final BlockPlaceEvent event) {
- final Player player = (Player) event.getPlayer();
- BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
- ItemStack i = event.getItemInHand();
- ItemMeta im = i.getItemMeta();
- // Strings for the lores of special items ..
- String dl = "Generic Drug";
- if (event.getBlockPlaced() == Block.STONE) {
- player.sendMessage("Testing.");
- if (im.getLore().contains(dl)) {
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- Sign sign = (Sign) event.getBlockPlaced();
- sign.setLine(0, "[Drug Lab]");
- sign.setLine(1, player.getName());
- sign.setLine(2, "price");
- sign.setLine(3, "Generic Drug");
- player.sendMessage("You successfully created a drug lab!");
- }
- }, 1L);
- }
- }
- return false;
- }
- @SuppressWarnings("deprecation")
- @EventHandler
- public boolean onItemClick(PlayerInteractEvent event) {
- final BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
- final Player player = event.getPlayer();
- PlayerInventory pi = player.getInventory();
- ItemStack item = event.getItem();
- ItemMeta im = item.getItemMeta();
- List<String> lore = im.getLore();
- // Strings for the Lore of each drug
- String BathSalts = "Bath Salts";
- String CrystalMeth = "Crystal Meth";
- String Ketamine = "Ketamine";
- String Cocaine = "Cocaine";
- String Heroin = "Heroin";
- String LSD = "LSD";
- String Weed = "Weed";
- String Alcohol = "Alcohol";
- String GHB = "GHB";
- String INBOMe = "25I-NBOMe";
- try {
- int drugCount = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- if (lore.contains(BathSalts)) {
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (drugCount >= 7) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- else {
- if (drugCount >= 5) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
- plugin.saveConfig();
- pi.remove(item);
- player.sendMessage("Your count is " + drugCount);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.sendMessage("Test...");
- int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- // Checking to see if the player has the Tolerance permission ...
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (count >= 7) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- else {
- if (count >=5) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- }
- }, 12000L);
- }
- else if (lore.contains(CrystalMeth)) {
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (drugCount >= 7) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- else {
- if (drugCount >= 5) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
- plugin.saveConfig();
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 6000, 1));
- player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 6000, 0));
- pi.remove(item);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.sendMessage("Test...");
- int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- // Checking to see if the player has the Tolerance permission ...
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (count >= 7) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- else {
- if (count >=5) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- }
- }, 6000L);
- }
- else if (lore.contains(Ketamine)) {
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (drugCount >= 7) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- else {
- if (drugCount >= 5) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
- plugin.saveConfig();
- player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 3600, 0));
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 3600, 0));
- pi.remove(item);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.sendMessage("Test...");
- int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- // Checking to see if the player has the Tolerance permission ...
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (count >= 7) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- else {
- if (count >=5) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- }
- }, 3600L);
- }
- else if (lore.contains(Cocaine)) {
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (drugCount >= 7) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- else {
- if (drugCount >= 5) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
- plugin.saveConfig();
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 12000, 0));
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 6000, 0));
- player.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 6000, 0));
- player.sendMessage(ChatColor.ITALIC + "I'm not feeling so well anymore ...");
- }
- }, 12000L);
- pi.remove(item);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.sendMessage("Test...");
- int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- // Checking to see if the player has the Tolerance permission ...
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (count >= 7) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- else {
- if (count >=5) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- }
- }, 18000L);
- }
- else if (lore.contains(Heroin)) {
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (drugCount >= 7) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- else {
- if (drugCount >= 5) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
- plugin.saveConfig();
- player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 10800, 1));
- player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 3600, 0));
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 7200, 0));
- }
- }, 10800L);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 3600, 0));
- }
- }, 14400L);
- pi.remove(item);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.sendMessage("Test...");
- int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- // Checking to see if the player has the Tolerance permission ...
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (count >= 7) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- else {
- if (count >=5) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- }
- }, 18000L);
- }
- else if (lore.contains(LSD)) {
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (drugCount >= 7) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- else {
- if (drugCount >= 5) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
- plugin.saveConfig();
- pi.remove(item);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.sendMessage("Test...");
- int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- // Checking to see if the player has the Tolerance permission ...
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (count >= 7) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- else {
- if (count >=5) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- }
- }, 12000L);
- }
- else if (lore.contains(Weed)) {
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (drugCount >= 7) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- else {
- if (drugCount >= 5) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
- plugin.saveConfig();
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 6000, 0));
- player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 3000, 0));
- pi.remove(item);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.sendMessage("Test...");
- int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- // Checking to see if the player has the Tolerance permission ...
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (count >= 7) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- else {
- if (count >=5) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- }
- }, 6000L);
- scheduler.scheduleSyncRepeatingTask(this.plugin, new Runnable() {
- int counter = 0;
- @Override
- public void run() {
- if (counter <= 10) {
- Location pl = player.getLocation();
- player.getWorld().playEffect(pl, Effect.SMOKE, 1);
- player.getWorld().playEffect(pl, Effect.SMOKE, 2);
- player.getWorld().playEffect(pl, Effect.SMOKE, 3);
- player.getWorld().playEffect(pl, Effect.SMOKE, 4);
- player.getWorld().playEffect(pl, Effect.SMOKE, 5);
- player.getWorld().playEffect(pl, Effect.SMOKE, 6);
- player.getWorld().playEffect(pl, Effect.SMOKE, 7);
- player.getWorld().playEffect(pl, Effect.SMOKE, 8);
- counter = counter +1;
- }
- else {
- scheduler.cancelTask(0);
- }
- }
- }, 20L, 20L);
- }
- else if (lore.contains(Alcohol)) {
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (drugCount >= 7) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- else {
- if (drugCount >= 5) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
- plugin.saveConfig();
- pi.remove(item);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.sendMessage("Test...");
- int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- // Checking to see if the player has the Tolerance permission ...
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (count >= 7) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- else {
- if (count >=5) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- }
- }, 6000L);
- }
- else if (lore.contains(GHB)) {
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (drugCount >= 7) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- else {
- if (drugCount >= 5) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
- plugin.saveConfig();
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 12000, 0));
- player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 12000, 0));
- pi.remove(item);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.sendMessage("Test...");
- int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- // Checking to see if the player has the Tolerance permission ...
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (count >= 7) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- else {
- if (count >=5) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- }
- }, 12000L);
- }
- else if (lore.contains(INBOMe)) {
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (drugCount >= 7) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- else {
- if (drugCount >= 5) {
- Random rand = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + rand.nextInt(5); // Returning 1-5
- if (selector == 1) {
- player.setHealth(0);
- }
- }
- }
- }
- plugin.getConfig().set("Players." + player.getName() + ".DrugCount", drugCount+1);
- plugin.saveConfig();
- Random number = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + number.nextInt(2); // returning either 1 or 2
- if (selector == 1) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 4800, 0));
- player.sendMessage(ChatColor.ITALIC + "Whoa everything feels slow ...");
- }
- else if (selector == 2) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4800, 0));
- player.sendMessage(ChatColor.ITALIC + "Whoa I feel like I could just run forever ...");
- }
- }
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- Random number = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + number.nextInt(2); // returning either 1 or 2
- if (selector == 1) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 4800, 0));
- player.sendMessage(ChatColor.ITALIC + "Whoa everything feels slow ...");
- }
- else if (selector == 2) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4800, 0));
- player.sendMessage(ChatColor.ITALIC + "Whoa I feel like I could just run forever ...");
- }
- }
- }
- }, 4800L);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- Random number = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + number.nextInt(2); // returning either 1 or 2
- if (selector == 1) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 4800, 0));
- player.sendMessage(ChatColor.ITALIC + "Whoa everything feels slow ...");
- }
- else if (selector == 2) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4800, 0));
- player.sendMessage(ChatColor.ITALIC + "Whoa I feel like I could just run forever ...");
- }
- }
- }
- }, 9600L);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- Random number = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + number.nextInt(2); // returning either 1 or 2
- if (selector == 1) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 4800, 0));
- player.sendMessage(ChatColor.ITALIC + "Whoa everything feels slow ...");
- }
- else if (selector == 2) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4800, 0));
- player.sendMessage(ChatColor.ITALIC + "Whoa I feel like I could just run forever ...");
- }
- }
- }
- }, 14400L);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- Random number = new Random();
- int selector;
- for (int counter =1; counter <=1; counter++) {
- selector = 1 + number.nextInt(2); // returning either 1 or 2
- if (selector == 1) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 4800, 0));
- player.sendMessage(ChatColor.ITALIC + "Whoa everything feels slow ...");
- }
- else if (selector == 2) {
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 4800, 0));
- player.sendMessage(ChatColor.ITALIC + "Whoa I feel like I could just run forever ...");
- }
- }
- }
- }, 19200L);
- pi.remove(item);
- scheduler.scheduleSyncDelayedTask(this.plugin, new Runnable() {
- @Override
- public void run() {
- player.sendMessage("Test...");
- int count = plugin.getConfig().getInt("Players." + player.getName() + ".DrugCount");
- // Checking to see if the player has the Tolerance permission ...
- if (player.hasPermission("MineRP.Drugs.Tolerance")) {
- if (count >= 7) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- else {
- if (count >=5) {
- player.sendMessage(ChatColor.DARK_GRAY + "[" + ChatColor.BLUE + "MineRP" + ChatColor.DARK_GRAY + "]" + ChatColor.GRAY + "You are now going through withdraw from your addiction.");
- 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.");
- player.addPotionEffect(withdraw1);
- player.addPotionEffect(withdraw2);
- player.addPotionEffect(withdraw3);
- }
- else {
- return;
- }
- }
- }
- }, 24000L);
- }
- else {
- return false;
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement