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

NPE from setting variable to drops & ClassCastException: CreatureSpawnEvent > ProjectileLaunchEvent #4350

Closed
1 task done
staridiot opened this issue Oct 8, 2021 · 4 comments

Comments

@staridiot
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-318 (MC: 1.17.1)
[Skript] Skript Version: 2.6-beta2
[Skript] Installed Skript Addons:
[Skript]  - MorkazSk v1.2
[Skript]  - skript-reflect v2.2.3 (https://github.com/TPGamesNL/skript-reflect)
[Skript]  - SkBee v1.11.2 (https://github.com/ShaneBeee/SkBee)

Bug Description

NullPointerException

This error occurs very infrequently, I can't find any rhyme or reason for it. It seems to be because I have modified load outs of various mobs when they spawn. I also have the loot reduced by 50%, one of these things is likely causing it to fail.
Error here

ClassCastException

This one happens quite frequently when spawning a bunch of mobs with a command block. Seems to be from setting the off hand tool of a mob.
Error here

Expected Behavior

NullPointerException

When this error occurs, the variable never gets set to the drops which can cause issues.

ClassCastException

Unlikely to happen in regular use, but it still happened and probably shouldn't.

Steps to Reproduce

NullPointerException

Honestly can't tell you for sure. I believe it's partially because I modified the armor and tools of the mobs when they spawned and have the drops modified when they die. I can't seem to get this to happen without those two things. Even with those things, it's very inconsistent.

ClassCastException

Seems to be caused by setting the off hand tool of a mob when it spawns, then spawning a boat load of said mob.

Errors or Screenshots

No response

Other

No response

Agreement

  • I have read the guidelines above and confirm I am following them with this report.
@AyhamAl-Ali
Copy link
Member

AyhamAl-Ali commented Oct 8, 2021

Send the code block that caused that error and try to update skript to beta3

As for the ClassCastException there is nothing called event-living entity it's event-livingentity however in your case it is event-entity since the spawn event can be triggered by non-living-entities

@staridiot
Copy link
Author

MY BAD! I thought I was on the latest version, downloaded it but apparently didn't verify it uploaded properly.

After updating I confirmed that these errors are still present. Here is the log file of the server.
latest.log

Here is the script I used to reproduce these errors. The NPE is quite hard to reproduce, I had to spawn hundreds of skeletons that used the equipment given by this script and kill them all with sweeping edge. It may be because of something they spawned with.
extrahard1.txt

@TPGamesNL
Copy link
Member

TPGamesNL commented Oct 9, 2021

The CCE is probably a duplicate of #3499.

The NPE can be fixed by adding a Objects::nonNull to the stream in ExprDrops (even though I don't know why the list contains a null value in the first place)

(low prio because a null value in the drops list is probably some plugin's mistake)

@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 Oct 9, 2021
@TPGamesNL
Copy link
Member

Actually I am going to close this, because the remaining issue (the NPE) is a plugin issue (or maybe server issue), because I don't think the drops list in a death event should contain null values, and looking at your script and the exception, it looks like the event was called with the null value in the list (or added to it before the event was passed to Skript)

@TPGamesNL TPGamesNL removed 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 Oct 30, 2021
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

3 participants