-
-
Notifications
You must be signed in to change notification settings - Fork 641
Open
Description
The API allows logging block actions for any Material type, including non-block items, such as minecarts or boats, which is very useful.
They are simply ignored by rollbacks as expected, however enabling #preview on the rollback will throw a NullPointerException and abort the preview.
Steps to reproduce:
- install CoreProtect-additions (https://github.com/guss-alberto/CoreProtect-additions)
- place a minecart
- push it to a different block close by
- break the minecart
- run the command
/co rollback r:10 t:10m #preview
Expected result:
The rollback preview should be shown
Observed result:
[12:03:26 WARN]: java.lang.NullPointerException: Cannot invoke "org.bukkit.craftbukkit.block.data.CraftBlockData.getState()" because "block" is null
[12:03:26 WARN]: at org.bukkit.craftbukkit.entity.CraftPlayer.sendBlockChange(CraftPlayer.java:921)
[12:03:26 WARN]: at CoreProtect-23.1-nullcheck.jar//net.coreprotect.utility.Util.sendBlockChange(Util.java:24)
[12:03:26 WARN]: at CoreProtect-23.1-nullcheck.jar//net.coreprotect.database.rollback.RollbackBlockHandler.applyBlockChanges(RollbackBlockHandler.java:527)
[12:03:26 WARN]: at CoreProtect-23.1-nullcheck.jar//net.coreprotect.database.rollback.RollbackProcessor.processChunk(RollbackProcessor.java:246)
[12:03:26 WARN]: at CoreProtect-23.1-nullcheck.jar//net.coreprotect.database.rollback.Rollback.lambda$performRollbackRestore$1(Rollback.java:261)
......
[12:03:26 INFO]: [CoreProtect] Rollback or restore aborted.
Cause:
Util.sendBlockChange has no check for blockData not being null, unlike BlockUtils.setTypeAndData which does.
Possible fixes:
Add a null check for blockData in Util.sendBlockChange
Retrun if createBlockData returns null in BlockUtils.prepareTypeAndData
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels