예제 #1
0
  // RŽcupŽration du Relative et ajout du SignManager dans le Set
  public static boolean registerSign(Location locsign) {
    try {
      locsign.getBlock();
    } catch (Exception e) {
      return false;
    } // VŽrifie sur la locsign est un block

    if (!(locsign.getBlock().getState() instanceof org.bukkit.block.Sign)) return false;

    Block bs = locsign.getBlock();
    org.bukkit.material.Sign signmat = (org.bukkit.material.Sign) bs.getState().getData();
    Location relative = null;

    if (!signmat.isWallSign()) relative = bs.getRelative(BlockFace.DOWN).getLocation();
    else if (signmat.getAttachedFace() == BlockFace.EAST)
      relative = bs.getRelative(BlockFace.EAST).getLocation();
    else if (signmat.getAttachedFace() == BlockFace.WEST)
      relative = bs.getRelative(BlockFace.WEST).getLocation();
    else if (signmat.getAttachedFace() == BlockFace.NORTH)
      relative = bs.getRelative(BlockFace.NORTH).getLocation();
    else if (signmat.getAttachedFace() == BlockFace.SOUTH)
      relative = bs.getRelative(BlockFace.SOUTH).getLocation();

    SignManager sm = new SignManager(locsign, relative);
    sm.RefreshSign();
    return true;
  }