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

Checking if a player has an item (item as variable) #999

Closed
StealWonders opened this issue Dec 3, 2017 · 8 comments
Closed

Checking if a player has an item (item as variable) #999

StealWonders opened this issue Dec 3, 2017 · 8 comments
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something. priority: low Issues that are not harmful to the experience but are related to useful changes or additions.

Comments

@StealWonders
Copy link

This code no longer works with dev32b
player's inventory doesn't contain 16 of {arrow.poison} give 1 of {arrow.poison} to player
It used to allow me to check if a player has a poisonarrow (they aren't in aliases yet).

@DankPrison
Copy link

@StealWonders for the time being you can use still check for tipped arrows and use command like /give @p minecraft:tipped_arrow 1 0 {Potion:"minecraft:poison"} to give poison arrows.

@Syst3ms
Copy link
Contributor

Syst3ms commented Dec 13, 2017

Or you could use QuarSK

@bensku bensku added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label Dec 13, 2017
@bensku
Copy link
Member

bensku commented Dec 13, 2017

I'm not really sure it would have not worked even before. What exactly does arrow.poison variable contain?

@StealWonders
Copy link
Author

An itemstack...

@bensku
Copy link
Member

bensku commented Dec 14, 2017

Not accurate enough. What code sets it?

@StealWonders
Copy link
Author

set {arrow.%arg%} to player's tool
or something similar

@bensku
Copy link
Member

bensku commented Dec 15, 2017

Hm, that should not be causing any problems.

@Snow-Pyon Snow-Pyon added aliases-rework priority: low Issues that are not harmful to the experience but are related to useful changes or additions. labels Feb 11, 2018
@Whimsyturtle Whimsyturtle added the needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls. label Jul 10, 2020
@TPGamesNL
Copy link
Member

2.6-alpha1

command /test:
	trigger:
		if player's inventory contains 16 of {item}:
			message "yes contain"
		else:
			message "no contain"

set {item} to tool of me when holding 1 stone
conditions returns true only if there is an exact item stack of 16 stone in the inventory, if the item amount is 17, is returns false.

CondContains uses ItemType#isContainedIn for ItemTypes, but Inventory#contains for ItemStack. The latter does not check item amounts like the first method does.

Possibly related to #3814, but this might be fixed by having ExprXOf accept itemtype

@TPGamesNL TPGamesNL removed the needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls. label Jun 15, 2021
@APickledWalrus APickledWalrus added the PR available Issues which have a yet-to-be merged PR resolving it label Aug 15, 2021
@TPGamesNL TPGamesNL 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 Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed The issue has been fully resolved and the change will be in the next Skript update. enhancement Feature request, an issue about something that could be improved, or a PR improving something. 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

9 participants