From 2e7c22c42bc7f34b2a73b23f3ee6a9a75d439271 Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Sat, 15 Jan 2011 20:30:27 +0000 Subject: [PATCH] RedstoneTorch MaterialData + Redstone interface --- .../java/org/bukkit/material/Redstone.java | 15 ++++++++ .../org/bukkit/material/RedstoneTorch.java | 35 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/main/java/org/bukkit/material/Redstone.java create mode 100644 src/main/java/org/bukkit/material/RedstoneTorch.java diff --git a/src/main/java/org/bukkit/material/Redstone.java b/src/main/java/org/bukkit/material/Redstone.java new file mode 100644 index 00000000..295fb02b --- /dev/null +++ b/src/main/java/org/bukkit/material/Redstone.java @@ -0,0 +1,15 @@ + +package org.bukkit.material; + +/** + * Indicated a Material that may carry or create a Redstone current + */ +public interface Redstone { + /** + * Gets the current state of this Material, indicating if it's powered or + * unpowered + * + * @return true if powered, otherwise false + */ + public boolean isPowered(); +} diff --git a/src/main/java/org/bukkit/material/RedstoneTorch.java b/src/main/java/org/bukkit/material/RedstoneTorch.java new file mode 100644 index 00000000..04e5148d --- /dev/null +++ b/src/main/java/org/bukkit/material/RedstoneTorch.java @@ -0,0 +1,35 @@ + +package org.bukkit.material; + +import org.bukkit.Material; + +/** + * Represents a redstone torch + */ +public class RedstoneTorch extends Torch implements Redstone { + public RedstoneTorch(final int type) { + super(type); + } + + public RedstoneTorch(final Material type) { + super(type); + } + + public RedstoneTorch(final int type, final byte data) { + super(type, data); + } + + public RedstoneTorch(final Material type, final byte data) { + super(type, data); + } + + /** + * Gets the current state of this Material, indicating if it's powered or + * unpowered + * + * @return true if powered, otherwise false + */ + public boolean isPowered() { + return getItemType() == Material.REDSTONE_TORCH_ON; + } +}