package net.moltendorf.Bukkit.IntelliDoors.controller;

import org.bukkit.block.Block;

/**
 * Created by moltendorf on 15/05/23.
 */
public class TrapDoor {
  public static Door getDoor(Block block) {
    return null;
  }
}

@@ -49,16 +49,97 @@
 oller;%0A%0A
+import org.bukkit.Location;%0Aimport org.bukkit.Material;%0Aimport org.bukkit.Sound;%0A
 import o
@@ -161,16 +161,16 @@
 .Block;%0A
-
 %0A/**%0A * 
@@ -230,16 +230,32 @@
 rapDoor 
+implements Door 
 %7B%0A  publ
@@ -292,16 +292,16 @@
 lock) %7B%0A
-
     retu
@@ -312,11 +312,1176 @@
 ull;%0A  %7D
+%0A%0A  private Material type;%0A%0A  private Location location;%0A%0A  protected Block block;%0A%0A  protected byte data;%0A%0A  public TrapDoor(Block block) %7B%0A    this.block = block;%0A%0A    data = block.getData();%0A    location = block.getLocation();%0A    type = block.getType();%0A  %7D%0A%0A  @Override%0A  public void open() %7B%0A    if (isClosed()) %7B%0A      data += 4;%0A%0A      block.setData(data);%0A    %7D%0A  %7D%0A%0A  @Override%0A  public void close() %7B%0A    if (isOpened()) %7B%0A      data -= 4;%0A%0A      block.setData(data);%0A    %7D%0A  %7D%0A%0A  @Override%0A  public void toggle() %7B%0A    data += isClosed() ? 4 : -4;%0A%0A    block.setData(data);%0A  %7D%0A%0A  @Override%0A  public boolean isOpened() %7B%0A    return (data & 4) == 4;%0A  %7D%0A%0A  @Override%0A  public boolean isClosed() %7B%0A    return (data & 4) == 0;%0A  %7D%0A%0A  @Override%0A  public Material getType() %7B%0A    return type;%0A  %7D%0A%0A  @Override%0A  public void wasToggled(Door onDoor) %7B%0A    if (type == Material.IRON_TRAPDOOR) %7B%0A      if (isClosed()) %7B%0A        open();%0A%0A        location.getWorld().playSound(location, Sound.BLOCK_IRON_TRAPDOOR_OPEN, 1, 1);%0A      %7D else %7B%0A        close();%0A%0A        location.getWorld().playSound(location, Sound.BLOCK_IRON_TRAPDOOR_CLOSE, 1, 1);%0A      %7D%0A    %7D%0A  %7D
 %0A%7D%0A

Implement trap door base functionality