mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-28 22:47:32 +02:00
Account for null blocks in PlayerInteractEvent handling.
Before elytra boost these events had been ignored for most, now instead of an early return, just the checks/logging using the block are skipped.
This commit is contained in:
parent
0262ac4ccd
commit
a5b0bd0fae
@ -157,6 +157,7 @@ public class BlockInteractListener extends CheckListener {
|
||||
preventUseItem = true;
|
||||
}
|
||||
|
||||
if (block != null) {
|
||||
// First the reach check.
|
||||
if (!cancelled && reach.isEnabled(player) && reach.check(player, loc, block, data, cc)) {
|
||||
cancelled = true;
|
||||
@ -171,6 +172,7 @@ public class BlockInteractListener extends CheckListener {
|
||||
if (!cancelled && visible.isEnabled(player) && visible.check(player, loc, block, face, action, data, cc)) {
|
||||
cancelled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If one of the checks requested to cancel the event, do so.
|
||||
if (cancelled) {
|
||||
@ -244,7 +246,7 @@ public class BlockInteractListener extends CheckListener {
|
||||
private void checkEnderPearlRightClickBlock(final Player player, final Block block,
|
||||
final BlockFace face, final PlayerInteractEvent event,
|
||||
final int previousLastTick, final BlockInteractData data) {
|
||||
if (!BlockProperties.isPassable(block.getType())) {
|
||||
if (block == null || !BlockProperties.isPassable(block.getType())) {
|
||||
final CombinedConfig ccc = CombinedConfig.getConfig(player);
|
||||
if (ccc.enderPearlCheck && ccc.enderPearlPreventClickBlock) {
|
||||
event.setUseItemInHand(Result.DENY);
|
||||
@ -269,11 +271,17 @@ public class BlockInteractListener extends CheckListener {
|
||||
builder.append("Interact cancel: " + event.isCancelled());
|
||||
builder.append(" (");
|
||||
builder.append(tag);
|
||||
if (block == null) {
|
||||
builder.append(") block: null");
|
||||
}
|
||||
else {
|
||||
builder.append(") block: ");
|
||||
builder.append(block.getWorld().getName() + "/" + LocUtil.simpleFormat(block));
|
||||
builder.append(" type: " + BlockProperties.getId(block.getType()));
|
||||
builder.append(" data: " + BlockProperties.getData(block));
|
||||
builder.append(" face: " + face);
|
||||
}
|
||||
|
||||
if (data.rateLimitSkip > 0) {
|
||||
builder.append(" skipped(rate-limit: " + data.rateLimitSkip);
|
||||
data.rateLimitSkip = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user