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

"Is Enchanted" condition doesn't check for enchantment level #3664

Closed
oskarkk opened this issue Dec 29, 2020 · 2 comments
Closed

"Is Enchanted" condition doesn't check for enchantment level #3664

oskarkk opened this issue Dec 29, 2020 · 2 comments
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@oskarkk
Copy link
Contributor

oskarkk commented Dec 29, 2020

Description

"Is Enchanted" condition is true for every level of enchantment that is tested. Possibly existing since #2049

Steps to Reproduce

on inventory click:
  if event-item is enchanted with efficiency 3:
    message "efi3"
  if event-item is enchanted with efficiency 4:
    message "efi4"
  if event-item is enchanted with efficiency 5:
    message "efi5"

Then if you click on any item enchanted with any level of efficiency you will get:

efi3
efi4
efi5

Expected Behavior

Official docs:
%item types% (is|are) enchanted [with %enchantment type%]

Official example:
tool of the player is enchanted with efficiency 2

Enchantment type syntax (formatting on the website is broken btw):
<enchantment> [<level>]

So, e.g. efi5 should appear only when clicking an item with efficiency 5.

Server Information

[17:25:10 Server thread/INFO] [Skript] Server Version: git-Spigot-628435a-6917945 (MC: 1.16.4)
[17:25:10 Server thread/INFO] [Skript] Skript Version: 2.5.3
[17:25:10 Server thread/INFO] [Skript] Installed Skript Addons:
[17:25:10 Server thread/INFO] [Skript]  - Skellett v1.9.11 (https://forums.skunity.com/resources/skellett.24/)
[17:25:10 Server thread/INFO] [Skript]  - SkQuery v4.1.4
[17:25:10 Server thread/INFO] [Skript]  - SkBee v1.9.1 (https://github.com/ShaneBeee/SkBee)
[17:25:10 Server thread/INFO] [Skript]  - Ersatz v1.0
@TPGamesNL
Copy link
Member

This is caused by

return items.check(e, item -> enchs.check(e, ench -> item.hasEnchantments(ench)), isNegated());

there is simply no check for the level

@TPGamesNL TPGamesNL added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Mar 12, 2021
@FranKusmiruk
Copy link
Member

This is caused by

return items.check(e, item -> enchs.check(e, ench -> item.hasEnchantments(ench)), isNegated());

there is simply no check for the level

Do note, the logic should be added to the ItemType#hasEnchantments(EnchantmentType...) check.

@TPGamesNL TPGamesNL added the PR available Issues which have a yet-to-be merged PR resolving it label Mar 23, 2021
@APickledWalrus APickledWalrus added completed The issue has been fully resolved and the change will be in the next Skript update. and removed PR available Issues which have a yet-to-be merged PR resolving it labels May 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.
Projects
None yet
Development

No branches or pull requests

5 participants