Hi, I was working on a freeze command so a given player can be frozen and unfrozen. I achieved this by using EntityMoveEvent as below, but for some reason whenever an unfrozen player moves my console gets spammed with a NullPointerException. Can anyone tell me what I’m doing wrong. Thanks.
Code:
Chunk of Stacktrace:
mon.event.tracking.CauseTracker.switchToPhase(CauseTracker.java:160)[22:52:00] - Pastebin.com
I’m not sure where exactly your exception is coming from just by looking at it (no line 212 in your snippet) but you can simplify your code a lot:
You can directly filter for a Player using this:
@Listener public void onPlayerMove(MoveEntityEvent event, @Getter("getTargetEntity") Player player ) {
No need to check for the EntityType.
also
if (aBoolean == true) ...
can just be written as if (aBoolean) ...
Lines 212 is boolean person = configurationNode.getNode(“Frozen”, player.getName()).getBoolean();