diff --git a/paper-api/src/main/java/org/bukkit/Material.java b/paper-api/src/main/java/org/bukkit/Material.java index 6bc9509012..492e93a06d 100644 --- a/paper-api/src/main/java/org/bukkit/Material.java +++ b/paper-api/src/main/java/org/bukkit/Material.java @@ -67,7 +67,7 @@ public enum Material { BURNING_FURNACE(62), SIGN_POST(63), WOODEN_DOOR(64), - LADDER(65), + LADDER(65, Ladder.class), RAILS(66), COBBLESTONE_STAIRS(67), WALL_SIGN(68), diff --git a/paper-api/src/main/java/org/bukkit/material/Ladder.java b/paper-api/src/main/java/org/bukkit/material/Ladder.java new file mode 100644 index 0000000000..313580d2c2 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/material/Ladder.java @@ -0,0 +1,48 @@ + +package org.bukkit.material; + +import org.bukkit.BlockFace; +import org.bukkit.Material; + +/** + * Represents Ladder data + */ +public class Ladder extends MaterialData implements Attachable { + public Ladder(final int type) { + super(type); + } + + public Ladder(final Material type) { + super(type); + } + + public Ladder(final int type, final byte data) { + super(type, data); + } + + public Ladder(final Material type, final byte data) { + super(type, data); + } + + /** + * Gets the face that this block is attached on + * + * @return BlockFace attached to + */ + public BlockFace getAttachedFace() { + byte data = getData(); + + switch (data) { + case 0x2: + return BlockFace.WEST; + case 0x3: + return BlockFace.EAST; + case 0x4: + return BlockFace.SOUTH; + case 0x5: + return BlockFace.NORTH; + } + + return null; + } +} \ No newline at end of file