PlayerHeads API 5.2.16 (not a plugin)

Details

  • Filename
    PlayerHeads-api-5.2.16-SNAPSHOT.jar
  • Uploaded by
  • Uploaded
    Jun 6, 2021
  • Size
    19.79 KB
  • Downloads
    82
  • MD5
    90b5d3f5307571f8be60af8bda42a2cf

Supported Bukkit Versions

  • 1.17
  • 1.16
  • 1.15
  • 1.14
  • 1.13
  • 1.12
  • 1.11
  • 1.10
  • 1.9
  • 1.8.1
  • 1.8

Changelog

PlayerHeads 5.2.16 API additions

  • API change: deprecated all of the constructors for HeadRollEvent except the one without any modifiers as parameters.
  • API change: deprecated all of the get__Modifier methods where __ was an inbuilt modifier like slime,chargedcreeper, lotting.
  • API added/changed: instead of just containing slimeModifier,chargedCreeperModifier, lootingModifier internally - HeadRollEvent now contains a map of named "DropRateModifier" objects which describe their behavior and parameters.  The map is in the format Map<String,DropRateModifier>.  Each modifier is applied in succession to the effective droprate (starting at the original droprate) in the order they are added to the map.
    The internal (raw) name of modifiers is prefixed by the name of the plugin that set it and colon (eg. "MyCoolPlugin:luckmod") except for inbuilt modifiers like looting which have no prefix (eg. "looting").
    TL;DR - Basically this means instead of having 3 official modifiers and leaving you to calculate anything else - you now have a dynamic list of modifiers and you can add your own custom ones to it and other plugins can see them.
  • API added: added DropRateModifier object, which you can use to check or construct your own modifiers by providing the Type of action you want, the Value you want to base the change on, and an additional Level parameter for levelled modifier types.
  • API added: DropRateModifierType, which currently lets you select from:
    - ADD_CONSTANT - add a constant value you define directly to the droprate (level parameter is unused)
    - ADD_MULTIPLE - add amount of droprate multiplied against the value you defined (equivalent to multiplying the droprate against 1 + value, level parameter is unused)
    - ADD_MULTIPLE_PER_LEVEL - add amount of droprate multiplied against the value you defined times the level you defined (equivalent to droprate * (1 + value*level) ).

    - MULTIPLY - multiply the droprate against a constant value you define. (level parameter is unused)
    Obviously, all of these options can be reduced to either ADD_CONSTANT or MULTIPLY, but they should simplify calculations - and may be expanded with more options later.
  • API added: HeadRollEvent:getModifiers() - retrieve the map of modifiers on the head roll**
  • API added: HeadRollEvent:setModifiers(map) - overwrite the map of modifiers on this head roll**  [!]
  • API added: HeadRollEvent:setModifier(name, DropRateModifier) - add or overwrite a raw/builtin modifier on this head roll** [!]
  • API added: HeadRollEvent:getModifier(name) - retrieves a raw/builtin modifier on this head roll [!]
  • API added: HeadRollEvent:getCustomModifierName(pluginName, modifierName) - generates the internal/"raw" name of a custom modifier.
  • API added: HeadRollEvent:getCustomModifier(pluginName,modifierName) - retrieves a custom (plugin-defined) modifier on this head roll
  • API added: HeadRollEvent:getCustomModifier(pluginInstance,modifierName) - retrieves a custom (plugin-defined) modifier on this head roll
  • API added: HeadRollEvent:setCustomModifier(pluginInstance,modifierName) - sets a custom modifier defined by your plugin on this head roll**
  • API added: HeadRollEvent:applyModifiers() - calculates the effect of applying all the present modifiers to the original droprate and stores the result in the effective droprate. * NOTE: this will erase any changes to the effective droprate you have made.
  • API added: HeadRollEvent:applyDropRate() - updates the success value of the event based on the current effective droprate and effective roll.  Success occurs when effectivedroproll < effectivedroprate (ie. the roll fell within the range of the droprate where the roll can be 0.0-1.0)
  • API added: HeadRollEvent:recalculateSuccess() - recalculates the effect of modifiers on the droprate and updates the success value of the event. (equivalent to running both applyModifiers and applyDropRate).  If you are adding or changing modifiers - this should be the method you use to make your changes take effect.
  • API added: HeadRollEvent:setEffectiveDropRoll(double) - change the effective drop roll. This is usually a random value 0.0-1.0 *
  • API added: HeadRollEvent:setEffectiveDropRate(droprate) - change the effective drop rate for this head roll. *

!  = Deprecated as not recommended, but is not planned for removal

** = Note 1: this method does not impact the effective droprate/roll nor the success value unless you use recalculateSuccess method

* = Note 2: this method does not impact the success value unless you use applyDropRate, recalculateSuccess method

 

This API should remain completely compatible with previous versions, deprecation warnings notwithstanding.

 

Documentation: https://crashdemons.github.io/PlayerHeads/

Instructions on using as a maven dependency can be found on the 4.10.0 API page.