Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditions for items in player's inventory with a weird behavior #6183

Open
1 task done
tiradorus opened this issue Nov 11, 2023 · 6 comments
Open
1 task done

Conditions for items in player's inventory with a weird behavior #6183

tiradorus opened this issue Nov 11, 2023 · 6 comments
Labels
investigating The core developers are currently investigating this issue. Usually used for complex cases.

Comments

@tiradorus
Copy link

Skript/Server Version

[INFO] [Skript] Server Version: git-Paper-196 (MC: 1.20.1)
[INFO] [Skript] Skript Version: 2.7.1 (skriptlang-github)
[INFO] [Skript] Installed Skript Addons:
[INFO] [Skript] - skript-placeholders v1.5.1 (https://github.com/APickledWalrus/skript-placeholders)
[INFO] [Skript] - Skellett v2.0.9 (https://forums.skunity.com/resources/skellett.24/)
[INFO] [Skript] - skript-yaml v1.5
[INFO] [Skript] - skript-db v1.3.9
[INFO] [Skript] - SkQuery v4.1.10
[INFO] [Skript] - Skript-Paper v1.3.0 (https://github.com/ShaneBeee/Skript-Paper)
[INFO] [Skript] - SkBee v2.18.3 (https://github.com/ShaneBeee/SkBee)
[INFO] [Skript] - Ersatz v1.0
[INFO] [Skript] - ItemsAdder v3.6.1-beta-r2 (devs.beer)
[INFO] [Skript] Installed dependencies:
[INFO] [Skript] - SQLibrary v7.1
[INFO] [Skript] - Vault v1.7.3-b131
[INFO] [Skript] - WorldGuard v7.0.9+5934e49

Bug Description

When you try to find certains items into the player's inventory (With certains conditions) the items that matches the conditions from other plugins aren't considered, even if the conditions are ok.

Every conditions does not work for this one, none.
If you try a:

        set {_inventory.%player%} to number of diamond with custom model data 6589 in player's inventory
        message "&a%{_inventory.%player%}%" to the player

Then it does not count all the diamonds with the right CustomModelData in players inventory, it count only thoses that skript want to count.
Skript do not recognize every items that you are looking for.

Same for every conditions (name, lore, enchants...)
Some items (Usually generated from other plugins) are just totally ignored by skript.

Expected Behavior

If you try a:

        set {_inventory.%player%} to number of diamond with custom model data 6589 in player's inventory
        message "&a%{_inventory.%player%}%" to the player

Then ALL the diamonds with custom model data 6589 in player's inventory should have been added to {_inventory.%player%}
Not only the one that skript ... want to consider

Steps to Reproduce

Create thoses commands into a skript:

 #This one create a diamond with CustomModelData 6589      
command /gmdata:
    trigger:
        give 1 diamond named "&a&lDiamond test" with custom model data 6589 to player

#This one display the CustomModelData of the player's tool
command /mdata:
    trigger:
        set {_inventory.%player%} to custom model data of player's tool
        message "&a%{_inventory.%player%}%" to the player
        
#This one display the NBT of the player's tool
command /nbt:
    trigger:
        set {_inventory.%player%} to nbt of player's tool
        message "&a%{_inventory.%player%}%" to the player

#This one count all diamond with custom model data 6589 in player's inventory  
command /nmdata:
    trigger:
        set {_inventory.%player%} to number of diamond with custom model data 6589 in player's inventory
        message "&a%{_inventory.%player%}%" to the player
  • Step 1:
    I've generated a diamond with the plugin MMOItems, with CustomModelData 6589.

  • Step 2:
    I've generated a diamond with the first command (/gmdata).
    It gives me a diamond with CustomModelData 6589.

  • Step 3:
    I use the command /mdata on both.
    It displays me "6589" for each diamond (So the CustomModelData is well recognized)
    Image:
    Test1

  • Step 4:
    I use the command /nbt on both.
    It displays me the NBT of both items, and the "CustomModelData" is well defined as 6589 into NBT of BOTH diamonds.
    Image:
    Test2
    Test3

  • Step 5:
    I use the command /nmdata
    It display "1" even if i have 2 diamonds with custom model data 6589 in my inventory. (It count only the one generated by the command "/gmdata")
    I can generate more diamonds with the command, it count every diamonds like that in my inventory, no problem, however, every other diamond generated with another plugin, is ignored.
    Image:
    Test4

Errors or Screenshots

No errors.

Other

I'm trying to make a command that give to the player an item, based on if he have the right amount of the right items in his inventory.

How is it supposed to work if there was not this bug?:
Like that:

command /test:
    trigger:
        set {_diampur} to amount of diamond with custom model data 6589 in player's inventory                                                          
        if {_diampur} is more than 2:                                                           
            remove 3 diamond with custom model data 6589 from player's inventory                
            make console execute command "/give %player% diamond_axe 1"

I've tried everything to make it works. Impossible.
I don't have found a way.... IN 2+ WEEKS OF TESTS!
I also have asked for help in many forums, no one have a solution.
Someone told me to use loops... yeah, i did it.
I'm still blocked, 'cause i can't remove the right amount of the right items into the player's inventory.
A loop like that does not work:

command /looper:
    trigger:
        loop items in player's inventory:
            if name of loop-item is "&f&lDiamant épuré":
                if loop-item is higher than 2:
                    remove 3 loop-item
  • The name is well considered (Even if it's a MMOItems item) This one works
  • The "Is higher than 2" does not count the amount of loop-item (But the condition "amount of loop-item" create a console error)
  • Impossible to remove an amount of the loop-item as it's not numerical.

I don't see any solutions.
Have a nice day! =)

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
@EquipableMC
Copy link
Contributor

Have you tried seeing if this was an issue in 2.7.2 as well?

@tiradorus
Copy link
Author

Yes, i just tried now, Same issue on 2.7.2

@AyhamAl-Ali AyhamAl-Ali added the investigating The core developers are currently investigating this issue. Usually used for complex cases. label Nov 20, 2023
@AyhamAl-Ali
Copy link
Member

@APickledWalrus WANTED! 😬

@Fusezion
Copy link
Contributor

Honestly if pickle does take this up, I suggest looking into a better item comparison as a whole. There's too many quirks with it and the usage of isSimilar() is honestly either too inaccurate or too accurate.

@tiradorus
Copy link
Author

tiradorus commented Nov 21, 2023

The problem occurs with...almost every conditions you are looking for.

All of thoses conditions have the same problem
I've tried thoses one:

command /test:
    trigger:
        set {_diampur1} to amount of diamond with custom model data 6589 in player's inventory
        set {_diampur2} to amount of diamond of fortune 3 in player's inventory 
        set {_diampur3} to amount of diamond named "&f&lDiamond test" in player's inventory

None of thoses conditions are considered from skript if the item you are looking for is generated with another plugin, even if the condition is okay.
And i don't see any other option to check if the player have the right amount of the right item in his inventory.

PS: Thanks for your answer.

@sovdeeth
Copy link
Member

sovdeeth commented Nov 24, 2023

And i don't see any other option to check if the player have the right amount of the right item in his inventory.

Your other idea of using a loop is the current correct solution, you were just using the wrong expressions:

command /looper:
    trigger:
        loop items in player's inventory:
            if:
                name of loop-item is "&f&lDiamant épuré"
                item amount of loop-item > 2
            then:
                remove 3 of loop-item from player

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating The core developers are currently investigating this issue. Usually used for complex cases.
Projects
None yet
Development

No branches or pull requests

5 participants