Skip to content

Commit

Permalink
2.7-dev+build145
Browse files Browse the repository at this point in the history
Added new drug
Moving everything around and getting ready to add custom effects
  • Loading branch information
xxCoderforlife committed Sep 30, 2021
1 parent 0f32d5c commit cbca33e
Show file tree
Hide file tree
Showing 12 changed files with 716 additions and 336 deletions.
26 changes: 21 additions & 5 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
name: SimpleDrugs-dev-build133
version: 2.7+dev-build133
name: SimpleDrugs-dev-build145
version: 2.7+dev-build145
author: xxCoderforlife
prefix: SD
api-version: 1.17
load: POSTWORLD
api-version: 1.13
website: https://www.spigotmc.org/resources/simple-drugs.9684/
main: me.Coderforlife.Drugs.Main

#COMMANDS
commands:
drugs:
description: For Drugs yo
usage: /<command> [args]
permission: drugs.main
description: Root Command For Simple-Drugs.
usage: /[d|drugs] [soberup|help]
aliases: [d]
soberup:
permission: drugs.soberup
description: Used to remove potion effects.
usage: /[d|drugs] soberup
help:
permission: drugs.help
description: Main Help Menu for Simple-Drugs
usage: /[d|drugs] help
#PERMISSIONS
permissions:
drugs.main:
description: Used for '/drugs' comamnd.
Expand Down Expand Up @@ -37,4 +50,7 @@ permissions:
default: true
drugs.use.molly:
description: To use Molly
default: true
drugs.use.ciggy:
description: To Use Ciggy
default: true
78 changes: 78 additions & 0 deletions src/me/Coderforlife/Drugs/Acid.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package me.Coderforlife.Drugs;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;

public class Acid implements Listener{

public static String prefix = ChatColor.GRAY +
""
+ ChatColor.BOLD + "[" + ChatColor.DARK_RED + "" +
ChatColor.BOLD + "SD" +
ChatColor.GRAY + "" +
ChatColor.BOLD + "] " + ChatColor.RESET;

public static String stack = ChatColor.RED + "" + ChatColor.BOLD + "Do Not Use It In A Stack.";

private Main plugin;

public Acid(Main plugin) {
this.setPlugin(plugin);
}

public Main getPlugin() {
return this.plugin;
}

public void setPlugin(Main plugin) {
this.plugin = plugin;
}

@EventHandler
public void RightClickEvent(PlayerInteractEvent ev) {
Player p = ev.getPlayer();
Action pa = ev.getAction();

if(pa.equals(Action.RIGHT_CLICK_AIR) || pa.equals(Action.RIGHT_CLICK_BLOCK)) {
if(p.getInventory().getItemInMainHand().hasItemMeta()) {
if(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.AQUA + "" +
ChatColor.BOLD + "ACID")) {
if(p.hasPermission("drugs.use.acid")) {
try {
ItemStack hand = p.getInventory().getItemInMainHand();
int amount = hand.getAmount();
if(amount > 1) {
p.sendMessage(prefix + stack);
}else {
p.getInventory().getItemInMainHand().setAmount(0);
p.addPotionEffect(PotionEffectType.CONFUSION.createEffect(200, 1));
p.addPotionEffect(PotionEffectType.GLOWING.createEffect(20*60*5, 3));
p.addPotionEffect(PotionEffectType.HEALTH_BOOST.createEffect(20*60*2, 2));
p.addPotionEffect(PotionEffectType.SLOW_FALLING.createEffect(20*60*5, 2));
p.playSound(p.getLocation(), Sound.ITEM_HONEY_BOTTLE_DRINK, 10, 29);
if(p.getInventory().getItemInMainHand().getItemMeta() == null) {return;}
if(p.getInventory().getItemInMainHand().getType() == null) {return;}
if(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName() == null) {return;}
}
}catch(Exception e1) {
p.sendMessage(prefix + ChatColor.DARK_RED + "Error in the Console");
Bukkit.getLogger().severe(prefix + ChatColor.GREEN + "Send this Error to xxCoderforlife on https://Spigotmc.org");
e1.printStackTrace();
}
}else {
p.sendMessage(prefix + ChatColor.DARK_RED + "You can't use " + ChatColor.AQUA
+ "" + ChatColor.BOLD + "ACID");
}
}
}
}
}
}
74 changes: 74 additions & 0 deletions src/me/Coderforlife/Drugs/Ciggy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package me.Coderforlife.Drugs;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffectType;

public class Ciggy implements Listener{


public static String prefix = ChatColor.GRAY +
""
+ ChatColor.BOLD + "[" + ChatColor.DARK_RED + "" +
ChatColor.BOLD + "SD" +
ChatColor.GRAY + "" +
ChatColor.BOLD + "] " + ChatColor.RESET;

public static String stack = ChatColor.RED + "" + ChatColor.BOLD + "Do Not Use It In A Stack.";

private Main plugin;

public Ciggy(Main plugin) {
this.setPlugin(plugin);
}

public Main getPlugin() {
return this.plugin;
}

public void setPlugin(Main plugin) {
this.plugin = plugin;
}


@EventHandler
public void RightClickEvent(PlayerInteractEvent ev) {
Player p = ev.getPlayer();
Action pa = ev.getAction();
if(pa.equals(Action.RIGHT_CLICK_AIR) || pa.equals(Action.RIGHT_CLICK_BLOCK)) {
if(p.getInventory().getItemInMainHand().hasItemMeta()) {
if(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.GOLD +""
+ ChatColor.BOLD + "CIGGY")) {
if(p.hasPermission("drugs.use.ciggy")) {
try {
if(p.getInventory().getItemInMainHand().getAmount() > 1) {
p.sendMessage(prefix + stack);
}else {
p.addPotionEffect(PotionEffectType.SLOW_DIGGING.createEffect(20*60*1, 1));
p.addPotionEffect(PotionEffectType.JUMP.createEffect(20*60*3, 1));
p.addPotionEffect(PotionEffectType.SATURATION.createEffect(20*60*2, 1));
p.addPotionEffect(PotionEffectType.DAMAGE_RESISTANCE.createEffect(20*60*2, 1));
p.addPotionEffect(PotionEffectType.INVISIBILITY.createEffect(300, 1));
p.getInventory().getItemInMainHand().getAmount();
p.getInventory().getItemInMainHand().setAmount(0);

}
}catch(Exception e1) {
p.sendMessage(prefix + ChatColor.DARK_RED + "Error in the Console");
Bukkit.getLogger().severe(prefix + "Send this Error to xxCoderforlife on https://Spigotmc.org");
e1.printStackTrace();
}
}else {
p.sendMessage(prefix + ChatColor.DARK_RED + "You can't use" + ChatColor.GOLD
+ "" + ChatColor.BOLD + " CIGGY");
}
}
}
}
}
}
75 changes: 75 additions & 0 deletions src/me/Coderforlife/Drugs/Coke.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package me.Coderforlife.Drugs;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffectType;

public class Coke implements Listener{

public static String prefix = ChatColor.GRAY +
""
+ ChatColor.BOLD + "[" + ChatColor.DARK_RED + "" +
ChatColor.BOLD + "SD" +
ChatColor.GRAY + "" +
ChatColor.BOLD + "] " + ChatColor.RESET;

public static String stack = ChatColor.RED + "" + ChatColor.BOLD + "Do Not Use It In A Stack.";

private Main plugin;

public Coke(Main plugin) {
this.setPlugin(plugin);
}

public Main getPlugin() {
return this.plugin;
}

public void setPlugin(Main plugin) {
this.plugin = plugin;
}

@EventHandler
public void RightClickEvent(PlayerInteractEvent ev) {
Player p = ev.getPlayer();
Action pa = ev.getAction();
if(pa.equals(Action.RIGHT_CLICK_AIR) || pa.equals(Action.RIGHT_CLICK_BLOCK)) {
if(p.getInventory().getItemInMainHand().hasItemMeta()) {
if(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName().equals(ChatColor.AQUA +""
+ ChatColor.BOLD + "COKE")) {
if(p.hasPermission("drugs.use.coke")) {
try {
if(p.getInventory().getItemInMainHand().getAmount() > 1) {
p.sendMessage(prefix + stack);
}else {
p.addPotionEffect(PotionEffectType.SPEED.createEffect(20*60*1, 1));
p.addPotionEffect(PotionEffectType.FAST_DIGGING.createEffect(20*60*1, 1));
p.addPotionEffect(PotionEffectType.GLOWING.createEffect(20*60*2, 1));
p.addPotionEffect(PotionEffectType.INCREASE_DAMAGE.createEffect(20*60*2, 2));
p.addPotionEffect(PotionEffectType.DAMAGE_RESISTANCE.createEffect(20*60*2, 2));
p.addPotionEffect(PotionEffectType.HEALTH_BOOST.createEffect(20*60*2, 1));
p.getInventory().getItemInMainHand().getAmount();
p.getInventory().getItemInMainHand().setAmount(0);
if(p.getInventory().getItemInMainHand().getItemMeta() == null) {return;}
if(p.getInventory().getItemInMainHand().getType() == null) {return;}
if(p.getInventory().getItemInMainHand().getItemMeta().getDisplayName() == null) {return;}
}
}catch(Exception e1) {
p.sendMessage(prefix + ChatColor.DARK_RED + "Error in the Console");
Bukkit.getLogger().severe(prefix + "Send this Error to xxCoderforlife on https://Spigotmc.org");
e1.printStackTrace();
}
}else {
p.sendMessage(prefix + ChatColor.DARK_RED + "You can't use" + ChatColor.AQUA
+ "" + ChatColor.BOLD + " COKE");
}
}
}
}
}
}
47 changes: 39 additions & 8 deletions src/me/Coderforlife/Drugs/Drugs.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;


public class Drugs {

public ItemStack weed1 = new ItemStack(Material.WHEAT);
Expand Down Expand Up @@ -45,8 +46,7 @@ public void WeedRecipe() {
ItemMeta weedMeta = weed1.getItemMeta();
weedMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
weedMeta.addItemFlags(new ItemFlag[] {ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES});
weedMeta.setDisplayName(ChatColor.DARK_GREEN + ""
+ ChatColor.BOLD + "WEED");
weedMeta.setDisplayName(ChatColor.DARK_GREEN + "" + ChatColor.BOLD + "WEED");
ArrayList<String> weedLore = new ArrayList<String>();
weedLore.add(ChatColor.GRAY + "" +
ChatColor.ITALIC + "Right-Click to get " +
Expand All @@ -63,7 +63,7 @@ public void WeedRecipe() {
"" +ChatColor.BOLD + "Duration: "
+ ChatColor.GOLD + "45 Seconds");
weedLore.add(ChatColor.GRAY + "" +
ChatColor.UNDERLINE + "More Effects coming soon.");
ChatColor.UNDERLINE + "Custom Effects Coming Soon.");
weedMeta.setLore(weedLore);
weed1.setItemMeta(weedMeta);
ShapedRecipe weed = new ShapedRecipe(
Expand Down Expand Up @@ -96,7 +96,7 @@ public void PercocetRecipe() {
percocetLore.add(ChatColor.GRAY + "- " + ChatColor.GOLD + "NIGHT VISION");
percocetLore.add(ChatColor.GRAY + "- " + ChatColor.DARK_PURPLE + ChatColor.BOLD + "THIS HITS DIFFERENT");
percocetLore.add(ChatColor.GRAY + "" +
ChatColor.UNDERLINE + "More Effects coming soon.");
ChatColor.UNDERLINE + "Custom Effects Coming Soon.");

percocetMeta.setLore(percocetLore);
percocet.setItemMeta(percocetMeta);
Expand Down Expand Up @@ -127,7 +127,7 @@ public void AcidRecipe() {
acidLore.add(ChatColor.GRAY + "- " + ChatColor.GOLD + "SLOW FALLING");
acidLore.add(ChatColor.GRAY + "- " + ChatColor.DARK_PURPLE + ChatColor.BOLD + "THIS HITS DIFFERENT");
acidLore.add(ChatColor.GRAY + "" +
ChatColor.UNDERLINE + "More Effects coming soon.");
ChatColor.UNDERLINE + "Custom Effects Coming Soon.");

acidMeta.setLore(acidLore);
acid.setItemMeta(acidMeta);
Expand Down Expand Up @@ -162,7 +162,7 @@ public void CokeRecipe() {
+ ChatColor.BOLD + "Duration: " +
ChatColor.GOLD + "45 Seconds");
cokeLore.add(ChatColor.GRAY + "" +
ChatColor.UNDERLINE + "More Effects coming soon.");
ChatColor.UNDERLINE + "Custom Effects Coming Soon.");
cokeMeta.setLore(cokeLore);
coke.setItemMeta(cokeMeta);
ShapedRecipe coke1 = new ShapedRecipe(new NamespacedKey (this.plugin, "drugs_coke_sugar"), new ItemStack(coke));
Expand Down Expand Up @@ -192,7 +192,7 @@ public void HeroinRecipe() {
heroinLore.add(ChatColor.GRAY + "- " + ChatColor.GOLD + "POISON");
heroinLore.add(ChatColor.GRAY + "- " + ChatColor.GOLD + "BAD OMEN");
heroinLore.add(ChatColor.GRAY + "" +
ChatColor.UNDERLINE + "More Effects coming soon.");
ChatColor.UNDERLINE + "Custom Effects Coming Soon.");

heroinMeta.setLore(heroinLore);
heroin.setItemMeta(heroinMeta);
Expand Down Expand Up @@ -224,7 +224,7 @@ public void MollyRecipe() {
MollyLore.add(ChatColor.GRAY + "- " + ChatColor.GOLD + "FIRE RESISTANCE");
MollyLore.add(ChatColor.GRAY + "- " + ChatColor.GOLD + "NIGHT VISION");
MollyLore.add(ChatColor.GRAY + "" +
ChatColor.UNDERLINE + "More Effects coming soon.");
ChatColor.UNDERLINE + "Custom Effects Coming Soon.");

MollyMeta.setLore(MollyLore);
molly.setItemMeta(MollyMeta);
Expand All @@ -235,4 +235,35 @@ public void MollyRecipe() {
molly1.setIngredient('G', Material.GUNPOWDER);
Bukkit.addRecipe(molly1);
}

public void CiggyRecipe() {
ItemStack ciggy = new ItemStack(Material.REDSTONE_TORCH);
ItemMeta CiggyMeta = ciggy.getItemMeta();
CiggyMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
CiggyMeta.addItemFlags(new ItemFlag[] {ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES});
CiggyMeta.setDisplayName(ChatColor.GOLD + "" +
ChatColor.BOLD + "CIGGY");
ArrayList<String> CiggyLore = new ArrayList<String>();
CiggyLore.add(ChatColor.GRAY + "" +
ChatColor.ITALIC + "Right-Click to get " +
ChatColor.DARK_RED + "" +
ChatColor.BOLD + "LIT!!");
CiggyLore.add(ChatColor.GREEN + "" +
ChatColor.BOLD + "Effects:");
CiggyLore.add(ChatColor.GRAY + "- " + ChatColor.GOLD + "SATURATION");
CiggyLore.add(ChatColor.GRAY + "- " + ChatColor.GOLD + "DAMAGE RESISTANCE");
CiggyLore.add(ChatColor.GRAY + "- " + ChatColor.GOLD + "SLOW DIGGING");
CiggyLore.add(ChatColor.GRAY + "- " + ChatColor.GOLD + "INVISIBILITY");
CiggyLore.add(ChatColor.GRAY + "" +
ChatColor.UNDERLINE + "Custom Effects Coming Soon.");

CiggyMeta.setLore(CiggyLore);
ciggy.setItemMeta(CiggyMeta);
ShapedRecipe ciggy1 = new ShapedRecipe(new NamespacedKey(this.plugin, "drugs_ciggy/REDSTONETORCH"), new ItemStack(ciggy));
ciggy1.shape(" G ","PSP","PPP");
ciggy1.setIngredient('S', Material.STICK);
ciggy1.setIngredient('P', Material.PAPER);
ciggy1.setIngredient('G', Material.GUNPOWDER);
Bukkit.addRecipe(ciggy1);
}
}
Loading

0 comments on commit cbca33e

Please sign in to comment.