diff options
author | obnoxint <mail@obnoxint.net> | 2012-06-10 17:39:18 +0200 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-06-14 20:58:57 -0500 |
commit | e35f6f25260019304631b55635ca49323ca0c7b9 (patch) | |
tree | 09fe0ddd4a7704a7a320675c2c40be2bc512824a /src | |
parent | 72d64b516cae5c6720c71e46289ec9996ded2db9 (diff) | |
download | craftbukkit-e35f6f25260019304631b55635ca49323ca0c7b9.tar craftbukkit-e35f6f25260019304631b55635ca49323ca0c7b9.tar.gz craftbukkit-e35f6f25260019304631b55635ca49323ca0c7b9.tar.lz craftbukkit-e35f6f25260019304631b55635ca49323ca0c7b9.tar.xz craftbukkit-e35f6f25260019304631b55635ca49323ca0c7b9.zip |
Fire NotePlayEvent. Fixes BUKKIT-1779
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/minecraft/server/TileEntityNote.java | 9 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 6 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/TileEntityNote.java b/src/main/java/net/minecraft/server/TileEntityNote.java index 684bbc6d..78c6b553 100644 --- a/src/main/java/net/minecraft/server/TileEntityNote.java +++ b/src/main/java/net/minecraft/server/TileEntityNote.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit + public class TileEntityNote extends TileEntity { public byte note = 0; @@ -50,7 +52,12 @@ public class TileEntityNote extends TileEntity { 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 } } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index a0c4715d..79ad5256 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -520,4 +520,10 @@ public class CraftEventFactory { world.getServer().getPluginManager().callEvent(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; + } } |