1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Script SafeTrade 1.1

Great player to player safe item trading script.

Tags:
  1. Revelationage
    Contributors:
    AsuDev
    Supported Minecraft Versions:
    • 1.12
    header.png

    SafeTrade

    SafeTrade is a script that makes trading items between players easy and simple.

    Features
    - Safe and simple way for people to trade items
    - Configurable messages
    - Inventory checker for full inventory
    - Creative mode option
    - Configurable trade cool down and trade time out
    - Configurable distance and same world checker
    - Configurable countdown timer when trading for safety
    - Configurable sounds for specific functions
    - Configurable GUI items
    - Blacklist items based on name, lore, item id, or exact item

    Commands
    - /trade [<player>] - Request a trade / Accept a trade
    - /tradetoggle - Enable or disable trading
    - /tblacklist [<create,remove,set>] [<id>] - Create blacklist ids (Edit in blacklist.yml)
    - /treload - Reload the config of the script

    Permissions
    - trade.use (for /trade and /tradetoggle)
    - trade.reload (for /treload)
    - trade.blacklist (for /tblacklist)

    Blacklisting Guide
    When you first load up the file, a blank blacklist.yml file will be created. I recommend not editing this file when it is empty.
    1. To make a blacklist item, you have to create it using the '/tblacklist create <id>' command. The <id> can be anything you want.
    2. After using the create command, it will be created in the blacklist.yml file. You can then go change the settings for that id.
    3. To set an exact item, hold an item that is not air in your hand and use command '/tblacklist set <id>'. This will make it to where whatever you are holding cannot be traded.
    4. Make sure to read the top of the blacklist.yml for directions on what options do what. After you create your first blacklist id, the directions will generate.

    Required Plugins
    Skript Bensku fork dev37c: https://github.com/SkriptLang/Skript/releases/tag/dev37c
    SkQuery fork: https://www.spigotmc.org/resources/unofficial-skquery-fork-1-6-1-12.36631/
    Skellett: https://www.spigotmc.org/resources/skript-java-addon-skellett.34361/
    Skript-Yaml: https://www.spigotmc.org/resources/skript-yaml.49829/

    Installation
    1. Drop all the plugins above into plugins folder and restart server.
    2. Download this resource (trade.sk) and put it in the plugins/Skript/scripts folder
    3. You can either restart the server again or do /sk reload trade
    4. Your done!

    Known Bugs
    1. Sometimes shift click does not work (only like 3% of the time) The next click should work fine though. This is not a game breaking bug so you should not worry about it (it is just sometimes a little annoying).

    Extra Information
    1. To put items up for trade, you have to shift click the items. There is a reason for this and I will not change it.
    2. Feel free to edit the script's source code to your liking but do not claim it as your own.
    3. I will most likely not add economy support to this. If you want to have eco with this trade, then either make a physical currency or use a plugin that allows you to convert virtual currency to physical currency.
    4. Here is my discord if you have any questions or need help: AsuDev#0714

    Pictures
    example.png

    Configs


    config.yml
    Code (YAML):
    1. ## WARNING: DO NOT SET A GUI ITEM TO AIR! IT WILL CAUSE THE TRADING TO BREAK!
    2.  
    3. Messages:
    4.     Prefix: '&8&l[&e&lTRADING&8&l]'
    5.     TradeNoPermission: '{prefix} &cYou do not have permission to trade.'
    6.     TradeToggleDisabled: '{prefix} &cYou disabled trading...'
    7.     TradeToggleEnabled: '{prefix} &aYou enabled trading...'
    8.     BlacklistedIDExists: '{prefix} &cThe blacklisted item id you specified already
    9.         exists.'
    10.     BlacklistedIDDoesNotExist: '{prefix} &cThe blacklisted item id you specified does
    11.         not exist.'
    12.     BlacklistedItem: '{prefix} &cThe item you clicked is a blacklisted item.'
    13.     BlacklistedIDCreated: '{prefix} &7You &acreated &7a blacklist id called &6{id}&7.
    14.         To edit this, you have to edit the blacklist.yml file.'
    15.     BlacklistedIDRemoved: '{prefix} &7You &cremoved &7the blacklist id called &6{id}&7.'
    16.     BlacklistedIDExactItem: '{prefix} &7You &3set &7the exact item of blacklist id
    17.         called &6{id} &7to your held item.'
    18.     TradeSelf: '{prefix} &cYeah, because I would definitely allow you to trade yourself.'
    19.     TradeCooldown: '{prefix} &cPlease wait a few seconds before using this command
    20.         again.'
    21.     PlayerHasTradingDisabled: '{prefix} &cThe player you specified has trading disabled...'
    22.     NoTradeInCreative: '{prefix} &cYou cannot trade in creative mode.'
    23.     NoTradeInCreative2: '{prefix} &cThe other player is in creative mode.'
    24.     NotSameWorld: '{prefix} &cYou must be in the same world as the specified player
    25.         to trade them.'
    26.     OutOfDistance: '{prefix} &cYou are too far away from the specified player to trade
    27.         them.'
    28.     AlreadyInTrade: '{prefix} &cThe other player is already currently in a trade.'
    29.     RequestAlreadySent: '{prefix} &cYou already sent this player a trade request...'
    30.     ClickCorrection: '{prefix} &6Shift click items in your inventory to put up trade
    31.         offers.'
    32.     GuiName: '&a★You★              &c★Other★'
    33.     RequestSent: '{prefix} &7You sent a trade request to &6{target}&7...'
    34.     TradeCanceled: '&8&l[&4✘&8&l] &cThe other player canceled the trade. &8&l[&4✘&8&l]'
    35.     TradeCanceled2: '&8&l[&4✘&8&l] &cYou canceled the trade. &8&l[&4✘&8&l]'
    36.     TradeAccepted: '&8&l[&a✔&8&l] &bTrade complete. &7Please report any scams! &8&l[&a✔&8&l]'
    37.     TradeReloaded: '{prefix} &aThe trade config has been reloaded.'
    38.     RequestReceived: <command:/trade {player}><tooltip:{prefix}|nl|&7Click to accept
    39.         the trade.>{prefix} &6{player} &7sent you a trade request.
    40.  
    41. # Does /trade have a cooldown? Put true or false
    42. # Cooldown duration in seconds
    43. TradeCooldown:
    44.     Enabled: true
    45.     Timer: 5
    46.  
    47. # The timout duration of a trade offer
    48. # The countdown of trade ending
    49. # Cooldown duration in seconds
    50. # Do players have to be in same world to trade
    51. # Distance limit for trading (Set to Infinite for no limit)
    52. # Should players be able to trade in creative? true/false
    53. Trade:
    54.     TimeOut: 20
    55.     CountDown: 6
    56.     SameWorld: true
    57.     Distance: Infinite
    58.     TradeInCreative: false
    59.  
    60. # Sound played when adding an item to a trade
    61. # Is this sound enabled? Put true/false
    62. # The name of the sound played
    63. # How loud the played sound is
    64. # The pitch of the sound played
    65. # Sounds found at: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
    66. AddOffer:
    67.     PlaySound: true
    68.     SoundName: ENTITY_EXPERIENCE_ORB_PICKUP
    69.     Volume: 1
    70.     Pitch: 1
    71.  
    72. # Sound played when the trade is successful
    73. # Is this sound enabled? Put true/false
    74. # The name of the sound played
    75. # How loud the played sound is
    76. # The pitch of the sound played
    77. # Sounds found at: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
    78. TradeComplete:
    79.     PlaySound: true
    80.     SoundName: ENTITY_PLAYER_LEVELUP
    81.     Volume: 1
    82.     Pitch: 1
    83.  
    84. # Sound played when the trade is successful
    85. # Is this sound enabled? Put true/false
    86. # The name of the sound played
    87. # How loud the played sound is
    88. # The pitch of the sound played
    89. # Sounds found at: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
    90. TradeCanceled:
    91.     PlaySound: true
    92.     SoundName: BLOCK_ANVIL_LAND
    93.     Volume: 1
    94.     Pitch: 0.1
    95.  
    96. # The gui item for Not Ready (DO NOT SET TO AIR)
    97. NotReady:
    98.     ItemID: '351:8'
    99.     Name: '&7Not Ready...'
    100.     Lore:
    101.    - Empty
    102.  
    103. # The gui item for Ready (DO NOT SET TO AIR)
    104. Ready:
    105.     ItemID: '351:10'
    106.     Name: '&a&lREADY'
    107.     Lore:
    108.    - Empty
    109.  
    110. # The gui item for Accept Trade button (DO NOT SET TO AIR)
    111. Accept:
    112.     ItemID: '160:13'
    113.     Name: '&a&lACCEPT TRADE'
    114.     Lore:
    115.    - '&7&oClick to accept trade.'
    116.  
    117. # The gui item for Cancel Trade button (DO NOT SET TO AIR)
    118. Cancel:
    119.     ItemID: '160:14'
    120.     Name: '&4&lCANCEL TRADE'
    121.     Lore:
    122.    - '&7&oClick to cancel trade.'
    123.  
    124. # The gui item for Divider line (DO NOT SET TO AIR)
    125. Divider:
    126.     ItemID: 101
    127.     Name: '&4'
    128.     Lore:
    129.    - Empty
    130.  
    131. # The gui item for Stop Timer item (DO NOT SET TO AIR)
    132. StopTimer:
    133.     ItemID: 166
    134.     Name: '&c&lSTOP TIMER'
    135.     Lore:
    136.    - '&7&oClick to stop the timer.'
    137.  
    138. # The gui item for Blank Slot item (DO NOT SET TO AIR)
    139. BlankSlot:
    140.     ItemID: '160:8'
    141.     Name: '&4'
    142.     Lore:
    143.    - Empty
    144.  



    blacklist.yml

    Code (YAML):
    1. ## This is the item blacklist for trading.
    2. ## Use /tblacklist <create,remove,set> <id> for managing the item blacklist.
    3. ##
    4. ## Detection Types:
    5. ##   'Name' = Detect blacklisted item by name (For DetectionType Option)
    6. ##   'Lore' = Detect blacklisted item by lore (For DetectionType Option)
    7. ##   'Both' = Detect blacklisted item by name and lore (For DetectionType Option)
    8. ##   'id' = Detect blacklisted item by item id (For DetectionType Option)
    9. ##   'ExactItem' = Detect blacklisted item by exact item (For DetectionType Option)
    10. ##
    11. ## Text Detection Types:
    12. ##   'Contains' = If name or lore of blacklisted item CONTAINS certain text (For TextDetectionType Option)
    13. ##   'Is' = If name or lore of blacklisted item IS certain text (For TextDetectionType Option)
    14. ##
    15. ## ItemName = The text to find in the name of a item (Applies when DetectionType is set to 'Name' or 'Both')
    16. ## ItemLore = The text to find in the lore of a item (Applies when DetectionType is set to 'Lore' or 'Both'
    17. ## ItemID = The item id of the item you want to blacklist (Applies when DetectionType is set to 'ID')
    18. ## ExactItem = Detection for an exact item (Applies when DetectionType is set to 'ExactItem'. To set an exact item, use /tblacklist set <id>)
    19.  
    20. '1':
    21.     DetectionType: Name
    22.     TextDetectionType: Contains
    23.     ItemName: '&dGod Sword'
    24.  
    25. '2':
    26.     DetectionType: Lore
    27.     TextDetectionType: Contains
    28.     ItemLore: '&7&oUntradeable...'
    29.  
    30. '3':
    31.     DetectionType: Both
    32.     TextDetectionType: Is
    33.     ItemName: '&cForbidden Item'
    34.     ItemLore: '&7&oThis item cannot be traded.'
    35.  
    36. '4':
    37.     DetectionType: id
    38.     ItemID: '276'
    39.  
    40. '5':
    41.     DetectionType: ExactItem
    42.     ExactItem:
    43.         ==: org.bukkit.inventory.ItemStack
    44.         type: DIAMOND_SWORD
    45.         meta:
    46.             ==: ItemMeta
    47.             meta-type: UNSPECIFIC
    48.             display-name: §bBlargghhh
    49.             lore:
    50.            - §9Trolls use this weapon...
    51.  

Recent Updates

  1. Bug Fixes, Item Blacklisting