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

Cancelling a Death Event makes you not able to drop items in that scope #4288

Closed
1 task done
mowmowkittycat opened this issue Aug 18, 2021 · 2 comments
Closed
1 task done
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

@mowmowkittycat
Copy link

Skript/Server Version

[Skript] Skript's aliases can be found here: https://github.com/SkriptLang/skript-aliases
[Skript] Skript's documentation can be found here: https://skriptlang.github.io/Skript
[Skript] Server Version: git-Paper-133 (MC: 1.17.1)
[Skript] Skript Version: 2.5.3
[Skript] Installed Skript Addons:
[Skript]  - skript-gui v1.2.2 (https://github.com/APickledWalrus/skript-gui)
[Skript]  - Skellett v1.9.11 (https://forums.skunity.com/resources/skellett.24/)
[Skript]  - SkQuery v4.1.4
[Skript]  - SkBee v1.11.2 (https://github.com/ShaneBeee/SkBee)

Bug Description

if you cancel a death event and try to drop something it does not drop it

Expected Behavior

it should drop stuff

Steps to Reproduce

on death:
	victim is a player
	set {_p} to victim
	cancel event
	set {_p}'s max health to {_p}'s max health - 1
	set {_i1} to {shard}
	set {_i} to {_i1} named  "<##a57bb8>&l۞ <##6e4082>Soul Shard <##a57bb8>&l۞" with lore "&f", "<##794c8f>A Mysterious Shard", "<##794c8f>That emits ominous energy", "", "<##776b7d>Right-Click to gain hearts" and "&f"
	add "{""Soul"":1}" to nbt of {_i}
	add "{""SoulID"":%random integer between 1000 and 9999%}" to nbt of {_i}
	set {_l} to {_p}'s location
	drop {_i} at {_p}
	drop all items in {_p}'s inventory at {_l}
	wait 5 ticks
	play sound "entity.wither.ambient" with pitch 2 to {_p}
	play sound "entity.wither.ambient" with pitch 0.1 to {_p}
	teleport {_p} to {spawn}
	

use this code and then do /kill on your self

Errors or Screenshots

no errors

Other

nope

Agreement

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

You can't cancel a death event, perhaps the code below is ignored when you attempt it.

@TPGamesNL
Copy link
Member

EntityDeathEvent is Cancellable on Paper.

Caused by

if (e instanceof EntityDeathEvent && locations.isSingle() && ((EntityDeathEvent) e).getEntity().getLocation().equals(locations.getSingle(e)) && !Delay.isDelayed(e)) {
for (final Object o : os) {
if (o instanceof Experience) {
((EntityDeathEvent) e).setDroppedExp(((EntityDeathEvent) e).getDroppedExp() + ((Experience) o).getXP());
} else {
((ItemType) o).addTo(((EntityDeathEvent) e).getDrops());
}
}
return;
}

This code should either be removed or updated to adjust for event cancellation.

@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 Aug 18, 2021
@TPGamesNL TPGamesNL added the PR available Issues which have a yet-to-be merged PR resolving it label Aug 18, 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 Aug 30, 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

4 participants