mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-12-01 13:23:26 +01:00
Fixed blocks broken by portal events not being logged (#45)
This commit is contained in:
parent
03bac937c3
commit
fae4c9e690
@ -11,6 +11,7 @@ import org.bukkit.event.world.PortalCreateEvent;
|
|||||||
import net.coreprotect.config.Config;
|
import net.coreprotect.config.Config;
|
||||||
import net.coreprotect.consumer.Queue;
|
import net.coreprotect.consumer.Queue;
|
||||||
import net.coreprotect.database.Lookup;
|
import net.coreprotect.database.Lookup;
|
||||||
|
import net.coreprotect.utility.Util;
|
||||||
|
|
||||||
public final class PortalCreateListener extends Queue implements Listener {
|
public final class PortalCreateListener extends Queue implements Listener {
|
||||||
|
|
||||||
@ -35,8 +36,16 @@ public final class PortalCreateListener extends Queue implements Listener {
|
|||||||
|
|
||||||
for (BlockState blockState : event.getBlocks()) {
|
for (BlockState blockState : event.getBlocks()) {
|
||||||
Material type = blockState.getType();
|
Material type = blockState.getType();
|
||||||
if (user.equals("#portal") || !type.equals(Material.OBSIDIAN)) {
|
BlockState oldBlock = blockState.getBlock().getState();
|
||||||
Queue.queueBlockPlace(user, blockState, blockState.getBlock().getType(), null, type, -1, 0, blockState.getBlockData().getAsString());
|
if (oldBlock.equals(blockState)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Util.isAir(type)) {
|
||||||
|
Queue.queueBlockBreak(user, oldBlock, oldBlock.getType(), oldBlock.getBlockData().getAsString(), 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Queue.queueBlockPlace(user, blockState, oldBlock.getType(), oldBlock, type, -1, 0, blockState.getBlockData().getAsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user