OneTimeUse | Use an item once and execute a command 2.4

Give players an OTU item which executes command(s) when right clicking
0uyDG9x.png

Discord support sever
XUtPTdl.png

OneTimeUse is a plugin that lets you use an item just once and executes a command or multiple commands you can set in the config. So you can give a player an item that heals the player, after he right clicks it the player will be healed and the item will be removed from the inventory. You can also configure it when the player clicks with an otu item on another player, the player that was clicked on will execute the commands.
hkvvXa4.png

- You can use every item as a OneTimeUse item
- You can create a kit with multiple OneTimeUse items in it
- You can add as many commands as you want to one item
- One item can execute a whole list of commands or a random command
- Unlimited items can be added to the config
- Option to allow the players to drop the item or not
- Option to allow the players to craft with the item or not
- Play a sound when using an OTU item
- Create particles when using an OTU item
- Color codes support
- Every message is customizable
- Every item ID is customizable
- Every item name is customizable
- Every item lore is customizable + multiple lores supported
- Automatic checking for updates; can be disabled in the config
- Each OTU item has its own permission
- Supports PlaceHolderAPI
- And more

htblbjQ.png

You can use /onetimeuse and /otu

/otu help : No Permission
/otu list: otu.list
/otu giveall <item> <amount> : otu.giveall
/otu give <player> <item> <amount> : otu.give
/otu kit <player> <kit> <amount>: otu.kit
/otu reload : otu.reload
permission to use the items: otu.use.* (permission to use every OTU item) or otu.use.itemname
(example: an item with the name fireball will have the permission node: otu.use.fireball)
To prevent someone from using a specific item: otu.deny.itemname
RjCgmOg.png
Code:
###############################
#   Plugin made by ParaStyle  #
#         Version 2.1.3       #
###############################

Config:
  CheckForUpdates: true
  PluginTag: "&f[&6OneTimeUse&f] "
  DisabledWorlds:
    - OTUDisabledWorld
    - OTUDisabledWorld_nether

Messages:
  NoPermissionGiveAll: "&4You have no permission for this command!"
  NoPermissionGive: "&4You have no permission for this command!"
  NoPermissionKit: "&4You have no permission for this command!"
  NoPermissionUse: "&4You have no permission to use this item!"
  NoPermissionList: "&4You have no permission to check the list!"
  NoPermissionReload: "&4You have no permission to reload the config file!"
  PlayerOffline: "&4This player is offline!"
  NoItem: "&4You have no item with that name!"
  NoKit: "&4You have no kit with that name!"
  OnlyUseNumbers: "&4Only use numbers for the amount!"
  NoDrop: "&4You can't drop this item!"
  WrongCommand: "&4For more help use /otu help"
  Help:
    - "&3-----Commands-----"
    - "&3/otu list : &fshows the list of items"
    - "&3/otu give <playername> <item> <amount> :&f gives the player the item"
    - "&3/otu reload :&f reloads the config file"
  GaveAll: "&2You gave %amount %item item to all online players."
  GaveItem: "&2You gave %amount %item item to %targetplayer."
  GaveKit: "&2You gave %amount %kit kit to %targetplayer."
  ReceivedItem: "&2You received %amount %item item from %player."
  ReceivedKit: "&2You received %amount %kit kit from %player."
  NoOffHand: "&4You are not allowed to use OneTimeUse items in your off hand."
  DisabledWorld: "&4You are not allowed to use OneTimeUse items in this world."
 
Items:
  TestItem1:           
    MaterialName: REDSTONE_TORCH     #THE NAME OF THE MATERIAL, list at (dont use items starting with LEGACY): https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
    ItemName: "&6Test Item One"      #THE DISPLAY NAME OF THE ITEM
    ItemLore:                        #THE LORES OF THE ITEM
      - "&3Right Click"
      - "&3Second lore"
    ItemMessage: "&6TestItem1 has been used!"  #THIS MESSAGE WILL BE SENT TO THE PLAYER WHEN USING THE ITEM. REMOVE LINE TO SEND NOTHING.
    DropItem: false                  #CAN YOU DROP THE ITEM? true = drop , false = no drop
    CraftWithItem: false             #CAN YOU USE THE ITEM IN THE CRAFTING TABLE? true = yes, false = no
    Glowing: false                   #TRUE = GLOWING EFFECT
    ReceiveMessage: true             #DO YOU WANT THE PLAYERS TO GET THE "RECEIVEDITEM" MESSAGE WHEN RECEIVING THIS ITEM?
    ClickedPlayerExecute: false      #TRUE= THIS ITEM WILL ONLY WORK WHEN IT IS CLICKED ON ANOTHER PLAYER, THE CLICKED PLAYER WILL EXECUTE THE COMMANDS
    ConsoleCommands:                 #THE COMMANDS THAT WILL BE EXECUTED BY THE CONSOLE, YOU CAN ADD AS MANY AS YOU WANT
      - "time set day"
    RandomConsoleCommand: false      #Execute one random console command from the list above instead of executing the whole list
    PlayerCommands:                  #THE COMMANDS THAT WILL BE EXECUTED BY THE PLAYER, YOU CAN ADD AS MANY AS YOU WANT
      - "help"
    RandomPlayerCommand: false       #Execute one random player command from the list above instead of executing the whole list
    PlayerAsOpCommands:              #THE COMMANDS THAT WILL BE EXECUTED BY THE PLAYER AS OP, YOU CAN ADD AS MANY AS YOU WANT
      - "gamemode 1"
    RandomPlayerAsOPCommand: false   #Execute one random player as op command from the list above instead of executing the whole list
    Particle: EXPLOSION_NORMAL       #What particle should be created when using the OTU item? To create no particle, remove this line. This is a spigot version 1.10+ particle, so this particle won't work on spigot versions below 1.10. Particles list: https://www.spigotmc.org/wiki/cc-particles-list/
    Sound: BLOCK_ANVIL_BREAK         #What sound should be played when using the OTU item? To play no sounds, remove this line. This is a spigot version 1.9+ sound, so this sound won't work on spigot versions below 1.9. Sound list: https://www.spigotmc.org/wiki/cc-sounds-list/
    ReceiveOnFirstJoin: 3            #When joining the server for the first time, the players will receive testitem1 3 times.
  TestItem2:
    MaterialName: OAK_LOG
    ItemData: 0
    ItemName: "&6Test Item Two"
    ItemLore:
      - "&7Right Click"
      - "&2Second lore"
    ItemMessage: "&6TestItem2 has been used!"
    DropItem: false
    CraftWithItem: true
    Glowing: true
    ReceiveMessage: true
    ClickedPlayerExecute: true
    ConsoleCommands:
      - "broadcast random"
      - "broadcast console"
      - "broadcast command"
      - "broadcast executed"
    RandomConsoleCommand: true
    RandomConsoleCommandChance:      #Set the chances for the commands that can be randomly executed (in %, make sure the total is 100%)
      - "10"                         #10% chance for - "broadcast random"
      - "10"                         #10% chance for - "broadcast console"
      - "10"                         #10% chance for - "broadcast command"
      - "70"                         #70% chance for - "broadcast executed" (10% + 10% + 10% + 70% = 100%)
    PlayerCommands:
      - "heal"
      - "help"
      - "money"
    RandomPlayerCommand: true
    RandomPlayerCommandChance:
      - "25"
      - "10"
      - "65"
    PlayerAsOpCommands:
      - "gamemode 0 %player"
      - "fireball"
      - "gamemode 1 %player"
    RandomPlayerAsOPCommand: true
    RandomPlayerAsOPCommandChance:
      - "75"
      - "10"
      - "15"
    Particle: FIREWORKS_SPARK
    Sound: BLOCK_ENDERCHEST_OPEN
    ReceiveOnFirstJoin: 0

Kits:
  StarterKit:         
    TestItem1: 3                     #itemname (an OTU item you made in the 'Items' section above): amount
    TestItem2: 5                     #This kit will give 3 times testitem1 and 5 times testitem2
    ReceiveMessage: true
    ReceiveOnFirstJoin: 1
MESSAGES PLACEHOLDERS:
%amount: The amount of items you have given to the player
%item: The item you have given to the player
%kit: The kit you have given to the player
%targetplayer: The player you have given the item
%player: The player who executes: /otu give
PlaceHolderAPI placeholders


COMMANDS PLACEHOLDERS:
%player to get the player who clicked the item
%location to get the location of the player who clicked the item

if you have idea's for more placeholders, let me know!

DVKYhvL.png



TtQnUao.png

Stop your server.
Drop OneTimeUse.jar in the plugins folder.
Start your server.
Enjoy!
U392pCC.png

By purchasing this plugin you agree to the terms and conditions.
You are not allowed to redistribute this plugin.
You are not allowed to decompile this plugin.
Only use it for your own server/network.
No refunds.
KfEkoAR.png

If you like this plugin please leave a review.

If you need support, find bugs or have a suggestion for this plugin, join my discord server: https://discord.gg/nUzbrxF
I will no longer add features to OTU for spigot versions below 1.9. (You can still use the plugin in versions below 1.9)

Latest updates

  1. OneTimeUse Version 2.4

    Version 2.4: You can now add a delay before executing the commands. (CommandDelay: 0 has been...

Author

ParaStyle

Owner
Author
ParaStyle
Downloads
5
Type
Digital product
License duration
Unlimited
Price
5.99 GBP
Views
248
First release
Last update
Rating
0.00 star(s) 0 ratings
Top
You need to upgrade!
Our dark style is reserved for our Premium members. Upgrade here.