Supported MC Versions1.16, 1.15, 1.14, 1.13, 1.12, 1.11, 1.10, 1.9, 1.8, 1.7
DependenciesVault, EssentialsX

This plugin allows a player to have "One-Time" item, which will execute a pre-defined set of commands when it is "right-clicked" in the air.  Once the item is used, it will automatically be removed from a player's inventory.

The server owner can :
 
  • use any item as a One-Time item,
  • assign any number of commands to be executed upon right-click.

The configuration of each One-Time item must be specified in the config.yml.





Installation:
Just install OneTimeItem.jar in the plugin folder. Then you can either "restart the server" or "reload the plugin. You would also need to install Vault plugin, which this plugin uses to manage permissions.

Commands:
 
  • /oti help : displays this help menu.
  • /oti reload : reloads config file.
  • /oti debug <true|false> : turn on / off the debug mode.
  • /oti give <player> <one_time_item_id> <amount> : gives <player> the specified one time items.
  • /oti list : lists available one time items.

Permissions:

  • onetimeitem.admin : allows you to use give | list command
  • onetimeitem.reload : allows you to use reload command
      if you enabled "UserPermissionNode:" option, your user needs to have a corresponding permission node to use each OneTimeItem.  For example, in order for a player to use Multiplier1 (as shown in the example config), the player needs to have "onetimeitem.use.multiplier1" permission node to use this item.

Configuration:

Messages:
  ErrorMsg : "&c[OneTimeItem] : Some error occured."
  NoPlayer : "&c[OneTimeItem] : Player Not Found."
  NoSuchOneTimeItem : "&c[OneTimeItem] : No such OneTimeItem %type% found."
  OTItemGiven: "&a[OneTimeItem] %player% received %amount% one time items of type %type%!"
  OTItemReceived: "&a[OneTimeItem] You received %amount% one time items of type %type%!"
  OnceInALifetime: "&c[OneTimeItem] : You can use this item once in your lifetime!"
  CannotUseIt: "&c[OneTimeItem] : You cannot use it here!"
  NoPermission : "&c[OneTimeItem] : You don't have permission to use this item!"

HelpMessages:
  banner:
    msg: "=== &e[&aOneTimeItem Commands List (%version%)&e] &r==="
  help:
    msg: "&a/oti help : displays this help menu."
  reload:
    msg: "&a/oti reload : reloads config file."
    permission: "OneTimeItem.reload"
  debug:
    msg: "&a/oti debug <true|false> : turn on / off the debug mode."
    permission: "onetimeitem.debug"
  give:
    msg: "&a/oti give <player> <one_time_item_id> <amount> : gives <player> the specified one time items."
    permission: "onetimeitem.admin"
  list:
    msg: "&a/oti list : lists available one time items."
    permission: "onetimeitem.admin"

# if this option is set to true, a user must have a corresponding permission
# node to use the item
UsePermissionNode: false

# this option just enable/disable the fake glowing effect.
UseEnchantGlow: true

# this option will allow you to use OTI without NBT tag.
# instead it will add unique item tag to the item's lore
UseItemTag: false

ItemTagPrefix: "OTIID:"

# If other plugins are interfering with this plugin for certain events,
# you can adjust this plugin's event process priority with the following options
# possilbe priority values are "LOWEST", "LOW", "NORMAL", "HIGH", "HIGHEST", "MONITOR"
EventPriorityMap:
  PlayerInteractEvent: "HIGHEST"
  BlockPlaceEvent: "HIGHEST"

#
# command starts with '@' will be executed as a player
# command starts with '>' will be executed as the players as an Op.
# command starts with '!' will be executed by the console.
#
OneTimeItems:
  Multiplier1:
    Item: SNOW_BALL
    Data: 0                     #this is for item like INK_SACK
    Name: "&aMultiplier"
    Lore:
      - "&bRight Click to redeem!"
    Commands:
      - ">asa addmultiplier %player% 2 1:0"
    RandomCommand:         # one of following commands will be randomly picked and executed.
      - ">eco give %player% 100"
      - ">te add %player% 100"
    OnceInALifetime: true  # a player can use this item only once in his/her lifetime
    Trigger: RIGHT_CLICK  #  option is either RIGHT_CLICK or LEFT_CLICK  (if no Trigger: option is provided, default is RIGHT_CLICK)
  Multiplier2:
    Item: ENDER_PEARL
    Name: "&aMultiplier 2"
    Lore:
      - "&bRight Click to redeem!"
    Commands:
      - ">asa addmultiplier %player% 2 2:0"
#    DisabledWorlds:
#      - no_multiplier
#    DisabledRegions:
#      - no_multi_region
#    Sound: BLOCK_ANVIL_BREAK
#    Effect: PORTAL  # PORTAL particle is the default
  Multiplier3:
    Item: PLAYER_HEAD
    Data: 3 # for player head
    Texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWE0MWU2MjEzMjUyYzY0YzQyNzY2OTkwZjU4ZWI1MjkzZWRlMTcyOGJjN2M5NGJkNTc5MWU2MjBkM2E3In19fQ=="
    Name: "&aMultiplier 3"
    Lore:
      - "&bRight Click to redeem!"
    Commands:
      - ">asa addmultiplier %player% 2 2:0"
    OnceInALifetime: true  # a player can use this item only once in his/her lifetime