diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-02-01 23:18:25 +0000 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-02-01 23:18:25 +0000 |
commit | 21b8ef44356e454dca59b266ea727910940cb48f (patch) | |
tree | 3b1b6ceaf29d4369e35d3242c592eb2b88c41b43 /src/main/java | |
parent | e0416ca7fb4057496d1fcd9159e3602a44416d18 (diff) | |
download | craftbukkit-21b8ef44356e454dca59b266ea727910940cb48f.tar craftbukkit-21b8ef44356e454dca59b266ea727910940cb48f.tar.gz craftbukkit-21b8ef44356e454dca59b266ea727910940cb48f.tar.lz craftbukkit-21b8ef44356e454dca59b266ea727910940cb48f.tar.xz craftbukkit-21b8ef44356e454dca59b266ea727910940cb48f.zip |
Added CraftNoteBlock.play
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java index 9927730b..333b1cb0 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java @@ -1,31 +1,45 @@ -package org.bukkit.craftbukkit.block;
-
-import net.minecraft.server.TileEntityNote;
-import org.bukkit.block.Block;
-import org.bukkit.block.NoteBlock;
-import org.bukkit.craftbukkit.CraftWorld;
-
-/**
- * Represents a note block.
- *
- * @author sk89q
- */
-public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
- private final CraftWorld world;
- private final TileEntityNote note;
-
- public CraftNoteBlock(final Block block) {
- super(block);
-
- world = (CraftWorld)block.getWorld();
- note = (TileEntityNote)world.getTileEntityAt(getX(), getY(), getZ());
- }
-
- public byte getNote() {
- return note.e;
- }
-
- public void setNote(byte n) {
- note.e = n;
- }
-}
+package org.bukkit.craftbukkit.block; + +import net.minecraft.server.TileEntityNote; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.NoteBlock; +import org.bukkit.craftbukkit.CraftWorld; + +/** + * Represents a note block. + * + * @author sk89q + */ +public class CraftNoteBlock extends CraftBlockState implements NoteBlock { + private final CraftWorld world; + private final TileEntityNote note; + + public CraftNoteBlock(final Block block) { + super(block); + + world = (CraftWorld)block.getWorld(); + note = (TileEntityNote)world.getTileEntityAt(getX(), getY(), getZ()); + } + + public byte getNote() { + return note.e; + } + + public void setNote(byte n) { + note.e = n; + } + + public boolean play() { + Block block = getBlock(); + + synchronized (block) { + if (block.getType() == Material.NOTE_BLOCK) { + note.a(world.getHandle(), getX(), getY(), getZ()); + return true; + } else { + return false; + } + } + } +} |