3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00

Fire NotePlayEvent. Fixes BUKKIT-1779

Dieser Commit ist enthalten in:
obnoxint 2012-06-10 17:39:18 +02:00 committet von Travis Watkins
Ursprung 72d64b516c
Commit e35f6f2526
2 geänderte Dateien mit 14 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class TileEntityNote extends TileEntity { public class TileEntityNote extends TileEntity {
public byte note = 0; public byte note = 0;
@ -50,7 +52,12 @@ public class TileEntityNote extends TileEntity {
b0 = 4; b0 = 4;
} }
world.playNote(i, j, k, b0, this.note); // CraftBukkit start
org.bukkit.event.block.NotePlayEvent event = CraftEventFactory.callNotePlayEvent(this.world, i, j, k, b0, this.note);
if (!event.isCancelled()) {
this.world.playNote(i, j, k, event.getInstrument().getType(), event.getNote().getId());
}
// CraftBukkit end
} }
} }
} }

Datei anzeigen

@ -520,4 +520,10 @@ public class CraftEventFactory {
world.getServer().getPluginManager().callEvent(event); world.getServer().getPluginManager().callEvent(event);
return event; return event;
} }
public static NotePlayEvent callNotePlayEvent(World world, int x, int y, int z, byte instrument, byte note) {
NotePlayEvent event = new NotePlayEvent(world.getWorld().getBlockAt(x, y, z), org.bukkit.Instrument.getByType(instrument), new org.bukkit.Note(note));
world.getServer().getPluginManager().callEvent(event);
return event;
}
} }