001 package org.bukkit.material; 002 003 import org.bukkit.Material; 004 005 /** 006 * Represents a powered rail 007 */ 008 public class PoweredRail extends ExtendedRails implements Redstone { 009 public PoweredRail() { 010 super(Material.POWERED_RAIL); 011 } 012 013 /** 014 * 015 * @deprecated Magic value 016 */ 017 @Deprecated 018 public PoweredRail(final int type) { 019 super(type); 020 } 021 022 public PoweredRail(final Material type) { 023 super(type); 024 } 025 026 /** 027 * 028 * @deprecated Magic value 029 */ 030 @Deprecated 031 public PoweredRail(final int type, final byte data) { 032 super(type, data); 033 } 034 035 /** 036 * 037 * @deprecated Magic value 038 */ 039 @Deprecated 040 public PoweredRail(final Material type, final byte data) { 041 super(type, data); 042 } 043 044 public boolean isPowered() { 045 return (getData() & 0x8) == 0x8; 046 } 047 048 /** 049 * Set whether this PoweredRail should be powered or not. 050 * 051 * @param isPowered whether or not the rail is powered 052 */ 053 public void setPowered(boolean isPowered) { 054 setData((byte) (isPowered ? (getData() | 0x8) : (getData() & ~0x8))); 055 } 056 057 @Override 058 public PoweredRail clone() { 059 return (PoweredRail) super.clone(); 060 } 061 }