BlockPlaceListener - Blockplace.Direction Bug

Fix placing blocks against ladders and carpets.
This commit is contained in:
CaptainObvious0 2019-03-16 19:21:31 -05:00 committed by GitHub
parent 37247c7e06
commit 5356487151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -263,9 +263,12 @@ public class BlockPlaceListener extends CheckListener {
if (isInteractBlock && bdata.isPassedCheck(CheckType.BLOCKINTERACT_DIRECTION)) {
skippedRedundantChecks ++;
}
else if (directionCheck && direction.check(player, loc, eyeHeight, block,
flyingHandle, data, cc, pData)) {
cancelled = true;
else if (directionCheck) {
if (blockAgainst.getType() == Material.LADDER || BlockProperties.isCarpet(blockAgainst.getType())) {
}
else if (direction.check(player, loc, eyeHeight, block, flyingHandle, data, cc, pData)) {
cancelled = true;
}
}
}
useLoc.setWorld(null);
@ -284,18 +287,19 @@ public class BlockPlaceListener extends CheckListener {
if (cancelled) {
event.setCancelled(cancelled);
}
else {
// Debug check breaks when checking blockAgainst is equal to something, disabled for now
/* else {
// Debug log (only if not cancelled, to avoid spam).
if (debug) {
debugBlockPlace(player, placedMat, block, blockAgainst,
skippedRedundantChecks, flyingHandle, pData);
}
}
} */
// Cleanup
// Reminder(currently unused): useLoc.setWorld(null);
}
private void debugBlockPlace(final Player player, final Material placedMat,
/** private void debugBlockPlace(final Player player, final Material placedMat,
final Block block, final Block blockAgainst,
final int skippedRedundantChecks, final FlyingQueueHandle flyingHandle,
final IPlayerData pData) {
@ -314,7 +318,7 @@ public class BlockPlaceListener extends CheckListener {
return;
}
}
}
} */
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onSignChange(final SignChangeEvent event) {