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

Removing items with name from inventory doesn't work properly #2714

Closed
Thibaut040 opened this issue Dec 21, 2019 · 8 comments
Closed

Removing items with name from inventory doesn't work properly #2714

Thibaut040 opened this issue Dec 21, 2019 · 8 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: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).

Comments

@Thibaut040
Copy link

Thibaut040 commented Dec 21, 2019

Description

When you want to remove a named item from a player's inventory, it will remove the type of that item without a name as well.

Steps to Reproduce

  1. Put this in a script:
command /test: 
	trigger:
		remove diamond sword named "SuperSword" from player's inventory
		message "Done!"
		stop
  1. Get yourself a normal diamond sword. (without a name)
  2. Execute the command "test".
    You'll see the diamond sword is removed.
    Paper 1.14.4: All diamonds swords will be removed.
    Paper 1.15.1: However, if the sword has another name (Killer's Sword), it won't be removed.

Expected Behavior

The diamond sword shouldn't be removed.

Errors / Screenshots

/

Server Information

  • Server version/platform: Paper 1.14.4 and 1.15.1
  • Skript version: 2.4

Additional Context

/

@Thibaut040 Thibaut040 changed the title Removing items with name from inventory don't work properly Removing items with name from inventory doesn't work properly Dec 21, 2019
@Whimsyturtle Whimsyturtle added the needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls. label Dec 22, 2019
@Whimsyturtle
Copy link
Member

Can you please try and see if an issue like this arises with item lore and item enchants on Skript 2.4 & Paper 1.14.4 / Skript 2.4 & Paper 1.15.1? This could be a rather large issue if ItemMeta comparisons are broken for 1.15.1 (again)

@Thibaut040
Copy link
Author

Thibaut040 commented Dec 22, 2019

Ok, I came up with this:

command /test [<text>]: 
	trigger:
		if arg-1 is "get":
			give player a diamond sword #Sword 1
			give player a diamond sword named "<reset>Useless sword" #Sword 2
			give player a diamond sword named "<reset>Useless sword" with lore "test" #Sword 3
			give player a diamond sword named "<reset>Lightningsword" #Sword 4
			give player a diamond sword named "<reset>Lightningsword" with lore "test" #Sword 5
			give player a wooden sword #Sword 1
			give player a wooden sword with lore "Test" #Sword 2
			give player a wooden sword named "test" with lore "Test" #Sword 3
			stop
		if arg-1 is "a":
			remove all diamond swords named "<reset>Lightningsword" from player's inventory
			message "Done!"
			stop
		if arg-1 is "b":
			remove all wood swords with lore "Test" from player's inventory
			message "Done!"
			stop
		if arg-1 is "a2":
			loop all items in player's inventory:
				loop-item is a diamond sword named "<reset>Lightningsword"
				remove loop-item from player's inventory
			stop
		if arg-1 is "b2":
			loop all items in player's inventory:
				loop-item is a wooden sword with lore "Test"
				remove loop-item from player's inventory
			stop

When I executed "/test a",
Sword #1 and #4 were removed (should be Sword #4 and #5)

When I executed "/test a2",
Sword #1 was removed (should be Sword #4 and #5)

When I executed "/test b",
Sword #1 and #2 were removed (should be Sword #2 and #3)

When I executed "/test b2",
Sword #1 was removed (should be Sword #2 and #3)

  • I tested this on Paper 1.14.4 (Skript 2.4) and Paper 1.15.1 (Skript 2.4.1).

@Whimsyturtle
Copy link
Member

Edited your comment for ease of reading.

@Whimsyturtle Whimsyturtle added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). labels Dec 22, 2019
@bensku
Copy link
Member

bensku commented Dec 27, 2019

Bug was likely introduced in 2.4-beta10 based on a report in #2727.

@madebygood
Copy link

I tried to remove an item with the name "remove all item from player's inventory", but there is a problem that cannot be removed.

@iOshawott
Copy link

iOshawott commented Jan 30, 2020

hope it'll be fixed soon... :'(

since only this issue is open - yes, it's still happening on latest!

@bensku bensku added completed The issue has been fully resolved and the change will be in the next Skript update. and removed needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls. labels Feb 29, 2020
@bensku
Copy link
Member

bensku commented Feb 29, 2020

Apologies for delay. This was top priority to me, but I had no time to work on any Skript issues for a while.

ShaneBeee pushed a commit that referenced this issue Mar 1, 2020
* Fix accidental removal of items without ItemMeta
* Mark all ItemDatas created from stacks with CHANGED_TAGS
@ShaneBeee
Copy link
Contributor

Fixed in 2.5-alpha2

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: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).
Projects
None yet
Development

No branches or pull requests

6 participants