PlayerInteractEvent does not necessarily interact with a block

This commit is contained in:
dordsor21 2022-01-20 14:12:13 +00:00
parent 827f46566c
commit 4c166d057e
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -154,7 +154,6 @@ import org.checkerframework.checker.nullness.qual.NonNull;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
@ -1065,9 +1064,13 @@ public class PlayerEventListener extends PlotListener implements Listener {
if (area == null) {
return;
}
PlayerBlockEventType eventType = null;
PlayerBlockEventType eventType;
BlockType blocktype1;
Block block = event.getClickedBlock();
if (block == null) {
// We do not care in this case, the player is likely interacting with air ("nothing").
return;
}
Location location = BukkitUtil.adapt(block.getLocation());
Action action = event.getAction();
switch (action) {