Want to hook into DrugMeUp? Here's how:

DrugMeUp uses static method API calls to access certain parts that may be useful in custom plugins.

The two main classes accessible with DrugMeUp are:

  • DrugHandler
    • getDrug(ItemStack) - return a Drug object via an ItemStack reference
    • getDrug(Material, short) - return a Drug object via Material and Durability reference
    • getDrug(String) - return a Drug object via name reference (NOTE: Colors need to be included, if any)
    • getDrugs() - return a list of all Drug objects
    • isDrug(ItemStack) - Check if the ItemStack is a Drug type
    • isDrug(Material, short) - Check if the Material and durability combination is a drug type
    • gatherDrugs() - Gather all drugs from config to #getDrugs() (returns the amount gathered)
    • clearDrugs() - Clear the list of drugs (#getDrugs())
  • PlayerHandler
    • getDrunk() - return a list of player's names that are currently drunk (scrambled text)
    • getOnDrugs() - return a HashMap<String, Integer> of everyone on drugs. (<Players Names, Time until drug runs out>)
    • getIsJump() - return a list of player's names that are currently high jumping
    • getNoPlace() - return a list of player's names that are currently not allowed to place blocks (block drugs)

An example call would look like this:

public class MyClass implements Listener {
  public void onItemPickup(PlayerPickupItemEvent event) {
    ItemStack itemStack = event.getItem().getItemStack();
    Player player = event.getPlayer();
    if (DrugMeUp.getDrugHandler().isDrug(itemStack)) {
      Drug drug = DrugMeUp.getDrugHandler().getDrug(itemStack);
      ItemMeta meta = itemStack.getItemMeta();


The code above would rename a picked up item into the name of the drug type that was picked up

Custom Events

I have 3 custom events in DrugMeUp -

  • DrugTakenEvent - This event is fired after the player takes the drug, allowing for drug effect information to be given.
  • PreDrugTakenEvent - This event is fired before the player takes a drug, allowing it to be cancelled, or change the drug type
  • DMUConfigReloadEvent - This event is fired when the drug me up config is reloaded (allowing for a re-gathering of drugs)

These events can be listened for by your plugin in the same way you would normally listen for events.

Here's an example:

public class MyClass implements Listener {
  public void onPreDrugTaken(PreDrugTakenEvent event) {
    Drug drug = event.getDrug();
    Player player = event.getPlayer();
    if (drug.getItemStack().getType() == Material.RED_MUSHROOM) {
      if (!player.hasPermission("AllowedDrugs.RedMushroom")) {


The above code would only allow the use of a red mushroom with the permission "AllowedDrugs.RedMushroom"


Posts Quoted:
Clear All Quotes