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

Skript can not detect enchantment books properly #7339

Open
1 task done
killstalker12121 opened this issue Dec 31, 2024 · 2 comments
Open
1 task done

Skript can not detect enchantment books properly #7339

killstalker12121 opened this issue Dec 31, 2024 · 2 comments

Comments

@killstalker12121
Copy link

killstalker12121 commented Dec 31, 2024

Skript/Server Version

[21:52:56 INFO]: [Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[21:52:56 INFO]: [Skript] Skript's documentation can be found here: https://docs.skriptlang.org/
[21:52:56 INFO]: [Skript] Skript's tutorials can be found here: https://docs.skriptlang.org/tutorials
[21:52:56 INFO]: [Skript] Server Version: 1.21.1-132-b48403b (MC: 1.21.1)
[21:52:56 INFO]: [Skript] Skript Version: 2.9.5 (skriptlang-github)
[21:52:56 INFO]: [Skript] Installed Skript Addons: 
[21:52:56 INFO]: [Skript]  - SkBee v3.6.4 (https://github.com/SkriptHub/SkBee)
[21:52:56 INFO]: [Skript] Installed dependencies: 
[21:52:56 INFO]: [Skript]  - Vault v1.7.3-b131
[21:52:56 INFO]: [Skript]  - WorldGuard v7.0.12+829a4a4

Bug Description

So when i was skripting with enchantment books i came upon a bug. Skript can not properly detect stored enchantments as a string. When debugging the stored enchantments the value returns with "sharpness 1" etc. But when i try to see if it contains "sharpness" it returns false. UNLESS i Specifically check for "sharpness 1" then suddenly it works. Even tho it contains "sharpness". I Did try to convert it into a string but it came back with the exact same results.

Expected Behavior

It was expected to be detected when i wrote (if variable contains "sharpness") to be detected. Instead i had to check specifically for each letter such as "sharpness 1"

Steps to Reproduce

command /checking:
	trigger:
		set {_enchant::*} to stored enchants of player's tool
		broadcast "%{_enchant::*}%"
		if {_enchant::*} contains sharpness:
			broadcast "&c&lDebug code 1: &c&lSharpness detected" 
		if {_enchant::*} contains sharpness 1:
			broadcast "&c&lDebug code 2: &c&lSharpness 1 specifically detected" 
		if {_enchant::*} contains "sharpness":
			broadcast "&c&lDebug code 3: &c&lSharpness String detected" 
		if {_enchant::*} contains "sharpness 1":
			broadcast "&c&lDebug code 4: &c&lSharpness String 2 specifically detected" 

Errors or Screenshots

bild_2024-12-31_230425309

Other

image
Please notice that the "sharpness 1" is from the 4th line, Indicating that "sharpness" does in fact exist. And it does trigger properly only when directly asked for sharpness 1. Wish means "contains" does not work. If this is not a bug then i hope to request this as a feature

Agreement

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

I think the issue here is the difference between types.
sharpness = Enchantment
sharpness 1= EnchantmentType

So the list contains enchantment types, so checking if it contains an enchantment is bound to return false.

@killstalker12121
Copy link
Author

killstalker12121 commented Dec 31, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants