SafeTrade

  • 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!

AsuDev

VIP
Jan 27, 2017
241
22
18
24
United States
View attachment 2829

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

Commands
- /trade [<player>] - Request a trade / Accept a trade
- /tradetoggle - Enable or disable trading
- /treload - Reload the config of the script

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

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
View attachment 2828

Config
code_language.skript:
## WARNING: DO NOT SET A GUI ITEM TO AIR! IT WILL CAUSE THE TRADING TO BREAK!

Messages:
    Prefix: '&8&l[&e&lTRADING&8&l]'
    TradeNoPermission: '{prefix} &cYou do not have permission to trade.'
    TradeToggleDisabled: '{prefix} &cYou disabled trading...'
    TradeToggleEnabled: '{prefix} &aYou enabled trading...'
    TradeSelf: '{prefix} &cYeah, because I would definitely allow you to trade yourself.'
    TradeCooldown: '{prefix} &cPlease wait a few seconds before using this command
        again.'
    PlayerHasTradingDisabled: '{prefix} &cThe player you specified has trading disabled...'
    NoTradeInCreative: '{prefix} &cYou cannot trade in creative mode.'
    NoTradeInCreative2: '{prefix} &cThe other player is in creative mode.'
    NotSameWorld: '{prefix} &cYou must be in the same world as the specified player
        to trade them.'
    OutOfDistance: '{prefix} &cYou are too far away from the specified player to trade
        them.'
    RequestAlreadySent: '{prefix} &cYou already sent this player a trade request...'
    ClickCorrection: '{prefix} &6Shift click items in your inventory to put up trade
        offers.'
    GuiName: '&a?You?              &c?Other?'
    RequestSent: '{prefix} &7You sent a trade request to &6{target}&7...'
    TradeCanceled: '&8&l[&4?&8&l] &cThe other player canceled the trade. &8&l[&4?&8&l]'
    TradeCanceled2: '&8&l[&4?&8&l] &cYou canceled the trade. &8&l[&4?&8&l]'
    TradeAccepted: '&8&l[&a?&8&l] &bTrade complete. &7Please report any scams! &8&l[&a?&8&l]'
    TradeReloaded: '{prefix} &aThe trade config has been reloaded.'
    RequestReceived: <command:/trade {player}><tooltip:{prefix}|nl|&7Click to accept
        the trade.>{prefix} &6{player} &7sent you a trade request.

# Does /trade have a cooldown? Put true or false
# Cooldown duration in seconds
TradeCooldown:
    Enabled: true
    Timer: 5

# The timout duration of a trade offer
# The countdown of trade ending
# Cooldown duration in seconds
# Do players have to be in same world to trade
# Distance limit for trading (Set to Infinite for no limit)
# Should players be able to trade in creative? true/false
Trade:
    TimeOut: 20
    CountDown: 6
    SameWorld: true
    Distance: Infinite
    TradeInCreative: true

# Sound played when adding an item to a trade
# Is this sound enabled? Put true/false
# The name of the sound played
# How loud the played sound is
# The pitch of the sound played
# Sounds found at: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
AddOffer:
    PlaySound: true
    SoundName: ENTITY_EXPERIENCE_ORB_PICKUP
    Volume: 1
    Pitch: 1

# Sound played when the trade is successful
# Is this sound enabled? Put true/false
# The name of the sound played
# How loud the played sound is
# The pitch of the sound played
# Sounds found at: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
TradeComplete:
    PlaySound: true
    SoundName: ENTITY_PLAYER_LEVELUP
    Volume: 1
    Pitch: 1

# Sound played when the trade is successful
# Is this sound enabled? Put true/false
# The name of the sound played
# How loud the played sound is
# The pitch of the sound played
# Sounds found at: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
TradeCanceled:
    PlaySound: true
    SoundName: BLOCK_ANVIL_LAND
    Volume: 1
    Pitch: 0.1

# The gui item for Not Ready (DO NOT SET TO AIR)
NotReady:
    ItemID: '351:8'
    Name: '&7Not Ready...'
    Lore:
    - Empty

# The gui item for Ready (DO NOT SET TO AIR)
Ready:
    ItemID: '351:10'
    Name: '&a&lREADY'
    Lore:
    - Empty

# The gui item for Accept Trade button (DO NOT SET TO AIR)
Accept:
    ItemID: '160:13'
    Name: '&a&lACCEPT TRADE'
    Lore:
    - '&7&oClick to accept trade.'

# The gui item for Cancel Trade button (DO NOT SET TO AIR)
Cancel:
    ItemID: '160:14'
    Name: '&4&lCANCEL TRADE'
    Lore:
    - '&7&oClick to cancel trade.'

# The gui item for Divider line (DO NOT SET TO AIR)
Divider:
    ItemID: 101
    Name: '&4'
    Lore:
    - Empty

# The gui item for Stop Timer item (DO NOT SET TO AIR)
StopTimer:
    ItemID: 166
    Name: '&c&lSTOP TIMER'
    Lore:
    - '&7&oClick to stop the timer.'

# The gui item for Blank Slot item (DO NOT SET TO AIR)
BlankSlot:
    ItemID: '160:8'
    Name: '&4'
    Lore:
    - Empty