9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-28 19:39:11 +00:00

improve event performance

This commit is contained in:
XiaoMoMi
2025-03-26 22:12:01 +08:00
parent 4f616ac142
commit 797d935171
2 changed files with 5 additions and 6 deletions

View File

@@ -308,10 +308,10 @@ public class BlockEventListener implements Listener {
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onBlockPhysics(BlockPhysicsEvent event) {
if (!this.enableNoteBlockCheck) return;
Block block = event.getBlock();
// for vanilla blocks
if (block.getBlockData() instanceof NoteBlock) {
if (event.getChangedType() == Material.NOTE_BLOCK) {
try {
Block block = event.getBlock();
World world = block.getWorld();
Location location = block.getLocation();
Block sourceBlock = event.getSourceBlock();