Solved Drag and drop

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

Hartvig

Member
Apr 18, 2017
39
1
0
22
Category:
Custom enchants
Suggested name:
Drag and drop enchantments
Spigot/Skript Version:
2.4-beta7
What I want:
Drop an book from player's inventory on to a tool and add the name of the book to the lore of the tool
 
There are many spigot plugins that do exactly this, why not use one of them?
 
Since, it is marked as solved, I stopped working on this. I couldn't figure out how to get at the stored enchantments using Skript without add-ons:

Code:
on inventory click:
  if event-inventoryaction is swap with cursor:
    set {_enchantBook} to cursor slot of player
    set {_enchantItem} to clicked item
    if {_enchantBook} is an Enchanted book:
      cancel event
      #Stuff
 
Since, it is marked as solved, I stopped working on this. I couldn't figure out how to get at the stored enchantments using Skript without add-ons:

Code:
on inventory click:
  if event-inventoryaction is swap with cursor:
    set {_enchantBook} to cursor slot of player
    set {_enchantItem} to clicked item
    if {_enchantBook} is an Enchanted book:
      cancel event
      #Stuff

i forgot to mark it solved sry!! :3

i figured out something and i don't mind sharing it, though the lore seems to be a bit buggy when adding multiple enchantments

Code:
on inventory click:
    if cursor slot of player is book named "&a&lSmelt", "&f&lEfficiency" or "&a&lFortune":
        set {_nm} to name of cursor slot of player
        if name of event-item is "&eYour item":
            if event-item's lore doesn't contain "%{_nm}%":
                set {_a} to event-item
                cancel event
                set lore of {_a} to "%lore of {_a}%" and "%{_nm}%"
                wait 2 ticks
                set cursor slot of player to air
                set event-slot to {_a}
            else:
                cancel event
                send "&7You already have that enchantment!"
 
  • Like
Reactions: Policiu