New Configuration

Drugs Configuration (As Of Update 2.0)

Drugs Base Configuration (As Of Update 2.0) [config.yml]

The base config now contains only two sections (the drugs section has changed to a separate file [Drugs.json] and its configuration is defined below) Options and Message


Section: Options

The following is the default configurations for the Options section:

Options:
  Prefix: '&0(&aDrugs&0)&f '
  Check_For_Updates: true
  Use_Custom_Perms: false
  Max_Particle_Effects: 10
OptionDescription
PrefixThis is what displays before all of the messages/usage messages used in the Drugs plugin
Check_For_UpdatesAllows for update checking on joining with the required permission
Use_Custom_PermsToggles the ability to use custom perms for each drug
Max_Particle_EffectsMax particles effects displayed by a player at any one time


Section: Message

The following is the default configurations for the Message section:

Message:
  Reload: 'Config Reloaded!'
  No_Perm: '&4You Do Not Have Permission!'
  Drug_Use: 'You Have Just Used {drug}'
OptionDescription
ReloadThe message displayed to whoever reloads the config
No_PermThe message displayed if the user doesn't have permission for something
Drug_UseThe default drug usage message {drug} is a place-holder for the drug's name



Drugs JSON Configuration (As Of Update 2.0) [Drugs.json]

A lot has changed, configuration wise, in the recent update. The switch from YAML for the drugs to JSON will allow for even greater customization. Below will show you just how to modify the [Drugs.json] file. For editing the file it is recommended that you use a text editing program that supports JSON syntax, for example, Notepad++ is a great and free to use program which can be found at: notepad-plus-plus.org


The Base Configuration:

Below is the bare-bones of the config and inside the square brackets is where all of the drugs are defined

{
  "Drugs": [
  ]
}


Our First Drug:

The Inside the Drugs list we put another opening and closing curly brackets. Each drug requires two main parameters which are the drug's name and the drug's material type. For this example we are going to Methamphetamine with the material type of SUGAR (note that both the key and the value are contained in speech marks and at the end of each key, if it's the last before a curly bracket it doesn't matter, it needs to have a comma)

{
  "Drugs": [
     {
        "Name": "Methamphetamine",
        "Material": "SUGAR"
     }
  ]
}

This drug doesn't do very much except for send you the default usage message on use with the name "Methamphetamine" subbed in (the default usage message is defined in the base config [config.yml]). However, we are able to modify the drug's usage message as done below:

{
  "Drugs": [
     {
        "Name": "Methamphetamine",
        "Material": "SUGAR",
        "UsageMessage": "You Have Just Smoked {drug}"
     }
  ]
}

You may be wondering what "{drug}" is there for, it is a place-holder which means that when the player receives the message with {drug} it will be replaced with the drug's name; in this case the user will receive the message as "You Have Just Smoked Methamphetamine". For this example we are going to leave our first drug as this.


Our Second Drug:

Now we are going to add a second drug, you can add as many as you like just follow the same syntax, with the name "Weed" and material type "INK_SACK" (don't forget the comma after the end curly bracket of our first drug)

{
  "Drugs": [
     {
        "Name": "Methamphetamine",
        "Material": "SUGAR",
        "UsageMessage": "You Have Just Smoked {drug}"
     },
     {
        "Name": "Weed",
        "Material": "INK_SACK"
     }
  ]
}

Because we obviously don't want weed as an inc sack, yet cactus green falls under the same material type, we are going to have to add cactus green's damage value, which is 2, as well (since the damage value is a number it doesn't require speech marks around it):

{
  "Drugs": [
     {
        "Name": "Methamphetamine",
        "Material": "SUGAR",
        "UsageMessage": "You Have Just Smoked {drug}"
     },
     {
        "Name": "Weed",
        "Material": "INK_SACK",
        "Damage": 2
     }
  ]
}

Our First Drug Effect:

Because each drug can contain multiple effects the effects have to be inside of square brackets:

{
  "Drugs": [
     {
        "Name": "Methamphetamine",
        "Material": "SUGAR",
        "UsageMessage": "You Have Just Smoked {drug}"
     },
     {
        "Name": "Weed",
        "Material": "INK_SACK",
        "Damage": 2,
        "Effects": [
        ]
     }
  ]
}

Because each effect contains multiple values (the EffectType, Duration and Strength) each effect needs to be contained in its own opening and closing curly bracket. For this example we are going to make weed give you slowness for 15 seconds with a strength of 2 (the default duration, shall you choose not to supply one, is 10 seconds and the default strength, shall you choose not to supply one, is 0):

{
  "Drugs": [
     {
        "Name": "Methamphetamine",
        "Material": "SUGAR",
        "UsageMessage": "You Have Just Smoked {drug}"
     },
     {
        "Name": "Weed",
        "Material": "INK_SACK",
        "Damage": 2,
        "Effects": [
           {
              "EffectType": "Slowness",
              "Duration": 15,
              "Strength": 2
           }
        ]
     }
  ]
}

Our Second Drug Effect:

Because we want to get all fancy, we are going to add a second effect to weed with the EffectType of SlowMining, Duration of 15 seconds as well and a Strength of one (don't forget the comma):

{
  "Drugs": [
     {
        "Name": "Methamphetamine",
        "Material": "SUGAR",
        "UsageMessage": "You Have Just Smoked {drug}"
     },
     {
        "Name": "Weed",
        "Material": "INK_SACK",
        "Damage": 2,
        "Effects": [
           {
              "EffectType": "Slowness",
              "Duration": 15,
              "Strength": 2
           },
           {
              "EffectType": "SlowMining",
              "Duration": 15,
              "Strength": 1
           }
        ]
     }
  ]
}

Our First Random Drug Effect:

The random drug effects follow the same format as Effects with the one main difference of having a certain % chance of occurring (this defaults to 50%). For this example we are going to have a random Hunger effect with a Duration of 20 seconds, Strength of 4 and a Chance of 80% (don't put the % sign and don't forget the comma after the closing square bracket of Effects):

{
  "Drugs": [
     {
        "Name": "Methamphetamine",
        "Material": "SUGAR",
        "UsageMessage": "You Have Just Smoked {drug}"
     },
     {
        "Name": "Weed",
        "Material": "INK_SACK",
        "Damage": 2,
        "Effects": [
           {
              "EffectType": "Slowness",
              "Duration": 15,
              "Strength": 2
           },
           {
              "EffectType": "SlowMining",
              "Duration": 15,
              "Strength": 1
           }
        ],
        "RandomEffects": [
           {
              "EffectType": "Hunger",
              "Duration": 20,
              "Strength": 4,
              "Chance": 80
           }
        ]
     }
  ]
}

Now you can add as many other effects as you'd like just add the comma after the end curly bracket of each, just like adding a new Effect, and follow the same fomat

Random Grouped Drug Effects:

Because we don't really want the player to get the effects all the time we are going to change the Effects to RandomGroupEffects and add a 90% chance of occuring (you don't have to sub one for the other, both Effects and RandomGroupEffects can be present). We just need to encase the current Effects inside another group RandomGroupEffects and add the Chance of 90%:

{
  "Drugs": [
     {
        "Name": "Methamphetamine",
        "Material": "SUGAR",
        "UsageMessage": "You Have Just Smoked {drug}"
     },
     {
        "Name": "Weed",
        "Material": "INK_SACK",
        "Damage": 2,
        "RandomGroupEffects": [
           {
              "Chance": 90,
              "Effects": [
                  {
                    "EffectType": "Slowness",
                    "Duration": 15,
                    "Strength": 2
                  },
                  {
                    "EffectType": "SlowMining",
                    "Duration": 15,
                    "Strength": 1
                  }
              ]
           }
        ],
        "RandomEffects": [
           {
              "EffectType": "Hunger",
              "Duration": 20,
              "Strength": 4,
              "Chance": 80
           }
        ]
     }
  ]
}

You can add as many of these groups as you'd like, just remember to follow the same syntax and add the comma before adding a new group

Our First Random Drug Sound:

Because we think it might be funny, we are going to add the sound of a cow to weed. Sound has 1 required field, the Name (a list of names can be found here), a sound also has 4 other optional fields: Duration and Repetitions (Duration is the time, in seconds, before the next repeat and Repetitions is the number of times that the sound is repeated. Also the Volume and Pitch of the sound). For this example we are only going to use the Name of the sound "mob.cow.hurt":

{
  "Drugs": [
     {
        "Name": "Methamphetamine",
        "Material": "SUGAR",
        "UsageMessage": "You Have Just Smoked {drug}"
     },
     {
        "Name": "Weed",
        "Material": "INK_SACK",
        "Damage": 2,
        "RandomGroupEffects": [
           {
              "Chance": 90,
              "Effects": [
                  {
                    "EffectType": "Slowness",
                    "Duration": 15,
                    "Strength": 2
                  },
                  {
                    "EffectType": "SlowMining",
                    "Duration": 15,
                    "Strength": 1
                  }
              ]
           }
        ],
        "RandomEffects": [
           {
              "EffectType": "Hunger",
              "Duration": 20,
              "Strength": 4,
              "Chance": 80
           }
        ],
        "Sounds": [
           {
              "Name": "mob.cow.hurt"
           }
        ]
     }
  ]
}

You can add as many sounds as you like and with the new resource pack features you are able to use custom sounds