#BUG FIXES!

1 messages · Page 1 of 1 (latest)

keen gull
#

I need help with 2 bugs i have in my skript
Bug #1:
When a player dies with the diamond sword that has the 'lore' it will remove the first diamond sword it finds. so if you have two and the one with soulbound is first the soulbound will be removed but if a plain sword is first that one gets removed first.

Bug #2:
I wanted to use {@tools} option to make it easier to remove/ add items in the future but i cant do multiple items with it as the skript will stop working. thats why its set to just diamond sword at the moment

#
    tools: diamond sword or diamond pickaxe or diamond axe or diamond helmet or diamond chestplate or diamond leggings or diamond boots or netherite sword or netherite pickaxe or netherite axe or netherite helmet or netherite chestplate or netherite leggings or netherite boots


#SOULBOUND

command /soulbound:
    permission: customenchant.give
    trigger:
        give player enchanted book with lore "SoulBound I" and " " and "&7&o| Right Click On A Tool To Apply |" with custom model data 1
#Gives The Player The Enchantment If They Have The Permission

on inventory click:
    if item in clicked slot is diamond sword with lore "SoulBound I":
        if "%click type%" is "right mouse button":
            if cursor slot of player is enchanted book with lore "SoulBound I" and " " and "&7&o| Right Click On A Tool To Apply |" with custom model data 1:
                send "first test 1"
                cancel event
                send "&c&lCe &f| Cant Apply This &eEnchantment &fAs Its Already Maxed" to player
    else:
        if "%click type%" is "right mouse button":
            if item in clicked slot is {@tools}:
                if cursor slot of player is enchanted book with lore "SoulBound I" and " " and "&7&o| Right Click On A Tool To Apply |" with custom model data 1:
                    set lore of clicked slot to "SoulBound I"
                    cancel event
                    set cursor slot of player to air
                    send "&c&lCe &f| Applied &5SoulBound I &fTo This Item" to player



#This Part Is What Makes The Keep Item Work                
on death of a player:
    drop (all items in victim where [lore of input is not "SoulBound I"])
#Drops All Items on death if it doesnt have the lore "SoulBound I" 
    
    loop items of victim:
        if lore of loop-item is not "SoulBound I":
            remove loop-item from victim
    #Check All items in the inventory for item without "SoulBound I" and then removes it from the inventory```